/* =================================================================
   SHARED PANEL STYLES - iOS-Inspired Design
   Used by Features and Settings panels
================================================================= */

/* Panel Container - Slides in from right */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
}

.panel-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease-out, visibility 0.25s ease-out;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100%;
  height: 100dvh;
  background: var(--bg-secondary);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease-out;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  will-change: transform;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.panel.active {
  transform: translateX(0);
  transition: transform 0.3s ease-out;
}

/* Swipe Handle - Visual indicator for swipe zone */
.panel::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 40px;
  background: var(--border);
  border-radius: 2px;
  opacity: 0.5;
  z-index: 10;
}

@media (min-width: 769px) {
  .panel::before {
    display: none;
  }
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.panel-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-back-btn {
  background: none;
  border: none;
  color: var(--text-muted, #72767d);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-back-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary, #b5bac1);
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.panel-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Panel Content - wrapper inside panel that holds views */
#featuresPanelContent,
#featuresPanelContentDesktop,
#settingsPanelContent,
#settingsPanelContentDesktop {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.panel-content-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  min-height: 0;
}

/* Panel Views (for navigation within panel) */
.panel-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.panel-view.active {
  display: flex;
}

.panel-view > .panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

/* =================================================================
   LIST ITEMS - iOS Style
================================================================= */

.panel-list {
  padding: 0 12px;
}

.panel-list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  margin: 4px 0;
  background: var(--bg-tertiary);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  user-select: none;
}

.panel-list-item:hover {
  background: var(--bg-hover);
}

.panel-list-item:active {
  transform: scale(0.98);
}

.panel-list-item-icon {
  font-size: 24px;
  margin-right: 14px;
  flex-shrink: 0;
}

.panel-list-item-content {
  flex: 1;
  min-width: 0;
}

.panel-list-item-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.panel-list-item-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-list-item-action {
  margin-left: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Chevron for navigation items */
.panel-chevron {
  color: var(--text-muted);
  font-size: 18px;
}

/* =================================================================
   iOS-STYLE TOGGLE SWITCH
================================================================= */

.toggle-switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  border: 2px solid var(--border);
  transition: 0.3s;
  border-radius: 31px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 25px;
  width: 25px;
  left: 1px;
  top: 1px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--success);
  border-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =================================================================
   SECTION HEADERS
================================================================= */

.panel-section-header {
  padding: 20px 20px 8px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =================================================================
   FORM ELEMENTS INSIDE PANELS
================================================================= */

.panel-form-group {
  padding: 0 20px;
  margin-bottom: 20px;
}

.panel-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.panel-form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color 0.2s;
}

.panel-form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.panel-form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.panel-form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* =================================================================
   BUTTONS INSIDE PANELS
================================================================= */

.panel-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: center;
}

.panel-btn:active {
  transform: scale(0.98);
}

.panel-btn-primary {
  background: var(--accent);
  color: white;
}

.panel-btn-primary:hover {
  background: var(--accent-hover);
}

.panel-btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.panel-btn-secondary:hover {
  background: var(--bg-hover);
}

.panel-btn-danger {
  background: var(--danger);
  color: white;
}

.panel-btn-danger:hover {
  background: #c92a2f;
}

.panel-btn-group {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =================================================================
   FEATURE STATUS BADGES
================================================================= */

.feature-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.feature-badge-beta {
  background: rgba(250, 166, 26, 0.2);
  color: #faa61a;
}

.feature-badge-new {
  background: rgba(88, 101, 242, 0.2);
  color: var(--accent);
}

.feature-badge-coming {
  background: rgba(128, 132, 142, 0.2);
  color: var(--text-muted);
}

/* =================================================================
   MOBILE ADJUSTMENTS
================================================================= */

@media (max-width: 480px) {
  .panel {
    width: 100vw;
  }
  
  .panel-list-item {
    padding: 12px 14px;
  }
  
  .panel-list-item-icon {
    font-size: 22px;
  }
  
  .panel-list-item-title {
    font-size: 15px;
  }
}

/* =================================================================
   UPLOAD AREA (for Voice Debrief)
================================================================= */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--bg-tertiary);
}

.upload-area:hover {
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.05);
}

.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.1);
}

.upload-area input[type="file"] {
  display: none;
}

.upload-area-label {
  cursor: pointer;
  display: block;
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.upload-text {
  color: var(--text-primary);
  font-size: 15px;
  margin-bottom: 8px;
}

.upload-formats {
  font-size: 12px;
  color: var(--text-muted);
}

/* =================================================================
   FILES FEATURE - Apple Finder Style
================================================================= */

/* Files Panel Container */
.files-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 !important;
  overflow: hidden;
}

