/*style.css: Responsive dark styling, professional */

/*Root variables */

:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --muted: #6b6b6b;
  --accent: #ff6b6b;
  --accent-2: #ff9f43;
  --text: #111827;
  --glass: rgba(255,255,255,0.6);
  --shadow: 0 6px 18px rgba(16,24,40,0.08);
  --radius: 12px;
  --max-width: 1200px;
  --cart-width: 380px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue" and Arial;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dark mode variables (switches when body.dark exists) */
body.dark {
  --bg: #0f1724;
  --card: #0b1220;
  --muted: #99a3b0;
  --accent: #f4a261;
  --accent-2: #f6bd60;
  --text: #e6eef8;
  --glass: rgba(255,255,255,0.02);
  --shadow: 0 6px 18px rgba(2,6,23,0.6);
}

/* Layout */
.site-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  max-width:var(--max-width);
  margin:20px auto;
  padding:14px;
  gap:16px;
}

.brand h1 {
  margin:0;
  font-size:1.3rem;
}
.subtitle { margin:3px 0 0; color:var(--muted); font-size:0.9rem; }

.controls {
  display:flex;
  align-items:center;
  gap:14px;
}

.student-info { font-weight:600; color:var(--muted); margin-right:6px; font-size:0.95rem; }

/* Filters */
.filters {
  display:flex;
  gap:10px;
  align-items:center;
}

.filters select,
.filters input[type="search"] {
  padding:8px 10px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,0.06);
  background:var(--card);
  min-width:140px;
}

/* Dark switch */
.dark-switch {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:0.9rem;
  cursor:pointer;
}

.dark-switch input { display:none; }
.dark-switch .slider {
  display:inline-block;
  width:36px;
  height:18px;
  background: rgba(0,0,0,0.12);
  border-radius:999px;
  position:relative;
  transition:all .2s ease;
}

.dark-switch .slider::after {
  content:'';
  position:absolute;
  left:3px;
  top:3px;
  width:12px;
  height:12px;
  border-radius:50%;
  background:white;
  transition:all .2s ease;
}
/* when checked we'll move the knob with JS by toggling .dark on body */
body.dark .dark-switch .slider {
  background: var(--accent);
}
body.dark .dark-switch .slider::after {
  transform: translateX(18px);
}

/* Main grid: products + cart */
.main-grid {
  max-width: var(--max-width);
  margin: 10px auto;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr var(--cart-width);
  gap: 18px;
}

/* Products grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* Product card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  justify-content:space-between;
transition: transform .16s ease, box-shadow .16s ease;
  min-height: 280px;
  overflow:hidden;
}
.card:hover {
  transform: translateY(-6px);
}

.product-img {
  width:100%;
  height:140px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  overflow:hidden;
  margin-bottom:10px;
}
.product-img img { width:100%; height:100%; object-fit:cover; display:block; }

/* Product details */
.card h3 { margin:6px 0 4px; font-size:1.05rem; }
.card p { margin:0 0 8px; color:var(--muted); font-size:0.92rem; min-height:38px; }

.card .price-add {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.price { font-weight:700; font-size:1.05rem; color:var(--text); }
.btn {
  padding:8px 12px;
  border-radius:8px;
  border:0;
  cursor:pointer;
  background:var(--accent);
  color:white;
  font-weight:600;
  box-shadow: 0 6px 12px rgba(0,0,0,0.08);
  transition: transform .12s ease, opacity .12s ease;
}
.btn.secondary { background:transparent; color:var(--text); border:1px solid rgba(0,0,0,0.06); }

.btn:active { transform: translateY(1px); }
.card .btn:hover { opacity:0.95; }

/* Cart styles */
.cart {
  position:sticky;
  top:20px;
  background:var(--card);
  padding:14px;
  border-radius:12px;
  box-shadow: var(--shadow);
height: fit-content;
}
.cart h2 { margin:0 0 12px; font-size:1.1rem; }

.cart-table { width:100%; border-collapse:collapse; margin-bottom:10px; }
.cart-table thead th { text-align:left; font-size:0.85rem; color:var(--muted); padding-bottom:6px; }
.cart-table tbody td { padding:8px 0; vertical-align:middle; }
.cart-table td .small { display:block; color:var(--muted); font-size:0.9rem; }
.qty-input { width:64px; padding:6px; border-radius:6px; border:1px solid rgba(0,0,0,0.06); text-align:center; }

.grand-row { display:flex; justify-content:space-between; align-items:center; margin-top:8px; padding-top:8px; border-top:1px dashed rgba(0,0,0,0.04); }
#grandTotal { font-weight:800; font-size:1.2rem; color:var(--accent); }

/* Footer */
.site-footer {
  max-width:var(--max-width);
  margin:20px auto;
  padding:10px 18px;
  color:var(--muted);
  display:flex;
  justify-content:space-between;
align-items:center;}

/* Responsive */
@media (max-width: 900px){
  .main-grid { grid-template-columns: 1fr; }
  .cart { order: 2; margin-top: 10px; }
  .products-grid { order: 1; }
  .controls { flex-direction:column; gap:8px; align-items:flex-end; }
}

/* Small polish */
.small-note { font-size:0.8rem; color:var(--muted); margin-top:6px;}