/* ============================================
   Kitchen Pantry - Premium Glassmorphic Design
   Version 2.0 - October 15, 2025
   "Where functionality meets art"
   ============================================ */

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

/* ============================================
   RESET & BASE
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;
  
  /* Spacing (8px base) */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Backdrop Blur */
  --blur-sm: 8px;
  --blur-md: 16px;
  --blur-lg: 24px;
  --blur-xl: 40px;
}

/* ============================================
   LIGHT THEME (Default)
   ============================================ */
:root,
[data-theme="light"] {
  --bg-app: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  
  --accent-primary: #667eea;
  --accent-primary-hover: #5a67d8;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-info: #3b82f6;
  
  --border-color: rgba(100, 116, 139, 0.12);
  --divider: rgba(15, 23, 42, 0.08);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  --overlay: rgba(15, 23, 42, 0.5);
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
  --bg-app: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(148, 163, 184, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-inverse: #0f172a;
  
  --accent-primary: #818cf8;
  --accent-primary-hover: #6366f1;
  --accent-success: #34d399;
  --accent-warning: #fbbf24;
  --accent-danger: #f87171;
  --accent-info: #60a5fa;
  
  --border-color: rgba(148, 163, 184, 0.12);
  --divider: rgba(248, 250, 252, 0.08);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  
  --overlay: rgba(0, 0, 0, 0.7);
}

/* ============================================
   AMBER THEME (No Blue Light)
   ============================================ */
[data-theme="amber"] {
  --bg-app: linear-gradient(135deg, #92400e 0%, #78350f 100%);
  --bg-primary: #fef3c7;
  --bg-secondary: #fef9e7;
  --bg-tertiary: #fde68a;
  
  --glass-bg: rgba(254, 243, 199, 0.7);
  --glass-border: rgba(245, 158, 11, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(146, 64, 14, 0.25);
  
  --text-primary: #78350f;
  --text-secondary: #92400e;
  --text-tertiary: #b45309;
  --text-inverse: #fef3c7;
  
  --accent-primary: #d97706;
  --accent-primary-hover: #b45309;
  --accent-success: #84cc16;
  --accent-warning: #facc15;
  --accent-danger: #dc2626;
  --accent-info: #06b6d4;
  
  --border-color: rgba(146, 64, 14, 0.12);
  --divider: rgba(120, 53, 15, 0.12);
  
  --shadow-sm: 0 1px 2px 0 rgba(120, 53, 15, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(120, 53, 15, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(120, 53, 15, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(120, 53, 15, 0.4);
  --shadow-2xl: 0 25px 50px -12px rgba(120, 53, 15, 0.5);
  
  --overlay: rgba(120, 53, 15, 0.6);
}

/* ============================================
   GHOST THEME (Grayscale)
   ============================================ */
[data-theme="ghost"] {
  --bg-app: linear-gradient(135deg, #18181b 0%, #27272a 100%);
  --bg-primary: #27272a;
  --bg-secondary: #000000;
  --bg-tertiary: #3f3f46;
  
  --glass-bg: rgba(39, 39, 42, 0.8);
  --glass-border: rgba(161, 161, 170, 0.15);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7);
  
  --text-primary: #ffffff;
  --text-secondary: #d4d4d8;
  --text-tertiary: #a1a1aa;
  --text-inverse: #18181b;
  
  --accent-primary: #71717a;
  --accent-primary-hover: #52525b;
  --accent-success: #a1a1aa;
  --accent-warning: #d4d4d8;
  --accent-danger: #e4e4e7;
  --accent-info: #a1a1aa;
  
  --border-color: rgba(161, 161, 170, 0.25);
  --divider: rgba(255, 255, 255, 0.1);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.8);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  
  --overlay: rgba(0, 0, 0, 0.85);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
body {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-normal);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-app) !important;
  background-attachment: fixed !important;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-slow), color var(--transition-base);
}

/* Remove any inline background styles */
body[style] {
  background: var(--bg-app) !important;
}

/* ============================================
   GLASSMORPHIC CARDS
   ============================================ */
.card,
.modal-content {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
}

.card-body {
  padding: var(--space-xl);
}

/* ============================================
   BEAUTIFUL TABS
   ============================================ */
.nav-tabs {
  border: none !important;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  padding: var(--space-sm);
  border-radius: var(--radius-lg);
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tabs .nav-item {
  flex-shrink: 0;
}

.nav-tabs .nav-link {
  border: none !important;
  background: transparent;
  color: var(--text-secondary) !important;
  font-weight: var(--font-weight-medium);
  font-size: 0.9rem;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  transition: var(--transition-base);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px; /* Touch target */
}

.nav-tabs .nav-link i {
  font-size: 1.1rem;
}

.nav-tabs .nav-link:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--accent-primary) !important;
}

.nav-tabs .nav-link.active {
  background: var(--accent-primary) !important;
  color: var(--text-inverse) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  font-weight: var(--font-weight-medium);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  border: none;
  transition: var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--accent-primary) !important;
  color: var(--text-inverse) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  background: var(--accent-primary-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
  background: var(--bg-tertiary) !important;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--accent-danger) !important;
  color: var(--text-inverse) !important;
}

.btn-success {
  background: var(--accent-success) !important;
  color: var(--text-inverse) !important;
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
  min-height: 36px;
}

/* ============================================
   FORMS & INPUTS
   ============================================ */
.form-control,
.form-select {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  transition: var(--transition-base);
  min-height: 44px;
  font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
  background: var(--bg-secondary) !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
  outline: none;
}

/* Ghost theme input field text override for better readability */
[data-theme="ghost"] .form-control,
[data-theme="ghost"] .form-select,
[data-theme="ghost"] input,
[data-theme="ghost"] textarea {
  color: #ffffff !important;
}

[data-theme="ghost"] .form-control::placeholder,
[data-theme="ghost"] input::placeholder,
[data-theme="ghost"] textarea::placeholder {
  color: #a1a1aa !important;
}

.form-label {
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  font-size: 0.875rem;
  margin-bottom: var(--space-sm);
}

/* ============================================
   TABLES
   ============================================ */
.table {
  color: var(--text-primary);
  margin-bottom: 0;
}

.table thead th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: var(--font-weight-semibold);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  padding: var(--space-md) var(--space-lg);
}

