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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --sidebar-width: 260px;
  --topbar-height: 64px;
  
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  color: var(--text);
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  flex: 1;
  padding: 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.nav-link:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Improved Icon Sizing */
.nav-link i,
.nav-link [data-icon],
.btn i,
.btn [data-icon],
.metric-card__delta i,
.metric-card__delta [data-icon],
.stat-chip i,
.stat-chip [data-icon],
.list-row__meta i,
.list-row__meta [data-icon],
.page-header__meta i,
.page-header__meta [data-icon],
.empty-state i,
.empty-state [data-icon],
.list-card__meta i,
.list-card__meta [data-icon],
.field i,
.field [data-icon] {
  width: 1.15rem;
  height: 1.15rem;
  aspect-ratio: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-link i,
.nav-link [data-icon] {
  width: 1.35rem;
  height: 1.35rem;
}

/* Global SVG fixes for Lucide icons */
svg[data-icon] {
  stroke-width: 2.2px;
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

.logo__mark [data-icon],
.icon-chip [data-icon],
.logo__mark svg,
.icon-chip svg {
  width: 1.45rem;
  height: 1.45rem;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
}

.top-bar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-container {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Components */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

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

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

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

.btn-secondary:hover {
  background: var(--surface-muted);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger-light);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.field label, .field span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.field input, .field input[type="text"], .field input[type="number"], .field input[type="password"], .field select, .field textarea {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: all 0.2s;
  width: 100%;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Modal Confirmation Utilities */
.modal-confirm-card {
  max-width: 440px !important;
}

.modal-confirm-header {
  padding: 1.5rem 1.5rem 0.5rem;
  text-align: center;
}

.modal-confirm-body {
  padding: 0.5rem 1.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.modal-confirm-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.modal-confirm-footer .btn {
  flex: 1;
}


/* Login Page Specifics */
.login-shell {
  min-height: 100vh;
  display: flex;
  background: #0f172a;
}

.login-layout {
  display: grid;
  grid-template-columns: 1fr 480px;
  width: 100%;
}

.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem;
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
              radial-gradient(circle at bottom left, rgba(79, 70, 229, 0.1), transparent 40%);
}

.login-card {
  background: var(--surface);
  padding: 4rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.2);
  z-index: 10;
  margin-bottom: 0;
  border-radius: 0;
  border: none;
}

.login-header {
  margin-bottom: 2.5rem;
}

.login-header h1 {
  font-size: 1.875rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Kitchen Animation */
.kitchen-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  max-width: 600px;
}

.kitchen-svg {
  width: 100%;
  height: auto;
  color: rgba(255, 255, 255, 0.9);
}

.steam {
  animation: steam-rise 3s infinite ease-out;
  opacity: 0;
}
.steam-1 { animation-delay: 0s; }
.steam-2 { animation-delay: 1s; }
.steam-3 { animation-delay: 2s; }

@keyframes steam-rise {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 0.6; }
  80% { opacity: 0; }
  100% { transform: translateY(-30px); opacity: 0; }
}

.utensil {
  transform-origin: top center;
  animation: swing 4s infinite ease-in-out;
}
.utensil-1 { animation-delay: 0.2s; }
.utensil-2 { animation-delay: 0.8s; }
.utensil-3 { animation-delay: 0.5s; }

@keyframes swing {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.chef-hat {
  animation: float 5s infinite ease-in-out;
}

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

.kitchen-label {
  margin-top: 3rem;
  text-align: center;
}

.kitchen-label h3 {
  font-size: 1.75rem;
  color: #fff;
  margin-bottom: 0.75rem;
}

.kitchen-label p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.7);
  max-width: 320px;
}

/* Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-neutral {
  background: var(--surface-muted);
  color: var(--text-muted);
}
[hidden] { display: none !important; }

/* Responsive Utilities */
.mobile-only {
  display: none !important;
}

/* Missing Dashboard/Form Layouts */
.dashboard-main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Modifier Builder Styles */
.modifier-group {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.modifier-group__header {
  margin-bottom: 1rem;
}

.modifier-value-row {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 0.75rem;
  background: var(--surface);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.modifier-value-row .field {
  margin-bottom: 0;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  margin: -1rem;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.items-table th {
  text-align: left;
  padding: 1rem;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.items-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.items-table tr:hover {
  background: var(--bg);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.is-visible {
  display: flex;
}

.modal .card {
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  margin-bottom: 0;
}

/* Metric Cards (Dashboard) */
.metric-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metric-card__label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-card__value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text);
}

.metric-card__delta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }

/* Badges */
.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

/* List View (Categories) */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
  border-radius: var(--radius-md);
}

.list-item:hover {
  background: var(--surface-muted);
}

.list-item:last-child {
  border-bottom: none;
}

@media (max-width: 1024px) {
  .mobile-only {
    display: inline-flex !important;
  }
  
  .desktop-only {
    display: none !important;
  }

  .sidebar {
    transform: translateX(-100%);
    display: none;
    z-index: 100;
  }

  .sidebar.open {
    transform: translateX(0);
    display: flex;
    box-shadow: var(--shadow-lg);
  }

  .main-content {
    margin-left: 0;
  }

  .top-bar {
    padding: 0 0.75rem;
    position: relative;
    display: flex;
    justify-content: flex-end; /* Push everything to the right */
    align-items: center;
    height: var(--topbar-height);
    z-index: 50;
  }

  #mobile-menu-btn {
    position: absolute !important;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 60;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #page-title {
    position: absolute !important;
    left: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    z-index: 60;
  }

  .top-bar > div:first-child {
    display: contents; /* Let children be absolute relative to top-bar */
  }


  .top-bar > div:last-child {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 70;
  }


  }

  #dashboard-auth-state, 
  #list-items-auth-state, 
  #add-item-auth-state, 
  #manage-categories-auth-state {
    display: none;
  }

  .page-container {
    padding: 1rem;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }
  .login-hero {
    display: none;
  }
  .login-card {
    width: 100%;
    max-width: 480px;
    margin: auto;
    border-radius: var(--radius-xl);
  }
  .login-shell {
    padding: 1.5rem;
    background: #0f172a;
    align-items: center;
    justify-content: center;
  }
  
  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .modifier-value-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .modifier-group {
    padding: 1rem;
    overflow-x: auto;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    text-align: center;
  }

  .card-header .btn, 
  .form-section .btn {
    width: 100%;
  }
}


