/* ============================================
   ATTACHMENT POPUP UI - RAF-12
   ChatGPT-style Bottom Sheet for File Attachments
   ============================================ */

/* ============================================
   ATTACHMENT BUTTON (near send button)
   ============================================ */

.attachment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 38px;
  padding: 0;
  border: none;
  background: transparent;
  color: #4BC451;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  /* Narrower width for vertical icon shape */
}

.attachment-btn:hover {
  background: rgba(75, 196, 81, 0.1);
  transform: scale(1.05);
}

.attachment-btn:active {
  transform: scale(0.95);
}

.attachment-btn svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

/* Context Plus Button - Green circle with white plus */
.attachment-btn.context-plus-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
}

.attachment-btn.context-plus-btn svg {
  width: 28px;
  height: 28px;
}

.attachment-btn.context-plus-btn:hover {
  background: transparent;
  transform: scale(1.1);
}

.attachment-btn.context-plus-btn:hover svg circle {
  fill: #3da843;
}

.attachment-btn.context-plus-btn:active {
  transform: scale(0.95);
}

/* ============================================
   BOTTOM SHEET - BACKDROP
   ============================================ */

.attachment-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.attachment-backdrop.show {
  opacity: 1;
}

.attachment-backdrop.hidden {
  display: none;
}

/* ============================================
   BOTTOM SHEET - MAIN CONTAINER
   ============================================ */

.attachment-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  max-height: 70vh;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  display: flex;
  flex-direction: column;
}

.attachment-sheet.show {
  transform: translateY(0);
}

.attachment-sheet.hidden {
  display: none;
}

/* Sheet Handle - ALWAYS fixed at top, above all content */
.sheet-handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 12px auto 8px;
  cursor: grab;
  flex-shrink: 0;
  position: relative;
  z-index: 100; /* Above all collapsible content */
}

.sheet-handle:active {
  cursor: grabbing;
}

/* Sheet Content - Scrollable area */
.attachment-sheet-content {
  padding: 0 0 env(safe-area-inset-bottom, 20px) 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0; /* Important for flex scrolling */
}

/* Sheet handle styles moved to main .attachment-sheet section above */

/* ============================================
   SHEET HEADER
   ============================================ */

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.sheet-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
}

.sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.sheet-close:hover {
  background: #f5f5f5;
  color: #1a1a1a;
}

/* ============================================
   MENU OPTIONS
   ============================================ */

.sheet-options {
  padding: 8px 12px;
}

.sheet-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: #f9fafb;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.sheet-option:hover {
  background: #f3f4f6;
  border-color: #4BC451;
}

.sheet-option:active {
  transform: scale(0.98);
  background: #f0f0f0;
}

.sheet-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #4BC451, #00b87a);
  border-radius: 10px;
  margin-right: 12px;
  flex-shrink: 0;
}

.sheet-option-icon svg {
  width: 20px;
  height: 20px;
  stroke: white;
}

.sheet-option-text {
  flex: 1;
}

.sheet-option-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.sheet-option-desc {
  font-size: 12px;
  color: #6b7280;
}

/* ============================================
   HIDDEN FILE INPUTS
   ============================================ */

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  /* RAF-40: REMOVED pointer-events: none - it prevents programmatic .click() */
  /* pointer-events: none; */
  clip: rect(0, 0, 0, 0);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .attachment-sheet {
    max-height: 80vh;
  }
  
  .sheet-option {
    padding: 12px 14px;
  }
  
  .sheet-option-icon {
    width: 40px;
    height: 40px;
  }
  
  /* Optimized button size on mobile */
  .attachment-btn {
    width: 30px;
    height: 38px;
  }
  
  .attachment-btn svg {
    width: 22px;
    height: 22px;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
  .attachment-sheet {
    background: #1f1f1f;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
  }
  
  .sheet-header {
    border-bottom-color: #333;
  }
  
  .sheet-title {
    color: #f5f5f5;
  }
  
  .sheet-option {
    background: #1f1f1f;
  }
  
  .sheet-option:hover {
    background: #2a2a2a;
  }
  
  .sheet-option-title {
    color: #f5f5f5;
  }
  
  .sheet-option-desc {
    color: #999;
  }
  
  .sheet-handle {
    background: #444;
  }
}

