/* ============================================================
   8 Messy Kitchen — Global Stylesheet
   Warm cream/yellow background, orange/red branding, rounded,
   playful restaurant feel on the surface, clean professional
   layout underneath for daily staff use.
   ============================================================ */

:root {
  --color-cream: #FCEBB6;
  --color-cream-light: #FFF6E0;
  --color-orange: #F26522;
  --color-orange-dark: #D9501A;
  --color-red: #E8442C;
  --color-text: #2B2118;
  --color-text-muted: #6B5D4F;
  --color-white: #FFFFFF;
  --color-border: #EAD9A8;
  --color-success: #2E8B57;
  --color-success-bg: #E6F4EC;
  --color-warning: #C9860A;
  --color-warning-bg: #FDF3DD;
  --color-danger: #C0392B;
  --color-danger-bg: #FBEAE8;
  --color-info: #2C7BA6;
  --color-info-bg: #E7F2F8;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 3px rgba(43, 33, 24, 0.08);
  --shadow-md: 0 4px 14px rgba(43, 33, 24, 0.12);

  --sidebar-width: 250px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--color-cream);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  margin: 0 0 12px 0;
  color: var(--color-text);
}

a { color: var(--color-orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ APP SHELL / LAYOUT ============ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.main-content.full {
  max-width: none;
  padding: 0;
  min-height: 100vh;
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ SIDEBAR ============ */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
}

.brand {
  padding: 18px 20px;
  display: flex;
  justify-content: center;
}
.sidebar-logo {
  width: 100%;
  max-width: 160px;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
}

.main-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 4px;
}

.main-nav a {
  display: block;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
}
.main-nav a:hover { background: var(--color-cream-light); text-decoration: none; }
.main-nav a.active {
  background: var(--color-orange);
  color: var(--color-white);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--color-border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-orange);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--color-text-muted); }

.logout-link {
  display: block;
  text-align: center;
  padding: 9px;
  border-radius: var(--radius-sm);
  background: var(--color-cream-light);
  color: var(--color-text);
  font-weight: 600;
  font-size: 14px;
}
.logout-link:hover { background: var(--color-border); text-decoration: none; }

.nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  background: var(--color-orange);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

/* ============ BUTTONS ============ */

.btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-block { display: block; width: 100%; }

.btn-primary { background: var(--color-orange); color: var(--color-white); }
.btn-secondary { background: var(--color-cream-light); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-danger { background: var(--color-danger); color: var(--color-white); }
.btn-success { background: var(--color-success); color: var(--color-white); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ============ FORMS ============ */

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--color-text);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-white);
  color: var(--color-text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.15);
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ============ ALERTS ============ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); }
.alert-success { background: var(--color-success-bg); color: var(--color-success); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.alert-info { background: var(--color-info-bg); color: var(--color-info); }

/* ============ CARDS ============ */

.card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--color-orange);
}
.stat-card .stat-value { font-size: 30px; font-weight: 800; }
.stat-card .stat-label { font-size: 13px; color: var(--color-text-muted); font-weight: 600; }
.stat-card.highlight {
  border-left-color: var(--color-red);
  background: linear-gradient(135deg, #FFF0E8, var(--color-white));
}

/* ============ TABLES ============ */

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.data-table th, table.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
table.data-table th {
  background: var(--color-cream-light);
  font-weight: 700;
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
table.data-table tr:last-child td { border-bottom: none; }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-pending { background: #FDF3DD; color: #C9860A; }
.badge-awaiting { background: #FBEAE8; color: #C0392B; }
.badge-confirmed { background: #E7F2F8; color: #2C7BA6; }
.badge-preparing { background: #EFE7FB; color: #6C3FBF; }
.badge-ready { background: #E9F7EF; color: #219653; }
.badge-completed { background: #E6F4EC; color: #2E8B57; }
.badge-cancelled { background: #EDEDED; color: #6B6B6B; }

/* ============ LOGIN PAGE ============ */

.login-page {
  width: 100%;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-logo {
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: var(--radius-lg);
  margin-bottom: 4px;
}
.login-subtitle {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}
.login-card form { text-align: left; }
.login-help {
  margin-top: 18px;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ============ ERROR PAGE (403 etc.) ============ */

.error-page {
  width: 100%;
  text-align: center;
  padding: 60px 20px;
}
.error-page h1 {
  font-size: 72px;
  color: var(--color-orange);
  margin-bottom: 8px;
}

/* ============ RESPONSIVE ============ */

/* Tablet */
@media (max-width: 900px) {
  .sidebar { width: 210px; }
  .main-content { padding: 22px 20px; }
  .form-row { flex-direction: column; gap: 0; }
}

/* Mobile */
@media (max-width: 700px) {
  .nav-toggle { display: block; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 250px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 40;
  }
  .sidebar.open { transform: translateX(0); }

   .main-content {
    padding: 70px 16px 24px;
    width: 100%;
    margin-left: 0;
  }

  .stat-grid { grid-template-columns: 1fr 1fr; }

  /* Data tables collapse into stacked cards on small screens */
  table.data-table thead { display: none; }
  table.data-table, table.data-table tbody, table.data-table tr, table.data-table td {
    display: block;
    width: 100%;
  }
  table.data-table tr {
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 8px 0;
  }
  table.data-table td {
    border-bottom: none;
    padding: 6px 14px;
    font-size: 14px;
  }
  table.data-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 2px;
  }

  .btn, .btn-block { min-height: 44px; }
  .login-card { padding: 30px 22px; }
}