/* ==========================================================================
   SchoolNotes — assets/css/style.css
   Storefront theme. Brand blue (#1A67C4) matches the inline accents already
   used across index.php / cart.php / checkout.php / trending.php.
   ========================================================================== */

:root {
  --brand: #4F46E5;
  --brand-dark: #3730A3;
  --brand-light: #EEF2FF;
  --accent: #F59E0B;
  --ink: #1e293b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f4f7fb;
  --danger: #ff4757;
  --success: #28a745;
  --radius: 12px;
  --header-h: 62px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 70px; /* room for mobile bottom nav */
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------------------------- Header ---------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 10px 16px;
  min-height: var(--header-h);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.app-header .menu-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-header .logo img.desktop-logo-img { height: 34px; width: auto; }

.mobile-nav-icons { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.desktop-nav {
  display: none;
  align-items: center;
  gap: 22px;
  margin-left: 24px;
  font-weight: 600;
  font-size: 14.5px;
  flex: 1;
}

.desktop-nav > a { color: #fff; opacity: .92; white-space: nowrap; }
.desktop-nav > a:hover { opacity: 1; }

.nav-dropdown { position: relative; }
.nav-dropdown .dropbtn { color: #fff; cursor: pointer; }
.nav-dropdown .dropdown-content {
  display: none;
  position: absolute;
  top: 130%;
  left: 0;
  background: #fff;
  color: var(--ink);
  min-width: 200px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.15);
  padding: 8px;
  z-index: 50;
}
.nav-dropdown:hover .dropdown-content { display: block; }
.nav-dropdown .dropdown-content a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
}
.nav-dropdown .dropdown-content a:hover { background: var(--brand-light); color: var(--brand); }

@media (min-width: 993px) {
  .desktop-nav { display: flex; }
  .mobile-nav-icons { display: none; }
  .app-header .menu-btn.mobile-toggle-only { display: none; }
  body { padding-bottom: 0; }
}

/* ---------------------------- Sidebar (mobile drawer) ---------------------------- */

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1100;
}
.overlay.active { display: block; }

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  right: -300px;
  width: 280px;
  background: #fff;
  z-index: 1200;
  transition: right .3s ease;
  overflow-y: auto;
  box-shadow: -6px 0 20px rgba(0,0,0,.1);
}
.sidebar.active { right: 0; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--brand);
  color: #fff;
}
.sidebar-header h3 { margin: 0; font-size: 17px; }
.close-sidebar { background: none; border: none; color: #fff; font-size: 26px; cursor: pointer; line-height: 1; }

.sidebar-nav { padding: 10px 0; }
.sidebar-nav .nav-label {
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--ink);
  font-weight: 500;
  font-size: 14.5px;
}
.sidebar-nav li a:hover { background: var(--brand-light); color: var(--brand); }
.sidebar-nav li a i { width: 18px; color: var(--brand); }

/* ---------------------------- Hero ---------------------------- */