/* Search Bar */
.files-search-bar {
  padding: 12px 16px 8px;
  flex-shrink: 0;
}

.files-search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.2s;
}

.files-search-input-wrap:focus-within {
  border-color: var(--accent);
}

.files-search-icon {
  font-size: 14px;
  margin-right: 8px;
  opacity: 0.6;
}

.files-search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 10px 0;
  outline: none;
}

.files-search-input::placeholder {
  color: var(--text-muted);
}

.files-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  line-height: 1;
}

.files-search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Filter Pills */
.files-filter-bar {
  display: flex;
  gap: 6px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.files-filter-bar::-webkit-scrollbar {
  display: none;
}

.files-filter-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.files-filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.files-filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.files-filter-icon {
  font-size: 13px;
}

.files-filter-label {
  font-size: 12px;
}

/* Breadcrumbs */
.files-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 16px 8px;
  font-size: 13px;
  flex-wrap: wrap;
  flex-shrink: 0;
  min-height: 28px;
}

.files-crumb {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}

.files-crumb:hover {
  background: var(--bg-hover);
  text-decoration: underline;
}

.files-crumb-current {
  color: var(--text-primary);
  font-weight: 500;
  padding: 2px 4px;
}

.files-crumb-sep {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 1px;
}

/* Actions Bar */
.files-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.files-upload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.files-upload-btn:hover {
  background: var(--accent-hover);
}

.files-upload-btn:active {
  transform: scale(0.97);
}

/* File List */
.files-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 12px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* File Item Row */
.files-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.files-item:hover {
  background: var(--bg-hover);
}

.files-item:active {
  background: rgba(88, 101, 242, 0.15);
}

.files-item-icon {
  font-size: 28px;
  margin-right: 12px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.files-item-folder .files-item-icon {
  font-size: 30px;
}

.files-item-info {
  flex: 1;
  min-width: 0;
}

.files-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.files-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.files-item-menu {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}

.files-item:hover .files-item-menu {
  opacity: 1;
}

.files-item-menu:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Always show menu on touch devices */
@media (hover: none) {
  .files-item-menu {
    opacity: 0.6;
  }
}

/* Rename Input (inline) */
.files-rename-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  padding: 2px 6px;
  outline: none;
}

/* Empty State */
.files-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Loading State */
.files-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.files-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Storage Bar */
.files-storage-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.files-storage-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.files-storage-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.files-storage-value {
  font-size: 12px;
  color: var(--text-secondary);
}

.files-storage-track {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
}

.files-storage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  min-width: 0;
}

/* Warn when storage > 80% */
.files-storage-fill[style*="width: 8"],
.files-storage-fill[style*="width: 9"] {
  background: #faa61a;
}

/* Context Menu */
.files-context-menu {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: filesMenuFadeIn 0.12s ease-out;
}

@keyframes filesMenuFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.files-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.12s;
}

.files-ctx-item:hover {
  background: var(--bg-hover);
}

.files-ctx-danger {
  color: var(--danger);
}

.files-ctx-danger:hover {
  background: rgba(218, 55, 60, 0.15);
}

.files-ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

/* Preview Modal */
.files-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: filesModalFadeIn 0.2s ease-out;
}

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

.files-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.files-preview-content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 14px;
  width: min(90vw, 700px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.files-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.files-preview-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-preview-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.files-preview-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.files-preview-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.files-preview-img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.files-preview-text {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

/* Mobile adjustments for Files */
@media (max-width: 480px) {
  .files-filter-pill {
    padding: 5px 10px;
  }
  
  .files-item {
    padding: 9px 10px;
  }
  
  .files-item-icon {
    font-size: 24px;
    margin-right: 10px;
    width: 30px;
  }
  
  .files-preview-content {
    width: 95vw;
    max-height: 90vh;
    border-radius: 12px;
  }
}

/* =================================================================
   END FILES FEATURE
================================================================= */

/* Processing Status */
.processing-status {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  display: none;
}

.processing-status.active {
  display: block;
}

.processing-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--text-muted);
}

.processing-step.active {
  color: var(--accent);
}

.processing-step.complete {
  color: var(--success);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =================================================================
   ABOUT VIEW - Update Badge & Button
================================================================= */

.panel-list-item.static {
  cursor: default;
}

.panel-list-item.static:hover {
  background: transparent;
}

.about-update-badge {
  background: #007AFF;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  animation: pulse-badge 2s ease-in-out infinite;
}

.about-update-badge:hover {
  background: #0066DD;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.about-update-btn {
  background: #007AFF;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.about-update-btn:hover {
  background: #0066DD;
}

.about-update-btn:disabled {
  background: #666;
  cursor: not-allowed;
}
