/* ================== GLOBAL BASE CSS ================== */
/* Loaded after Bootstrap. Avoid overriding Bootstrap's generic classes (.btn, .card, ...)
   globally; scope project styles to page-specific classes instead. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background-color: #f8f9fa;
}

.page-content {
  flex: 1 0 auto;
}

/* ===== Header CSS ===== */
.main-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 30px;
  background-color: #f8f8f8;
  border-bottom: 1px solid #ddd;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #333;
  text-decoration: none;
}

.brand-logo {
  height: 40px;
  border-radius: 50%;
}

.brand-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.header-link {
  color: #333;
  font-weight: 500;
  text-decoration: none;
}

.header-link:hover {
  color: #dc3545;
}

.profile-image {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  border: 2px solid #333;
}

@media (max-width: 575.98px) {
  .main-header {
    padding: 10px 16px;
  }
  .brand-name {
    font-size: 1.15rem;
  }
  .header-actions {
    gap: 10px;
  }
}

/* ===== Footer CSS ===== */
footer {
  background-color: #222;
  color: #fff;
  padding: 20px 16px;
  text-align: center;
  font-size: 0.95rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Login / Register Pages ===== */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 16px;
}

.auth-card {
  background: #fff;
  padding: 30px 40px;
  border: none;
  border-radius: 12px;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

@media (max-width: 575.98px) {
  .auth-card {
    padding: 24px 20px;
  }
}

.auth-title {
  text-align: center;
  font-size: 1.8rem;
  color: #dc3545;
  margin-bottom: 25px;
  font-weight: 600;
}

/* Form Fields */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: #333;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s ease-in-out;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

/* ================== ADMIN DASHBOARD CSS ================== */
.admin-layout {
  display: flex;
  min-height: 100%;
}

.admin-main {
  flex-grow: 1;
  min-width: 0; /* lets tables scroll instead of stretching the page */
  padding: 1.5rem;
}

.admin-sidebar {
  background-color: #343a40;
  color: #fff;
  min-width: 220px;
  min-height: calc(100vh - 66px);
  border-right: 2px solid #dc3545;
}

.admin-sidebar h3 {
  color: #fff;
}

.admin-sidebar a {
  display: block;
  padding: 12px 15px;
  margin: 8px 0;
  color: #ddd;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.3s ease-in-out;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  background-color: #dc3545;
  color: #fff;
}

/* On phones the sidebar becomes a horizontal menu above the content */
@media (max-width: 767.98px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    border-right: none;
    border-bottom: 2px solid #dc3545;
  }
  .admin-sidebar h3 {
    width: 100%;
    font-size: 1.1rem;
    margin-bottom: 4px !important;
  }
  .admin-sidebar a {
    margin: 0;
    padding: 6px 12px;
  }
  .admin-main {
    padding: 1rem;
  }
}

/* ================== KIOSK MENU PAGE CSS ================== */
.category-sidebar {
  background: #fff;
  border-right: 1px solid #eee;
  padding: 20px;
}

.category-list li {
  margin-bottom: 6px;
}

.category-btn {
  text-align: left;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 500;
  background: #f8f9fa;
  color: #333;
  border: 1px solid #ddd;
  transition: all 0.3s ease-in-out;
}

.category-btn:hover,
.category-btn.active {
  background-color: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

.menu-item .card {
  background: #fff;
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: all 0.3s ease-in-out;
}

.menu-item .card:hover {
  transform: translateY(-5px);
  box-shadow: 0px 6px 16px rgba(0,0,0,0.12);
}

.cart {
  background: #fff;
  border-left: 1px solid #eee;
  padding: 20px;
  border-radius: 8px;
  box-shadow: -2px 0 8px rgba(0,0,0,0.05);
  align-self: flex-start;
  position: sticky;
  top: 12px;
}

.cart h4 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
}

.cart-badge {
  background-color: #fff;
  color: #dc3545;
  font-weight: bold;
  border-radius: 50%;
  padding: 2px 9px;
  font-size: 0.9rem;
}