.hero-bg {
  background: linear-gradient(155deg, var(--brand-dark), var(--brand) 55%, #7C7AF2);
  padding-top: 15px;
  position: relative;
  overflow: hidden;
}
.hero-bg::before {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.greeting-block { padding: 10px 20px 15px; position: relative; z-index: 1; }
.greeting-block h1 { font-size: 24px; margin: 0 0 4px; font-weight: 800; display: flex; align-items: center; gap: 8px; letter-spacing: -0.3px; }
.greeting-block p { margin: 0; font-size: 14px; opacity: .92; }

.trust-strip {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center;
  padding: 4px 20px 16px; position: relative; z-index: 1;
}
.trust-strip span { font-size: 12.5px; font-weight: 600; color: #fff; opacity: .95; display: flex; align-items: center; gap: 6px; }
.trust-strip span i { color: #FFD166; font-size: 12px; }

@media (min-width: 993px) {
  .greeting-block h1 { font-size: 30px; }
  .greeting-block p { font-size: 15.5px; }
}

.search-dropdown {
  display: none;
  max-width: 700px;
  margin: 0 auto 10px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.15);
  overflow: hidden;
}
.search-dropdown.active { display: block; }
.search-results { max-height: 320px; overflow-y: auto; }
.search-results a { display: flex; gap: 10px; padding: 10px 14px; align-items: center; border-bottom: 1px solid var(--border); }
.search-results a:hover { background: var(--brand-light); }
.search-results img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }

/* ---------------------------- Main content / sections ---------------------------- */

.main-content { max-width: 1180px; margin: 0 auto; padding: 20px 15px 40px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 14px;
}
.section-title h2 { font-size: 19px; margin: 0; font-weight: 800; position: relative; padding-left: 12px; }
.section-title h2::before {
  content: "";
  position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
  border-radius: 4px;
}
.section-title a { font-size: 13px; font-weight: 700; color: var(--brand); }

/* ---------------------------- Feature / "why choose us" cards ---------------------------- */

.feat-card {
  flex: 0 0 auto;
  min-width: 108px;
  background: #fff;
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
  transition: transform .2s;
}
.feat-card:hover { transform: translateY(-3px); }
.feat-card i { color: #fff; }
.feat-1 { background: linear-gradient(135deg, #4F46E5, #7C7AF2); }
.feat-2 { background: linear-gradient(135deg, #0EA5E9, #38BDF8); }
.feat-3 { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.feat-4 { background: linear-gradient(135deg, #10B981, #34D399); }
.feat-5 { background: linear-gradient(135deg, #EC4899, #F472B6); }
.feat-6 { background: linear-gradient(135deg, #6366F1, #A78BFA); }

.desktop-wa-banner {
  background: #e9fbef;
  border: 1px solid #c9f2d6;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.desktop-wa-banner .wa-content { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.wa-join-btn { background: #25D366; color: #fff !important; padding: 8px 16px; border-radius: 30px; font-weight: 700; font-size: 13px; }

/* ---------------------------- Product cards ---------------------------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 993px) { .product-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; } }

.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  transition: box-shadow .2s, transform .2s;
}
.product-card:hover { box-shadow: 0 14px 28px rgba(79,70,229,.14); transform: translateY(-3px); border-color: transparent; }

.product-img-wrapper { aspect-ratio: 1/1; background: #fafafa; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }

.product-info { padding: 12px; }
.product-title { font-size: 13.5px; font-weight: 600; min-height: 38px; line-height: 1.3; color: var(--ink); }
.product-price { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.product-price .price-now { font-size: 17px; font-weight: 800; color: var(--brand); }
.product-price .price-old { font-size: 12.5px; color: #999; text-decoration: line-through; }
.product-price .price-off { background: var(--success); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }

.product-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.product-tags span { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 12px; }
.tag-class { background: #eef2ff; color: #4f46e5; }
.tag-subject { background: #ecfdf5; color: #10b981; }
.tag-medium { background: #fdf2f8; color: #ec4899; }

.btn-add-cart, .btn-buy-now {
  width: 100%;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.btn-add-cart { background: #f1f2f6; color: #2f3542; }
.btn-buy-now { background: var(--brand); color: #fff; }
.btn-add-cart:hover { background: #e4e6ec; }
.btn-buy-now:hover { background: var(--brand-dark); }

.horizontal-card { display: flex; }
.horizontal-card .product-img-wrapper { width: 110px; min-width: 110px; aspect-ratio: auto; border-right: 1px solid var(--border); }
.horizontal-card .product-info { flex: 1; }

.btn-remove {
  background: var(--danger); color: #fff; border: none; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 12.5px; margin-top: 10px;
}

/* ---------------------------- Category / board pill grids ---------------------------- */

.pill-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
@media (min-width: 640px) { .pill-grid { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 993px) { .pill-grid { grid-template-columns: repeat(5,1fr); } }

.pill-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  font-weight: 700;
  color: var(--ink);
  transition: .2s;
}
.pill-card:hover { border-color: var(--brand); color: var(--brand); box-shadow: 0 8px 20px rgba(26,103,196,.12); }
.pill-card i { display: block; font-size: 24px; color: var(--brand); margin-bottom: 8px; }

/* ---------------------------- Generic content card / page ---------------------------- */

.content-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  margin-bottom: 18px;
}
.content-card h1, .content-card h2 { margin-top: 0; }

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--brand); font-weight: 600; }

/* ---------------------------- Forms ---------------------------- */

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,103,196,.12); }
textarea.form-control { resize: vertical; min-height: 110px; }

.btn-primary {
  background: var(--brand); color: #fff; border: none; padding: 12px 22px;
  border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 14.5px;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline {
  background: #fff; color: var(--brand); border: 1px solid var(--brand); padding: 11px 22px;
  border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 14.5px;
}

.auth-card { max-width: 420px; margin: 40px auto; }

/* ---------------------------- Cart / Checkout ---------------------------- */

.cart-container { max-width: 800px; margin: 0 auto; }
.cart-summary {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-top: 18px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; bottom: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.cart-total { font-size: 18px; font-weight: 800; }
.btn-checkout {
  background: var(--brand); color: #fff; padding: 12px 24px; border-radius: 8px;
  font-weight: 700; display: inline-flex; align-items: center; gap: 8px;
}
.empty-cart { text-align: center; padding: 60px 20px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }

.checkout-steps { display: flex; gap: 8px; margin-bottom: 20px; }
.checkout-steps .step {
  flex: 1; text-align: center; padding: 10px; border-radius: 8px; background: #fff;
  border: 1px solid var(--border); font-weight: 700; font-size: 13px; color: var(--muted);
}
.checkout-steps .step.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------------------------- Footer ---------------------------- */

.desktop-footer { background: #10233d; color: #fff; margin-top: 40px; padding: 40px 20px 0; }
.footer-content { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 28px; padding-bottom: 30px; }
@media (min-width: 768px) { .footer-content { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 993px) { .footer-content { grid-template-columns: 1.5fr repeat(4, 1fr); } }
.footer-col h3 { font-size: 15px; margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { font-size: 13.5px; opacity: .85; }
.footer-col ul li a:hover { opacity: 1; text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); text-align: center; padding: 16px 0; font-size: 13px; opacity: .8; }

/* ---------------------------- Bottom mobile nav ---------------------------- */

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
  background: #fff; display: flex; box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  border-top: 1px solid var(--border);
}
.bottom-nav .nav-item {
  flex: 1; text-align: center; padding: 8px 0 6px; font-size: 10.5px; font-weight: 600; color: var(--muted);
}
.bottom-nav .nav-item i { display: block; font-size: 17px; margin-bottom: 3px; }
.bottom-nav .nav-item.active { color: var(--brand); }
@media (min-width: 993px) { .bottom-nav { display: none; } }

/* ---------------------------- Misc / utility ---------------------------- */

.img-loading { background: #f0f0f0; animation: pulse 1.5s infinite; min-height: 60px; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

.badge-soft { background: var(--brand-light); color: var(--brand); font-weight: 700; padding: 4px 10px; border-radius: 20px; font-size: 12px; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state i { font-size: 40px; color: #cbd5e1; margin-bottom: 10px; }
