/* ═══════════════════════════════════════════════════
   NegocioMap — Premium Dark Theme with Glassmorphism
   ═══════════════════════════════════════════════════ */

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

/* ──── CSS Variables (Dark — Default) ──── */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111127;
  --bg-card: rgba(25, 25, 55, 0.6);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f0f0ff;
  --text-secondary: #a0a0c0;
  --text-muted: #6b6b8a;
  
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.3);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.3);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.3);
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-yellow: #eab308;
  --accent-pink: #ec4899;
  
  --gradient-main: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  --gradient-hot: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --gradient-gold: linear-gradient(135deg, #eab308 0%, #f97316 100%);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(139, 92, 246, 0.4);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-purple: 0 0 30px rgba(139, 92, 246, 0.2);
  --shadow-glow-cyan: 0 0 30px rgba(6, 182, 212, 0.2);
  
  --navbar-bg: rgba(10, 10, 26, 0.85);
  --sidebar-bg: rgba(17, 17, 39, 0.9);
  --modal-overlay: rgba(0, 0, 0, 0.7);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ──── CSS Variables (Light Theme) ──── */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(0, 0, 0, 0.03);
  --bg-glass-hover: rgba(0, 0, 0, 0.06);
  
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8888a8;
  
  --accent-purple: #7c3aed;
  --accent-purple-glow: rgba(124, 58, 237, 0.15);
  --accent-cyan: #0891b2;
  --accent-cyan-glow: rgba(8, 145, 178, 0.15);
  --accent-green: #059669;
  --accent-green-glow: rgba(5, 150, 105, 0.15);
  
  --border-color: rgba(0, 0, 0, 0.1);
  --border-active: rgba(124, 58, 237, 0.35);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow-purple: 0 0 30px rgba(124, 58, 237, 0.1);
  --shadow-glow-cyan: 0 0 30px rgba(8, 145, 178, 0.1);
  
  --navbar-bg: rgba(255, 255, 255, 0.9);
  --sidebar-bg: rgba(255, 255, 255, 0.95);
  --modal-overlay: rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background 0.4s ease, color 0.4s ease;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] body::before {
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(8, 145, 178, 0.03) 0%, transparent 50%);
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-purple); }

/* ──── Scrollbar ──── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-purple); border-radius: 3px; }

/* ──── Navigation ──── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-brand .logo-icon {
  font-size: 1.5rem;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ──── Buttons ──── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-main);
  color: white;
  box-shadow: var(--shadow-glow-purple);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-active);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
}
.btn-success:hover { transform: translateY(-2px); }

.btn-danger {
  background: var(--accent-red);
  color: white;
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: var(--radius-sm); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass); }

/* ──── Cards ──── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow-purple);
}

.card-glow {
  position: relative;
  overflow: hidden;
}

.card-glow::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

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

/* ──── Forms ──── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

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

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

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0c0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ──── Badge ──── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-discount {
  background: var(--gradient-hot);
  color: white;
  font-size: 0.85rem;
  padding: 4px 12px;
  animation: pulse-badge 2s ease-in-out infinite;
}

.badge-free {
  background: var(--gradient-success);
  color: white;
  font-size: 0.85rem;
  padding: 4px 12px;
  animation: pulse-badge 2s ease-in-out infinite;
}

.badge-exhausted {
  background: rgba(107, 107, 138, 0.3);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 4px 12px;
}

.badge-stock {
  background: rgba(139, 92, 246, 0.2);
  color: var(--accent-purple);
}

.badge-category {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

/* ──── Stat Cards ──── */
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.income::before { background: var(--gradient-success); }
.stat-card.expense::before { background: var(--gradient-hot); }
.stat-card.balance::before { background: var(--gradient-main); }
.stat-card.sales::before { background: var(--gradient-gold); }

.stat-card .stat-icon {
  font-size: 1.5rem;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ──── Offer Cards (User View) ──── */
.offers-section {
  padding: 16px;
}

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

.offers-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.offer-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.offer-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}

.offer-card-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

.offer-card-image-placeholder {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(139, 92, 246, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-bottom: 1px solid var(--border-color);
}

.offer-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.offer-card-body {
  padding: 16px;
}

.offer-card-business {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.offer-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.offer-card-product {
  font-size: 0.9rem;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.offer-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.offer-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--accent-orange);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.offer-timer.expired {
  color: var(--text-muted);
}

.offer-stock {
  font-size: 0.8rem;
  font-weight: 600;
}

.offer-stock.available { color: var(--accent-green); }
.offer-stock.low { color: var(--accent-orange); }
.offer-stock.exhausted { color: var(--text-muted); }

/* ──── Map Container ──── */
.map-container {
  width: 100%;
  height: 50vh;
  min-height: 300px;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 500;
  display: flex;
  gap: 8px;
}

/* ──── Dashboard Layout ──── */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 60px;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  padding: 20px 0;
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-nav {
  list-style: none;
  padding: 0 12px;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.sidebar-nav a:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border-left: 3px solid var(--accent-purple);
}

.sidebar-nav .nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.dashboard-main {
  flex: 1;
  margin-left: 240px;
  padding: 24px;
  min-height: calc(100vh - 60px);
}

.dashboard-header {
  margin-bottom: 24px;
}

.dashboard-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.dashboard-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ──── Stats Grid ──── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ──── Tables ──── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: rgba(139, 92, 246, 0.1);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

tr:hover td {
  background: var(--bg-glass);
}

tr:last-child td {
  border-bottom: none;
}

/* ──── Modal ──── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-base);
}

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

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

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

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

/* ──── Login Page ──── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: var(--gradient-main);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.3;
  pointer-events: none;
}

.login-logo {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 8px;
}

.login-title {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

.login-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  padding: 4px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.login-tab.active {
  background: var(--accent-purple);
  color: white;
}

.role-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.role-option {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: var(--bg-glass);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.role-option:hover { border-color: var(--accent-purple); }

.role-option.selected {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
}

.role-option .role-icon {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

/* ──── Toast Notifications ──── */
.toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3s forwards;
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-cyan); }

