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

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-color: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.7);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.05), 0 4px 6px -2px rgba(0,0,0,.025);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.05), 0 10px 10px -5px rgba(0,0,0,.02);
  --glass-shadow: 0 8px 32px 0 rgba(31,38,135,.07);
  --success: #22c55e;
  --error: #ef4444;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  background-image:
    radial-gradient(circle at top right, #e0e7ff 0%, transparent 40%),
    radial-gradient(circle at bottom left, #dbeafe 0%, transparent 40%);
  background-attachment: fixed;
  min-height: 100vh;
}

body.cart-open { overflow: hidden; }

/* ---- Navbar ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.logo span { color: var(--primary-color); }

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  justify-content: flex-end;
  margin-right: 1rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  position: relative;
  transition: color .3s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary-color); }
.nav-links a::after {
  content: '';
  position: absolute;
  width: 0; height: 2px;
  bottom: -4px; left: 0;
  background-color: var(--primary-color);
  transition: width .3s ease;
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }

.nav-user { color: var(--text-muted); font-size: .9rem; white-space: nowrap; }

.btn-nav {
  padding: .5rem 1.2rem !important;
  width: auto !important;
  font-size: .9rem;
  border-radius: 8px;
  background: var(--primary-color);
  color: white !important;
}
.btn-nav::after { display: none !important; }
.btn-nav:hover { background: var(--primary-hover); color: white !important; }

/* ---- Cart Icon Button ---- */
.cart-icon-btn {
  position: relative;
  background: var(--primary-color);
  border: none;
  color: white;
  width: 44px; height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s ease, transform .2s ease;
  flex-shrink: 0;
}
.cart-icon-btn:hover { background: var(--primary-hover); transform: scale(1.05); }

.cart-count {
  position: absolute;
  top: -6px; right: -6px;
  background: #ef4444;
  color: white;
  font-size: .7rem;
  font-weight: 700;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ---- Cart Overlay ---- */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 1100;
  backdrop-filter: blur(2px);
}
.cart-overlay.show { display: block; }

/* ---- Cart Sidebar ---- */
.cart-sidebar {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  z-index: 1200;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,.12);
}
.cart-sidebar.open { transform: translateX(0); }

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.cart-header h3 { font-size: 1.25rem; font-weight: 700; }
.cart-close {
  background: #f1f5f9; border: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.cart-close:hover { background: #e2e8f0; }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.cart-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  animation: fadeInUp .3s ease;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; font-size: .95rem; display: block; }
.cart-item-price { color: var(--primary-color); font-size: .85rem; font-weight: 500; }

.cart-item-controls { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.qty-btn {
  width: 28px; height: 28px;
  border: 1px solid #cbd5e1;
  background: white;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.qty-btn:hover { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.qty-val { font-weight: 600; min-width: 20px; text-align: center; }
.remove-btn {
  background: none; border: none;
  cursor: pointer; font-size: 1rem;
  padding: 4px; border-radius: 4px;
  transition: transform .2s;
}
.remove-btn:hover { transform: scale(1.2); }

.cart-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-main);
  color: white;
  padding: .75rem 1.5rem;
  border-radius: 50px;
  font-weight: 500;
  z-index: 9999;
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 5rem 1rem;
  max-width: 800px;
  margin: 0 auto;
}
.hero h1 { font-size: 3rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.2; }
.hero p  { font-size: 1.125rem; color: var(--text-muted); margin-bottom: 2rem; }

/* ---- Container ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 5%; }

.section-title {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 2rem;
}

/* ---- Category Tabs ---- */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}
.tab-btn {
  padding: .5rem 1.25rem;
  border: 1px solid #cbd5e1;
  background: white;
  border-radius: 50px;
  font-size: .95rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .25s ease;
}
.tab-btn:hover  { border-color: var(--primary-color); color: var(--primary-color); }
.tab-btn.active { background: var(--primary-color); border-color: var(--primary-color); color: white; }

/* ---- Menu Grid ---- */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
  margin-bottom: 5rem;
}

/* ---- Card ---- */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  transition: all .4s cubic-bezier(.175,.885,.32,1.275);
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }

.card-img {
  width: 100%; height: 180px;
  overflow: hidden;
  position: relative;
}
.card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.card:hover .card-img img { transform: scale(1.08); }

.category-badge {
  position: absolute;
  top: .75rem; left: .75rem;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  padding: .25rem .75rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary-color);
}

.card-content { padding: 1.25rem; display: flex; flex-direction: column; flex-grow: 1; }
.card-title  { font-size: 1.1rem; font-weight: 600; margin-bottom: .25rem; }
.card-desc   { font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; flex: 1; }

.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.card-price  { font-size: 1.1rem; color: var(--primary-color); font-weight: 700; }

.btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: .75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .3s ease;
  width: 100%;
  font-family: inherit;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}
.btn:hover  { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

.btn-add {
  padding: .5rem 1.25rem;
  width: auto;
  font-size: .9rem;
  border-radius: 8px;
}

/* ---- Auth Pages ---- */
.auth-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 460px;
}
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.auth-header p  { color: var(--text-muted); }

.glass-form {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.auth-form { gap: 1.25rem; }

.form-group { display: flex; flex-direction: column; gap: .5rem; }
.form-group label { font-weight: 500; font-size: .95rem; color: var(--text-main); margin-left: .25rem; }
.form-group input {
  padding: .9rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  background: rgba(255,255,255,.9);
  transition: all .3s ease;
  outline: none;
}
.form-group input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59,130,246,.15); background: white; }
.form-group input[readonly] { background: #f1f5f9; cursor: not-allowed; color: var(--text-muted); }

.auth-switch { text-align: center; color: var(--text-muted); font-size: .9rem; }
.auth-switch a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ---- Alerts ---- */
.alert {
  padding: .85rem 1rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
}
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.alert a { color: inherit; font-weight: 700; }

/* ---- Orders Page ---- */
.orders-table-wrapper {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}
.orders-table {
  width: 100%;
  border-collapse: collapse;
}
.orders-table th {
  background: #f1f5f9;
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.orders-table td {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  font-size: .95rem;
}
.orders-table tbody tr:hover { background: rgba(59,130,246,.04); }
.total-cell   { color: var(--primary-color); font-weight: 600; }
.date-cell    { color: var(--text-muted); font-size: .85rem; }
.grand-total  { color: var(--primary-color); font-weight: 700; font-size: 1.1rem; }
.orders-table tfoot td { padding: 1.25rem; border-top: 2px solid #e2e8f0; background: #f8fafc; }

.empty-orders {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.empty-orders h3 { font-size: 1.25rem; font-weight: 600; color: var(--text-main); }

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fadeInUp .6s ease-out forwards; }
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero h1   { font-size: 2.2rem; }
  .cart-sidebar { width: 100vw; }
  .glass-form   { padding: 1.5rem; }
  .orders-table { font-size: .85rem; }
  .orders-table th, .orders-table td { padding: .75rem .75rem; }
  .date-cell { display: none; }
}
