/* =========================================================================
   FB Lister — Discord Theme v3.0
   Green + Dark Blue gradients, Discord-inspired UI
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Dark Blue-Green Background (no gray!) */
  --bg: #0a1628;
  --bg-elevated: #0f1f3a;
  --bg-card: #132240;
  --bg-card-hover: #1a2d52;
  --border: rgba(67, 181, 129, 0.2);
  --border-hover: #57f287;
  --text-primary: #e8f0f8;
  --text-secondary: #90a4c2;
  --text-muted: #5a7a9a;
  
  /* Accent: Green */
  --accent: #2dd4a0;
  --accent-hover: #57f287;
  --accent-glow: rgba(45, 212, 160, 0.12);
  
  /* Green */
  --green: #57f287;
  --green-bg: rgba(87, 242, 135, 0.08);
  
  /* Red */
  --red: #fb7185;
  --red-bg: rgba(251, 113, 133, 0.08);
  
  /* Layout */
  --sidebar-width: 240px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  
  /* Transitions */
  --transition: 0.15s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Screen Management ──────────────────────────────────────────── */
.screen { display: none; width: 100%; }
.screen.active { display: flex; }

/* ─── Scrollbar (Discord-style) ──────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; border: 2px solid transparent; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border: 2px solid var(--bg); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2b2d31; }

/* ═══════════════════════════════════════════════════════════════════
   LOGIN SCREEN — Green + Dark Blue Gradient
   ═══════════════════════════════════════════════════════════════════ */
#loginScreen {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: 
    radial-gradient(ellipse 100% 60% at 50% -20%, rgba(87, 242, 135, 0.35) 0%, rgba(45, 212, 160, 0.15) 30%, transparent 60%),
    radial-gradient(ellipse 70% 60% at 20% 80%, rgba(10, 40, 80, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(87, 242, 135, 0.12) 0%, transparent 50%),
    var(--bg);
  position: relative;
  overflow: hidden;
}

@keyframes bgPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.login-card {
  position: relative;
  background: linear-gradient(145deg, #0f1f3a, #0d1a30);
  border: 1px solid rgba(45, 212, 160, 0.2);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 1;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #57f287, #1a4a7a, transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  pointer-events: none;
}

.login-icon {
  font-size: 52px;
  margin-bottom: 16px;
  display: inline-block;
  filter: drop-shadow(0 0 20px rgba(45, 212, 160, 0.3));
  animation: discordFloat 3s ease-in-out infinite;
}

@keyframes discordFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-card h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.5;
}

.login-features {
  text-align: left;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.feature:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.feature span { font-size: 16px; flex-shrink: 0; }

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(45, 212, 160, 0.2);
}

.btn-google:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(45, 212, 160, 0.3);
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
}

.login-footer {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   DASHBOARD — Discord-style Sidebar
   ═══════════════════════════════════════════════════════════════════ */
#dashboardScreen {
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: linear-gradient(180deg, #0c1a2e 0%, #0a1628 100%);
  border-right: 1px solid rgba(45, 212, 160, 0.1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 0 rgba(45, 212, 160, 0.1);
  z-index: 1;
}

.brand-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(45, 212, 160, 0.3));
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #57f287, #2dd4a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.nav-btn.active {
  background: rgba(45, 212, 160, 0.1);
  color: #57f287;
}

.nav-btn .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 8px;
  margin: 0 8px;
  border-top: 1px solid rgba(45, 212, 160, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 4px;
  transition: background var(--transition);
  cursor: pointer;
}

.user-info:hover {
  background: rgba(255,255,255,0.04);
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-signout {
  width: 100%;
  padding: 6px 8px;
  margin-top: 4px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.btn-signout:hover {
  color: var(--red);
  background: var(--red-bg);
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-width));
  min-height: 100vh;
  background: 
    radial-gradient(ellipse 80% 50% at 80% 10%, rgba(87, 242, 135, 0.12) 0%, rgba(45, 212, 160, 0.06) 40%, transparent 60%),
    var(--bg);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: discordFadeIn 0.2s ease; }

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

.tab-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.tab-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.count-badge {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── Inventory Actions Bar ───────────────────────────────────────── */
.inventory-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.search-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  width: 220px;
  transition: all var(--transition);
}

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

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

.btn-secondary {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  color: var(--accent);
}

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

@media (max-width: 768px) {
  .inventory-actions {
    flex-direction: column;
    width: 100%;
  }
  .search-input {
    width: 100%;
  }
  .tab-header {
    flex-wrap: wrap;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   INVENTORY — Discord Cards
   ═══════════════════════════════════════════════════════════════════ */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.inventory-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}

.inventory-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.inventory-card .card-img-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  background: var(--bg);
  overflow: hidden;
}

