/* ═══════════════════════════ RESET & TOKENS ══ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0d0f12;
  --bg-card: #13161b;
  --bg-hover: #1a1e25;
  --bg-input: #1a1e25;
  --border: #252930;
  --border-hi: #333a44;

  --text: #e8eaed;
  --text-2: #8b9099;
  --text-3: #555b66;

  --accent: #f59e0b;
  --accent-dk: #d97706;
  --accent-lt: rgba(245, 158, 11, 0.12);

  --green: #22c55e;
  --green-lt: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-lt: rgba(239, 68, 68, 0.12);
  --blue: #3b82f6;
  --blue-lt: rgba(59, 130, 246, 0.12);
  --purple: #a855f7;
  --purple-lt: rgba(168, 85, 247, 0.12);

  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);

  --font: "DM Sans", sans-serif;
  --mono: "DM Mono", monospace;

  --sidebar-w: 230px;
  --transition: 160ms ease;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════ SCREENS ══ */
.screen {
  display: none;
}
.screen.active {
  display: flex;
}


/* ════════════════════════════ LOGIN ══ */
#login-screen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(
    ellipse 60% 50% at 50% -10%,
    rgba(245, 158, 11, 0.08) 0%,
    transparent 100%
  );
}

.login-box {
  width: 100%;
  max-width: 380px;
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.logo-mark {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.logo-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.logo-sub {
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 1px;
}

.login-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-hint {
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 28px;
}

/* ════════════════════════════ LAYOUT ══ */
#admin-screen {
  display: none;
  min-height: 100vh;
  width: 100vw;
  position: relative;
}
#admin-screen.active {
  display: block;
}
#admin-screen:not(.active) .sidebar,
#admin-screen:not(.active) .main {
  display: none;
}

/* ═══════════════════════════ SIDEBAR ══ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .logo-mark {
  font-size: 20px;
}
.sidebar-header .logo-text {
  font-size: 16px;
  font-weight: 600;
}
.sidebar-header .logo-sub {
  font-size: 10px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-3);
  padding: 0 8px;
  margin-bottom: 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition:
    background var(--transition),
    color var(--transition);
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-lt);
  color: var(--accent);
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.admin-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-lt);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-info {
  min-width: 0;
}
.admin-email {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-role {
  font-size: 11px;
  color: var(--text-3);
}

/* ══════════════════════════════ MAIN ══ */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 32px 36px;
  width: calc(100vw - var(--sidebar-w));
  box-sizing: border-box;
  overflow-x: hidden;
}

.page {
  display: none;
}
.page.active {
  display: block;
}

/* ════════════════════════ PAGE HEADER ══ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

/* ══════════════════════════ TOOLBAR ══ */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
}

.filter-group {
  display: flex;
  gap: 8px;
}

/* ════════════════════════════ INPUTS ══ */
input[type="text"],
input[type="email"],
input[type="password"],
.search-input,
.select-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 8px 12px;
  transition: border-color var(--transition);
  outline: none;
  width: 100%;
}

input::placeholder {
  color: var(--text-3);
}

input:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}

.select-input {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9099' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 30px;
  width: auto;
}

/* ══════════════════════════════ TABLE ══ */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  font-weight: 500;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.th-actions {
  text-align: right;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}