.table tbody tr {
  border-bottom: 1px solid var(--divider);
  transition: var(--transition-fast);
}

.table tbody tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

.table tbody td {
  padding: var(--space-md) var(--space-lg);
  vertical-align: middle;
}

/* Ghost theme table text override */
[data-theme="ghost"] .table thead th {
  color: #f5f5f5;
}

[data-theme="ghost"] .table tbody td {
  color: #ffffff;
}

[data-theme="ghost"] .table tbody td input {
  color: #ffffff !important;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  font-size: 0.75rem;
  letter-spacing: 0.025em;
}

.bg-primary { background: var(--accent-primary) !important; }
.bg-secondary { background: var(--text-secondary) !important; }
.bg-success { background: var(--accent-success) !important; }
.bg-warning { background: var(--accent-warning) !important; color: var(--text-primary) !important; }
.bg-danger { background: var(--accent-danger) !important; }
.bg-info { background: var(--accent-info) !important; }

/* ============================================
   MODALS
   ============================================ */
.modal-backdrop {
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  background: var(--overlay) !important;
}

.modal-header {
  border-bottom: 1px solid var(--divider);
  padding: var(--space-lg) var(--space-xl);
}

.modal-title {
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  font-size: 1.5rem;
}

.modal-body {
  padding: var(--space-xl);
}

.modal-footer {
  border-top: 1px solid var(--divider);
  padding: var(--space-lg) var(--space-xl);
  gap: var(--space-sm);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  border-radius: var(--radius-md);
  border: none;
  padding: var(--space-md) var(--space-lg);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
}

.alert-info {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--accent-info);
  border-left: 4px solid var(--accent-info);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1) !important;
  color: var(--accent-success);
  border-left: 4px solid var(--accent-success);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1) !important;
  color: var(--accent-warning);
  border-left: 4px solid var(--accent-warning);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1) !important;
  color: var(--accent-danger);
  border-left: 4px solid var(--accent-danger);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-tertiary) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }
  
  .card-body {
    padding: var(--space-lg);
  }
  
  .modal-dialog {
    margin: var(--space-md);
  }
  
  .btn {
    min-height: 48px; /* Larger touch targets on mobile */
  }
  
  .nav-tabs {
    padding: var(--space-xs);
  }
  
  .nav-tabs .nav-link {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

.slide-in {
  animation: slideIn var(--transition-base) ease-out;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ============================================
   PREMIUM EFFECTS
   ============================================ */
.glass-effect {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.hover-lift {
  transition: var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* ============================================
   TEXT GRADIENTS
   ============================================ */
.text-gradient {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: var(--font-weight-bold);
}