.inventory-card .card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.inventory-card:hover .card-img-wrap img {
  transform: scale(1.03);
}

.inventory-card .card-img-wrap .img-count {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.inventory-card .card-no-img {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: var(--bg);
}

.inventory-card .card-body {
  padding: 12px;
}

.inventory-card .card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.inventory-card .card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.inventory-card .card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Listed badge */
.listed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-bg);
  color: var(--green);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════
   SOURCES
   ═══════════════════════════════════════════════════════════════════ */
.sources-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}

.source-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}

.source-card:hover {
  border-color: var(--accent);
}

.source-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.source-icon { font-size: 20px; }
.source-card h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.source-card > p { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.4; }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 12px;
  background: rgba(0,0,0,0.1);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  border-style: solid;
}

.upload-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

.upload-zone p {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

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

.upload-status {
  font-size: 13px;
  min-height: 20px;
  font-weight: 500;
}

.upload-status.success { color: var(--green); }
.upload-status.error { color: var(--red); }

/* FTP Form */
.ftp-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ftp-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition);
}

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

.ftp-form input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(45, 212, 160, 0.3);
}

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

.ftp-sources { margin-top: 12px; }

.ftp-source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 13px;
}

.ftp-source-item button {
  padding: 4px 10px;
  border: 1px solid var(--red);
  border-radius: 4px;
  background: transparent;
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.ftp-source-item button:hover {
  background: var(--red-bg);
}

/* ═══════════════════════════════════════════════════════════════════
   LISTINGS
   ═══════════════════════════════════════════════════════════════════ */
.listings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.listing-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.listing-item:hover {
  border-color: var(--accent);
}

.listing-item .listing-thumb {
  width: 48px; height: 36px;
  object-fit: cover;
  border-radius: 4px;
}

.listing-item .listing-info { flex: 1; min-width: 0; }
.listing-item .listing-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.listing-item .listing-meta { font-size: 12px; color: var(--text-secondary); }
.listing-item .listing-age { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.listing-item .btn-unlist {
  padding: 4px 10px;
  border: 1px solid var(--red);
  border-radius: 4px;
  background: transparent;
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.listing-item .btn-unlist:hover {
  background: var(--red-bg);
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════════════ */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.settings-section h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

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

.setting-row:last-child { border-bottom: none; }
.setting-value { color: var(--text-secondary); }

.desc-template {
  width: 100%;
  height: 180px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  resize: vertical;
  line-height: 1.5;
  transition: all var(--transition);
}

.desc-template:focus {
  outline: none;
  border-color: var(--accent);
}

.setting-help {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  z-index: 100;
  animation: discordToast 0.3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.toast.success {
  background: var(--green);
  color: #1e1f22;
}

.toast.error {
  background: var(--red);
}

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

/* ═══════════════════════════════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════════════════════════════ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: discordSpin 0.6s linear infinite;
  display: inline-block;
}

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

/* ═══════════════════════════════════════════════════════════════════
   LOADING OVERLAY — Full-screen progress with bar, %, status
   ═══════════════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 22, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: discordFadeIn 0.2s ease;
}

.loading-overlay.active {
  display: flex;
}

.loading-card {
  background: linear-gradient(145deg, #0f1f3a, #0d1a30);
  border: 1px solid rgba(45, 212, 160, 0.2);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 80px rgba(45, 212, 160, 0.08);
  animation: loadingCardIn 0.3s ease;
}

@keyframes loadingCardIn {
  from { transform: translateY(16px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.loading-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #57f287, #2dd4a0, transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.loading-spinner-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
}

.loading-spinner-ring {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(45, 212, 160, 0.10);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: discordSpin 0.8s linear infinite;
}

.loading-spinner-inner {
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(87, 242, 135, 0.12);
  border-bottom-color: #57f287;
  border-radius: 50%;
  animation: discordSpin 1.4s ease-in-out infinite reverse;
}

.loading-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  animation: loadingIconPulse 1.5s ease-in-out infinite;
}

@keyframes loadingIconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.loading-status-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.loading-status-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
  min-height: 18px;
}

/* Progress Bar Container */
.loading-progress-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2dd4a0, #57f287, #2dd4a0);
  background-size: 200% 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  animation: progressShimmer 2s linear infinite;
  position: relative;
}

@keyframes progressShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Percentage number */
.loading-percent {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #57f287, #2dd4a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.loading-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  opacity: 0.7;
}

/* Retained for backward compat — inline status in forms */
.loading-status {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: fadeIn 0.2s ease;
}

.loading-status .spinner {
  width: 14px; height: 14px;
  border-width: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   MODAL (Add Vehicle)
   ═══════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: discordFadeIn 0.15s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid rgba(45,212,160,0.25);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 600px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--red); }

.add-vehicle-form { display: flex; flex-direction: column; gap: 8px; }

.add-vehicle-form .form-row {
  display: flex;
  gap: 8px;
}

.add-vehicle-form .form-row-3 > .form-group { flex: 1; min-width: 0; }

.add-vehicle-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.add-vehicle-form label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.add-vehicle-form input,
.add-vehicle-form select,
.add-vehicle-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--transition);
}

.add-vehicle-form input:focus,
.add-vehicle-form select:focus,
.add-vehicle-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.add-vehicle-form .btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   STATUS BADGES — Lifecycle State Machine
   ═══════════════════════════════════════════════════════════════════ */
.status-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  z-index: 2;
  pointer-events: none;
}

