/* =================================================================
   FEATURES PANEL
================================================================= */

.features-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(600px, 100vw);
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.features-panel.active {
  right: 0;
}

.features-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-tertiary);
}

.features-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.features-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.feature-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.feature-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
}

.feature-status.active {
  background: rgba(67, 181, 129, 0.2);
  color: #43b581;
}

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

.feature-status.disabled {
  background: rgba(114, 118, 125, 0.2);
  color: #72767d;
}

.feature-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  margin-top: 1rem;
  transition: all 0.2s;
}

.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: 2rem;
  margin-bottom: 0.5rem;
}

.upload-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-formats {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.processing-status {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  display: none;
}

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

.processing-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.processing-step.complete {
  color: #43b581;
}

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

.spinner {
  width: 16px;
  height: 16px;
  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); }
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
}

.setting-info p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* =================================================================
   BUTTONS
================================================================= */

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

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

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

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.files-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

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

.files-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.files-search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  opacity: 0.5;
  pointer-events: none;
}

.files-search-input {
  width: 100%;
  padding: 10px 36px 10px 36px;
  border: none;
  border-radius: 12px;
  background: var(--bg-tertiary, rgba(255,255,255,0.06));
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: background 0.2s;
}

.files-search-input:focus {
  background: var(--bg-hover, rgba(255,255,255,0.1));
}

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

.files-search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 50%;
}

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

/* Filter Pills */
.files-filter-bar {
  display: flex;
  gap: 6px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

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

.files-filter-pill:hover {
  background: var(--bg-hover, rgba(255,255,255,0.1));
}

.files-filter-pill.active {
  background: var(--accent, #5865F2);
  color: white;
}

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

.files-filter-label {
  font-weight: 500;
}

/* Breadcrumbs */
.files-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 16px 8px;
  font-size: 13px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.files-breadcrumbs::-webkit-scrollbar { display: none; }

.files-crumb {
  background: none;
  border: none;
  color: var(--accent, #5865F2);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
}

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

.files-crumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

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

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

.files-sync-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  border-radius: 10px;
  background: var(--bg-tertiary, rgba(255,255,255,0.04));
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.files-sync-btn:hover:not(:disabled) {
  background: var(--bg-hover, rgba(255,255,255,0.08));
  color: var(--text-primary);
  border-color: var(--accent, #5865F2);
}

.files-sync-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.files-sync-icon {
  display: inline-block;
  font-size: 14px;
}

.files-sync-icon.spinning {
  animation: spinSync 1s linear infinite;
}

@keyframes spinSync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.files-upload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px dashed var(--border, rgba(255,255,255,0.15));
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  justify-content: center;
}

.files-upload-btn:hover {
  border-color: var(--accent, #5865F2);
  color: var(--accent, #5865F2);
  background: rgba(88, 101, 242, 0.05);
}

/* File List */
.files-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.files-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  position: relative;
  animation: filesItemIn 0.2s ease both;
}

@keyframes filesItemIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.files-item:nth-child(1) { animation-delay: 0s; }
.files-item:nth-child(2) { animation-delay: 0.02s; }
.files-item:nth-child(3) { animation-delay: 0.04s; }
.files-item:nth-child(4) { animation-delay: 0.06s; }
.files-item:nth-child(5) { animation-delay: 0.08s; }
.files-item:nth-child(6) { animation-delay: 0.1s; }
.files-item:nth-child(7) { animation-delay: 0.12s; }
.files-item:nth-child(8) { animation-delay: 0.14s; }
.files-item:nth-child(9) { animation-delay: 0.16s; }
.files-item:nth-child(10) { animation-delay: 0.18s; }

.files-item:hover {
  background: var(--bg-hover, rgba(255,255,255,0.06));
}

.files-item:active {
  background: var(--bg-tertiary, rgba(255,255,255,0.1));
}

.files-item-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary, rgba(255,255,255,0.04));
  border-radius: 10px;
}

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

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

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

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

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

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

/* Empty State */
.files-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: 15px;
}

/* Loading */
.files-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 200px;
  color: var(--text-muted);
  font-size: 14px;
}

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

@keyframes filesSpin {
  to { transform: rotate(360deg); }
}

/* Storage Bar */
.files-storage-bar {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  flex-shrink: 0;
}

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

.files-storage-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.files-storage-track {
  height: 4px;
  background: var(--bg-tertiary, rgba(255,255,255,0.06));
  border-radius: 2px;
  overflow: hidden;
}

.files-storage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #5865F2), #7289DA);
  border-radius: 2px;
  transition: width 0.3s ease;
  min-width: 2px;
}

/* Context Menu */
.files-context-menu {
  background: var(--bg-secondary, #2f3136);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: filesMenuIn 0.15s ease;
}

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

.files-ctx-item {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.1s;
}

.files-ctx-item:hover {
  background: var(--bg-hover, rgba(255,255,255,0.06));
}

.files-ctx-danger {
  color: #ED4245;
}

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

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

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

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

.files-preview-content {
  position: relative;
  background: var(--bg-primary, #1e1f22);
  border-radius: 16px;
  border: 1px solid var(--border);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
}

.files-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.files-preview-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

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

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

.files-preview-body {
  overflow: auto;
  padding: 16px;
  max-height: 80vh;
}

.files-preview-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
}

/* Inline Rename */
.files-rename-input {
  width: 100%;
  padding: 2px 6px;
  border: 2px solid var(--accent, #5865F2);
  border-radius: 6px;
  background: var(--bg-primary, #1e1f22);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  font-family: inherit;
}

.files-preview-text {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  margin: 0;
}

/* =================================================================
   iOS-STYLE LIST ITEMS (Status + Chevron)
================================================================= */

.panel-list-item-action {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-list-item-status {
  font-size: 15px;
  color: var(--text-muted, #72767d);
}

.panel-list-item-status.status-on {
  color: var(--text-secondary, #b5bac1);
}

.panel-list-item-chevron {
  font-size: 20px;
  color: var(--text-muted, #72767d);
  font-weight: 300;
  line-height: 1;
}

/* Back button in panel header */
.panel-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted, #72767d);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  margin-right: 8px;
}

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

.panel-back-btn .back-chevron {
  font-size: 20px;
  font-weight: 300;
}

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

/* Import Upload Area */
.import-upload-area {
  border: 2px dashed var(--border, #3f4147);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  transition: all 0.2s;
  color: var(--text-secondary);
}

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