/* ==========================================================================
   ruTorrent Modern Dark Web Client - Design System
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-base: #0a0d14;
  --bg-surface: #111726;
  --bg-surface-elevated: #182238;
  --bg-card: rgba(20, 29, 48, 0.7);
  --bg-card-hover: rgba(28, 41, 67, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(6, 182, 212, 0.5);

  /* Primary & Accents */
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.25);
  --accent-purple: #8b5cf6;
  --gradient-primary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-card: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);

  /* Status Colors */
  --status-downloading: #06b6d4;
  --status-seeding: #10b981;
  --status-completed: #3b82f6;
  --status-paused: #f59e0b;
  --status-stopped: #64748b;
  --status-error: #f43f5e;
  --status-checking: #a855f7;

  /* Typography */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-family);

  /* Shadows & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-cyan-glow);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(at 10% 15%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 85%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* App Layout Grid */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   Header Navbar
   ========================================================================== */
.app-header {
  height: 72px;
  background: rgba(17, 23, 38, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
}

.brand-icon-wrapper {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--accent-cyan-glow);
}

.brand-icon-wrapper svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-demo {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-paused);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Global Speeds Banner in Header */
.global-stats-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.speed-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.speed-meter.download {
  color: var(--accent-cyan);
}

.speed-meter.upload {
  color: var(--status-seeding);
}

.speed-icon {
  width: 18px;
  height: 18px;
  animation: bounce-subtle 2s infinite ease-in-out;
}

@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  outline: none;
  text-decoration: none;
  user-select: none;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-cyan-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  padding: 9px;
  border-radius: var(--radius-md);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--status-error);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: var(--status-error);
  color: #fff;
}

.btn-admin-auth {
  gap: 6px;
  font-size: 0.8rem;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-admin-auth.logged-in {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
}

.btn-admin-auth.logged-in:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--status-error);
}

/* ==========================================================================
   Main Content Layout (Sidebar + Grid)
   ========================================================================== */
.app-main {
  display: flex;
  flex: 1;
  position: relative;
}

/* Sidebar */
.app-sidebar {
  width: 260px;
  background: rgba(17, 23, 38, 0.6);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-filters {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
  font-size: 0.875rem;
}

.nav-filter-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-filter-item.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  font-weight: 600;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.nav-filter-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-filter-left svg {
  width: 18px;
  height: 18px;
}

.nav-badge {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.nav-filter-item.active .nav-badge {
  background: var(--accent-cyan);
  color: #0a0d14;
  font-weight: 700;
}

/* Sidebar Storage Card */
.sidebar-storage-card {
  margin-top: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.storage-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.storage-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.storage-progress-bar {
  height: 100%;
  width: 65%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

.storage-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

/* ==========================================================================
   Content Area
   ========================================================================== */
.content-area {
  flex: 1;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Controls Bar (Search, View Mode, Bulk Action) */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 480px;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-dim);
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 42px;
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-custom {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  padding: 9px 14px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.select-custom:focus {
  border-color: var(--border-focus);
}

.view-mode-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.view-mode-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--accent-cyan);
}

/* Bulk Actions Bar (Shown when items selected) */
.bulk-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  animation: slideDown 0.2s ease-out;
}

.bulk-bar.visible {
  display: flex;
}

.bulk-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.bulk-buttons {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   Torrent Cards Grid View
   ========================================================================== */
.torrents-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.torrent-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.torrent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.torrent-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.torrent-card:hover::before {
  opacity: 1;
}

.torrent-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

/* Card Header */
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-title-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.torrent-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.torrent-title-wrapper {
  flex: 1;
  min-width: 0;
}

.torrent-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.torrent-meta-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: capitalize;
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-pill.downloading {
  background: rgba(6, 182, 212, 0.15);
  color: var(--status-downloading);
}
.status-pill.downloading::before {
  background: var(--status-downloading);
  box-shadow: 0 0 8px var(--status-downloading);
}

.status-pill.seeding {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-seeding);
}
.status-pill.seeding::before {
  background: var(--status-seeding);
  box-shadow: 0 0 8px var(--status-seeding);
}

.status-pill.completed {
  background: rgba(59, 130, 246, 0.15);
  color: var(--status-completed);
}
.status-pill.completed::before {
  background: var(--status-completed);
}

.status-pill.paused {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-paused);
}
.status-pill.paused::before {
  background: var(--status-paused);
}

.status-pill.stopped {
  background: rgba(100, 116, 139, 0.15);
  color: var(--status-stopped);
}
.status-pill.stopped::before {
  background: var(--status-stopped);
}

.status-pill.error {
  background: rgba(244, 63, 94, 0.15);
  color: var(--status-error);
}
.status-pill.error::before {
  background: var(--status-error);
  box-shadow: 0 0 8px var(--status-error);
}

.status-pill.checking {
  background: rgba(168, 85, 247, 0.15);
  color: var(--status-checking);
}
.status-pill.checking::before {
  background: var(--status-checking);
}

.category-tag {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.autodelete-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--status-paused);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.autodelete-pill svg {
  width: 12px;
  height: 12px;
  animation: pulse-slow 2s infinite ease-in-out;
}

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

.server-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.server-config-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition-fast);
}