@media (max-width: 767.98px) {
  /* Categories become a horizontal, scrollable chip row */
  .category-sidebar {
    border-right: none;
    border-bottom: 1px solid #eee;
    padding: 12px 16px;
  }
  .category-sidebar h5 {
    display: none;
  }
  .category-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0;
    padding-bottom: 4px;
  }
  .category-list li {
    flex: 0 0 auto;
    margin: 0;
  }
  .category-btn {
    white-space: nowrap;
    width: auto !important;
  }

  /* Keep the cart and checkout reachable while scrolling the menu */
  .cart {
    position: sticky;
    top: auto;
    bottom: 0;
    z-index: 10;
    max-height: 45vh;
    overflow-y: auto;
    border-left: none;
    border-top: 2px solid #dc3545;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.12);
    padding: 12px 16px;
  }
}

/* ================== KITCHEN BOARD ================== */
/* Cards in a row share one height; long item lists scroll instead of stretching the card */
.kitchen-order .card {
  height: 100%;
}

.kitchen-order .card-body {
  display: flex;
  flex-direction: column;
}

.kitchen-items {
  max-height: 7.5rem;
  overflow-y: auto;
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.order-actions {
  margin-top: auto; /* keep buttons aligned at the bottom of every card */
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.order-actions .btn-next {
  flex: 1 1 auto;
}

/* ================== PAYMENT PAGES ================== */
.payment-box,
.status-box {
  text-align: center;
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.1);
  width: 100%;
}

.payment-box {
  max-width: 420px;
}

.status-box {
  max-width: 480px;
}

.status-box h2 {
  margin-bottom: 12px;
  font-weight: bold;
}

.loader {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #dc3545;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ================== PROFILE PAGE ================== */
.profile-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 16px;
}

.profile-box {
  flex: 0 0 25%;
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.orders-box {
  flex: 1 1 auto;
  min-width: 0;
}

.profile-box h2,
.orders-box h2 {
  color: #dc3545;
  margin-bottom: 20px;
  font-weight: 600;
}

.profile-box p {
  margin: 10px 0;
  color: #333;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.profile-box strong {
  color: #555;
}

.order-card {
  background: #fff;
  border: none;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.08);
}

@media (max-width: 900px) {
  .profile-container {
    flex-direction: column;
  }
  .profile-box,
  .orders-box {
    flex: 1 1 auto;
    width: 100%;
  }
}

.back-to-menu {
  margin-top: 25px;
  text-align: center;
}

/* ================== ORDER TIMELINE ================== */
.progressbar {
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.progressbar li {
  flex: 1;
  min-width: 0;
  position: relative;
  text-align: center;
  font-size: 0.85rem;
  color: #999;
  overflow-wrap: anywhere;
}

/* Default circle (grey outline) */
.progressbar li::before {
  content: "";
  position: relative;
  z-index: 1; /* above the connector line */
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  display: block;
  margin: 0 auto 8px;
  border-radius: 50%;
  background-color: #fff;
  transition: all 0.3s ease;
}

/* Connector line */
.progressbar li::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: #ccc;
  top: 10px;
  left: -50%;
  z-index: 0;
}

.progressbar li:first-child::after {
  content: none;
}

/* ✅ Normal flow (green for completed steps) */
.progressbar li.completed {
  color: #28a745; /* green text */
}
.progressbar li.completed::before {
  border-color: #28a745;
  background-color: #28a745; /* green circle */
}
.progressbar li.completed::after {
  background-color: #28a745;
}

/* 🔴 Cancelled (only that step red) */
.progressbar li.cancelled {
  color: #dc3545;
}
.progressbar li.cancelled::before {
  border-color: #dc3545;
  background-color: #dc3545;
}

@media (max-width: 575.98px) {
  .progressbar li {
    font-size: 0.65rem;
  }
  .progressbar li::before {
    width: 14px;
    height: 14px;
  }
  .progressbar li::after {
    top: 7px;
  }
}