/* ──── Product Grid ──── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.product-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.product-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.product-card-img-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--bg-secondary), rgba(139, 92, 246, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.product-card-body {
  padding: 16px;
}

.product-card-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
}

.product-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-green);
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

/* ──── Tabs ──── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0;
}

.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent-purple);
  border-bottom-color: var(--accent-purple);
}

/* ──── Section Panels ──── */
.section-panel {
  display: none;
}
.section-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ──── AI Suggestion Cards ──── */
.ai-suggestion {
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed var(--accent-purple);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ai-suggestion:hover {
  background: rgba(139, 92, 246, 0.15);
  border-style: solid;
}

.ai-suggestion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 600;
}

.ai-suggestion-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ──── Challenge Detail (popup) ──── */
.challenge-detail {
  text-align: center;
}

.challenge-detail .challenge-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}

.challenge-detail .challenge-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.challenge-detail .challenge-business {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.challenge-detail .challenge-text {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.6;
}

.challenge-detail .challenge-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
}

.challenge-detail .meta-item {
  text-align: center;
}

.challenge-detail .meta-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.challenge-detail .meta-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ──── Distance display ──── */
.distance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ──── Empty State ──── */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ──── File Upload ──── */
.file-upload {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.file-upload:hover {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.05);
}

.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload .upload-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

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

.file-upload-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-md);
  margin-top: 12px;
}

/* ──── Chart Container ──── */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.chart-container canvas {
  max-height: 300px;
}

/* ──── Leaflet Customization ──── */
.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
}

.leaflet-popup-content {
  margin: 12px 16px !important;
  font-family: 'Inter', sans-serif !important;
}

.popup-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}

.popup-category {
  color: var(--accent-cyan);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.popup-address {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.popup-btn {
  display: inline-block;
  padding: 6px 14px;
  background: var(--gradient-main);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

/* ──── Animations ──── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

.animate-fadeIn { animation: fadeIn 0.5s ease; }
.animate-slideUp { animation: slideUp 0.5s ease; }

/* ──── Loading Spinner ──── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

/* ──── Responsive ──── */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  
  .sidebar.mobile-open {
    display: block;
    width: 100%;
    z-index: 999;
  }
  
  .dashboard-main {
    margin-left: 0;
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .offers-grid {
    grid-template-columns: 1fr;
  }
  
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .navbar-brand span {
    display: none;
  }
  
  .map-container {
    height: 45vh;
  }

  .login-card {
    padding: 28px;
  }
  
  .modal {
    padding: 24px;
    width: 95%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .challenge-detail .challenge-meta {
    flex-direction: column;
    gap: 12px;
  }
}

/* ──── Utility ──── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ──── Theme Toggle Button ──── */
.theme-toggle {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all var(--transition-base);
  padding: 0;
  color: var(--text-primary);
}

.theme-toggle:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-active);
  transform: rotate(30deg) scale(1.1);
}

/* ──── Light Theme Specific Overrides ──── */
[data-theme="light"] .login-title {
  -webkit-text-fill-color: initial;
  background: none;
  color: var(--accent-purple);
}

[data-theme="light"] .navbar-brand {
  -webkit-text-fill-color: initial;
  background: none;
  color: var(--accent-purple);
}

[data-theme="light"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%234a4a6a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
}

[data-theme="light"] .form-select option {
  background: #ffffff;
  color: #1a1a2e;
}

[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: #1a1a2e !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
}

[data-theme="light"] .leaflet-popup-tip {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
}

[data-theme="light"] .badge-exhausted {
  background: rgba(136, 136, 168, 0.15);
}

[data-theme="light"] .badge-stock {
  background: rgba(124, 58, 237, 0.1);
}

[data-theme="light"] .badge-category {
  background: rgba(8, 145, 178, 0.1);
}

[data-theme="light"] th {
  background: rgba(124, 58, 237, 0.06);
}

[data-theme="light"] .sidebar-nav a.active {
  background: rgba(124, 58, 237, 0.08);
}

[data-theme="light"] .offer-card-image-placeholder {
  background: linear-gradient(135deg, #f0f2f5 0%, rgba(124, 58, 237, 0.06) 100%);
}

[data-theme="light"] .product-card-img-placeholder {
  background: linear-gradient(135deg, #f0f2f5, rgba(124, 58, 237, 0.06));
}

[data-theme="light"] .ai-suggestion {
  background: rgba(124, 58, 237, 0.04);
  border-color: var(--accent-purple);
}

[data-theme="light"] .ai-suggestion:hover {
  background: rgba(124, 58, 237, 0.08);
}


/* ── Botón "Continuar con Facebook" (login) ── */
.btn-facebook {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 300px; max-width: 100%; margin: 10px auto 0;
  padding: 11px 16px; border: none; border-radius: 4px;
  background: #1877F2; color: #fff; font-family: inherit;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease;
}
.btn-facebook:hover { background: #166fe5; }
.btn-facebook.hidden { display: none; }