.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.cell-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}
.cell-email {
  font-size: 12px;
  color: var(--text-2);
  font-family: var(--mono);
  margin-top: 1px;
}
.cell-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}
.cell-date {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

/* ══════════════════════════ BADGES ══ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-role-admin {
  background: var(--accent-lt);
  color: var(--accent);
}
.badge-role-user {
  background: var(--blue-lt);
  color: var(--blue);
}

.badge-active {
  background: var(--green-lt);
  color: var(--green);
}
.badge-inactive {
  background: var(--red-lt);
  color: var(--red);
}

.badge-yes {
  background: var(--green-lt);
  color: var(--green);
}
.badge-no {
  background: var(--bg-hover);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.badge-notified {
  background: var(--blue-lt);
  color: var(--blue);
}
.badge-pending {
  background: var(--accent-lt);
  color: var(--accent);
}

.badge-meal-breakfast {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}
.badge-meal-lunch {
  background: var(--green-lt);
  color: var(--green);
}
.badge-meal-dinner {
  background: var(--purple-lt);
  color: var(--purple);
}
.badge-meal-all-day {
  background: var(--blue-lt);
  color: var(--blue);
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.auth-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.auth-chip {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-family: var(--mono);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-2);
}

/* ═══════════════════════════ ROW ACTIONS ══ */
.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}
.btn-icon svg {
  width: 14px;
  height: 14px;
}
.btn-icon:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text);
}
.btn-icon.btn-icon-danger:hover {
  background: var(--red-lt);
  border-color: transparent;
  color: var(--red);
}

/* ══════════════════════════════ SKELETON ══ */
.loading-row td {
  padding: 0;
}
.skeleton-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.skeleton {
  height: 52px;
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    var(--bg-hover) 50%,
    var(--bg-card) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
  border-bottom: 1px solid var(--border);
}

/* ════════════════════════ EMPTY STATE ══ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state svg {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  display: block;
  opacity: 0.4;
}
.empty-state p {
  font-size: 13px;
}

/* ════════════════════════════ ALERTS ══ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--red-lt);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
.alert-success {
  background: var(--green-lt);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
}

/* ══════════════════════════════ BUTTONS ══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover {
  background: var(--accent-dk);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-spinner.white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

/* ════════════════════════ FORM FIELDS ══ */
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.required {
  color: var(--red);
}
.field-hint {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
}

/* Checkbox */
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px !important;
  color: var(--text) !important;
  font-weight: 400 !important;
  margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-hi);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.checkbox-label input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input:checked + .checkbox-custom::after {
  content: "";
  display: block;
  width: 9px;
  height: 6px;
  border-left: 2px solid #000;
  border-bottom: 2px solid #000;
  transform: rotate(-45deg) translateY(-1px);
}

/* ══════════════════════════════ MODAL ══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
  animation: scaleIn 0.2s ease;
}

.modal-sm {
  max-width: 380px;
}

.modal-lg {
  max-width: 680px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.confirm-text {
  color: var(--text-2);
  font-size: 13.5px;
}

/* ════════════════════════ SUB-TABS ══ */
.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.sub-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  bottom: -1px;
}
.sub-tab svg {
  width: 14px;
  height: 14px;
}
.sub-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.sub-tab.active {
  color: var(--accent);
  background: var(--bg-card);
  border-color: var(--border);
  border-bottom-color: var(--bg-card);
}

.sub-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--mono);
}
.sub-tab.active .sub-tab-count {
  background: var(--accent-lt);
  color: var(--accent);
}

.subtab-panel {
  display: none;
}
.subtab-panel.active {
  display: block;
}

/* ═══════════════════ DETAIL SECTIONS (inside modals) ══ */
.detail-section {
  margin-bottom: 20px;
}
.detail-section:last-child {
  margin-bottom: 0;
}
.detail-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  font-weight: 500;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.detail-kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-key {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.detail-val {
  font-size: 13px;
  color: var(--text);
  font-family: var(--mono);
}

.ingredient-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ingredient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius);
  font-size: 12.5px;
}
.ingredient-name {
  color: var(--text);
}
.ingredient-qty {
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
}
.ingredient-ok {
  color: var(--green);
  font-size: 11px;
}
.ingredient-miss {
  color: var(--red);
  font-size: 11px;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: step-counter;
}
.step-item {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}
.step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.missing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.missing-chip {
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--red-lt);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 12px;
  font-family: var(--mono);
}

.recipe-card-mini {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.recipe-card-mini:last-child {
  margin-bottom: 0;
}
.recipe-card-mini-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

/* ════════════════════════ ANIMATIONS ══ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}