.server-config-card:hover {
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

/* Card Actions (Toolbar) */
.card-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-icon-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-icon-btn svg {
  width: 16px;
  height: 16px;
}

.action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.action-icon-btn.btn-delete:hover {
  background: rgba(244, 63, 94, 0.2);
  color: var(--status-error);
  border-color: rgba(244, 63, 94, 0.4);
}

.action-icon-btn.btn-stop:hover {
  background: rgba(245, 158, 11, 0.2);
  color: var(--status-paused);
  border-color: rgba(245, 158, 11, 0.4);
}

.action-icon-btn.btn-start:hover {
  background: rgba(16, 185, 129, 0.2);
  color: var(--status-seeding);
  border-color: rgba(16, 185, 129, 0.4);
}

.action-icon-btn.btn-pause:hover {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.4);
}

/* Progress Section */
.card-progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  position: relative;
}

.progress-fill.seeding {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.progress-fill.paused {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.progress-fill.error {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

.card-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  padding-top: 4px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-val.speed-down {
  color: var(--accent-cyan);
}

.stat-val.speed-up {
  color: var(--status-seeding);
}

/* ==========================================================================
   Table View
   ========================================================================== */
.torrents-table-container {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.torrents-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.torrents-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.torrents-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

.torrents-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.torrents-table tr.selected td {
  background: rgba(6, 182, 212, 0.05);
}

.table-progress-bar {
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--text-dim);
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
  margin-bottom: 20px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-normal);
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin: -10px -24px 10px;
  padding: 0 24px;
  gap: 16px;
}

.modal-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-tab-btn.active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  font-weight: 600;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--border-focus);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Drag and Drop Zone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: all var(--transition-fast);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

.dropzone-icon {
  width: 42px;
  height: 42px;
  color: var(--accent-cyan);
  margin-bottom: 12px;
}

.dropzone-text {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Checkbox Row */
.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-check input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 450px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.875rem;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
}
.toast.success svg {
  color: var(--status-seeding);
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.4);
}
.toast.error svg {
  color: var(--status-error);
}

.toast.info {
  border-color: rgba(6, 182, 212, 0.4);
}
.toast.info svg {
  color: var(--accent-cyan);
}

/* Animations */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .app-sidebar {
    width: 220px;
  }
  .content-area {
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 0 16px;
  }
  .global-stats-header {
    display: none;
  }
  .app-main {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px;
  }
  .nav-filters {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .nav-filter-item {
    white-space: nowrap;
  }
  .sidebar-storage-card {
    display: none;
  }
}