.status-draft { background: rgba(180, 180, 180, 0.2); color: #999; }
.status-ready { background: rgba(45, 212, 160, 0.2); color: #57f287; }
.status-queued { background: rgba(77, 163, 255, 0.2); color: #4da3ff; }
.status-published { background: rgba(87, 242, 135, 0.25); color: #57f287; border: 1px solid rgba(87, 242, 135, 0.3); }
.status-sold { background: rgba(251, 113, 133, 0.2); color: #fb7185; }

/* ═══════════════════════════════════════════════════════════════════
   CARD ACTIONS (Edit, Refresh, Delete on inventory cards)
   ═══════════════════════════════════════════════════════════════════ */
.inventory-card .card-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.btn-card-action {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-card-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.btn-card-delete:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

/* Card checkbox for bulk select */
.card-checkbox {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  cursor: pointer;
}

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

/* Bulk actions bar */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid rgba(45, 212, 160, 0.2);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-primary);
  grid-column: 1 / -1;
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS ENHANCEMENTS — Inputs, Toggles, Danger Zone
   ═══════════════════════════════════════════════════════════════════ */
.setting-input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  width: 200px;
  transition: all var(--transition);
}

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

.setting-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.setting-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

.toggle-switch input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 20px;
  background: rgba(45, 212, 160, 0.15);
  border: 1px solid rgba(45, 212, 160, 0.3);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toggle-switch input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.toggle-switch input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input[type="checkbox"]:checked::before {
  left: 18px;
  background: #fff;
}

/* Danger Zone */
.danger-zone {
  border-color: rgba(251, 113, 133, 0.3) !important;
}

.danger-zone h3 {
  color: var(--red) !important;
}

.btn-danger {
  padding: 10px 20px;
  border: 1px solid var(--red);
  border-radius: 4px;
  background: transparent;
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover {
  background: var(--red-bg);
  box-shadow: 0 4px 12px rgba(251, 113, 133, 0.2);
}

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

.btn-sm {
  padding: 5px 12px !important;
  font-size: 12px !important;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
    min-width: 64px;
  }
  .sidebar .brand-name,
  .sidebar .nav-btn span:not(.nav-icon),
  .sidebar .user-name,
  .sidebar .btn-signout { display: none; }
  .sidebar-brand { justify-content: center; padding: 16px 0; }
  .sidebar-nav { align-items: center; padding: 8px 4px; }
  .nav-btn { justify-content: center; padding: 10px; }
  .nav-icon { margin: 0; }
  .sidebar-footer { margin: 0 4px; padding: 8px 4px; }
  .user-info { justify-content: center; }
  .main-content { margin-left: 64px; padding: 20px; }
  .sources-cards { grid-template-columns: 1fr; }
  .inventory-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════
   PREVIEW OVERLAY — Facebook Marketplace Listing Preview
   ═══════════════════════════════════════════════════════════════════ */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: discordFadeIn 0.15s ease;
}

.preview-card {
  background: #132240;
  border: 1px solid rgba(45, 212, 160, 0.2);
  border-radius: var(--radius-lg);
  max-width: 420px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition);
}

.preview-close:hover { color: var(--red); }

.preview-img {
  position: relative;
  background: var(--bg);
  min-height: 200px;
}

.preview-img img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.preview-img-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
}

.preview-stock-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.75);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
}

.preview-body { padding: 16px; }

.preview-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.preview-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.preview-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.preview-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-details {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.preview-details strong { 
  color: var(--text-primary);
  font-weight: 600;
}
