/* ===== ViVi Solution Đà Nẵng - Style ===== */
:root {
  --primary: #0d47a1;
  --primary-dark: #0a346b;
  --primary-light: #1976d2;
  --accent: #ff9800;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1a2332;
  --muted: #6b7688;
  --border: #e3e8f0;
  --danger: #d32f2f;
  --success: #2e7d32;
  --warn: #f9a825;
  --shadow: 0 4px 16px rgba(13, 71, 161, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== Header ===== */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.6rem 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.header-top {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}
.brand i { font-size: 1.8rem; color: var(--accent); }
.site-logo { width: 190px; height: 64px; object-fit: contain; display: block; border-radius: 8px; }
.brand h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; }
.brand small { display: block; font-size: 0.7rem; opacity: 0.85; font-weight: 400; }
.search-box {
  flex: 1;
  min-width: 220px;
  max-width: 460px;
  display: flex;
}
.search-box input {
  flex: 1;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 24px 0 0 24px;
  outline: none;
  font-size: 0.95rem;
}
.search-box button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0 1.1rem;
  border-radius: 0 24px 24px 0;
  cursor: pointer;
  font-size: 1rem;
}
.header-actions { display: flex; align-items: center; gap: 1rem; }
.icon-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.25); }
.cart-btn { position: relative; }
.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  font-weight: 700;
}
.admin-link a { color: #fff; text-decoration: none; }

/* ===== Account dropdown (homepage header) ===== */
.auth-menu { position: relative; display: inline-flex; }
.auth-toggle { display: inline-flex; align-items: center; gap: 0.4rem; }
.auth-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  min-width: 190px;
  z-index: 300;
  overflow: hidden;
}
.auth-dropdown.show { display: block; }
.auth-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  background: #fff;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.auth-dropdown a:last-child { border-bottom: none; }
.auth-dropdown a i { width: 18px; text-align: center; color: var(--muted); }
.auth-dropdown a:hover { background: #eef4ff; color: var(--primary); }
.auth-dropdown a:hover i { color: var(--primary); }

/* ===== Category sidebar (left) ===== */
.cat-toggle {
  display: none;
  position: sticky;
  top: 64px;
  z-index: 98;
  margin: 0.5rem 1rem 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow);
}
.cat-toggle:hover { background: var(--primary-dark); }

.cat-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  z-index: 180;
  padding: 1rem 0;
  box-shadow: 2px 0 18px rgba(0,0,0,0.15);
  transform: translateX(0);
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.cat-sidebar-head {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  padding: 0.4rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.8rem;
}
/* Sidebar holds the category list vertically */
.cat-sidebar .cat-bar {
  background: transparent;
  border: none;
  padding: 0;
  position: static;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
}
.cat-bar .cat-btn {
  text-align: left;
  border: none;
  border-radius: 0;
  padding: 0.55rem 1.2rem;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text);
}
.cat-bar .cat-btn:hover { background: #eef3fb; color: var(--primary); border-left-color: var(--primary-light); }
.cat-bar .cat-btn.active { background: #e8effc; color: var(--primary); border-left: 3px solid var(--primary); font-weight: 700; }

/* Scrim overlay (mobile) when sidebar opens */
.cat-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 170;
}

/* Category dropdown (shown on narrow screens, hidden on wide) */
.cat-drop-wrap {
  display: none;
  align-items: center;
  gap: 0.6rem;
  max-width: 1200px;
  margin: 0.75rem 1rem 0;
}
.cat-drop-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  white-space: nowrap;
}
.cat-drop {
  flex: 1;
  max-width: 480px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.cat-drop:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,71,161,0.12); }

/* Move product area to leave room for the fixed sidebar on wide screens */
@media (min-width: 992px) {
  .hero, .container, .site-footer { margin-left: 240px; }
  .site-header { padding-left: 2rem; }
  .cat-toggle { display: none; }
  .cat-drop-wrap { display: none; }
}

/* Medium screens (769–991px): hide the fixed sidebar, show the category dropdown */
@media (min-width: 769px) and (max-width: 991px) {
  .cat-sidebar { transform: translateX(-240px); box-shadow: none; }
  .cat-toggle { display: none; }
  .cat-drop-wrap { display: flex; }
  .hero, .container, .site-footer { margin-left: 0; }
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(120deg, #0a346b, #1976d2 60%, #42a5f5);
  color: #fff;
  padding: 2.5rem 2rem;
  text-align: center;
}
.hero h2 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.hero p { font-size: 1.05rem; opacity: 0.95; }
.hero .stats {
  margin-top: 1.4rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat b { display: block; font-size: 1.6rem; color: var(--accent); }
.stat span { font-size: 0.85rem; opacity: 0.9; }

/* ===== Banner slider (quảng cáo) ===== */
.banner-slider {
  position: relative;
  max-width: 1000px;
  margin: 1.4rem auto 0;
  height: 180px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}
.banner-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d47a1;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.banner-slide.active { opacity: 1; }
.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 768px) {
  .banner-slider { height: 120px; margin-top: 1rem; }
}

/* ===== Product grid ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 2rem; }
.section-title { font-size: 1.4rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.section-title i { color: var(--primary); }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.2rem;
}
.product-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(13,71,161,0.15); }
.product-card .img-wrap {
  height: 170px;
  background: linear-gradient(135deg, #e8eef9, #f8fbff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--primary-light);
}
.product-card img { width: 100%; height: 100%; object-fit: contain; padding: 0.6rem; }
.pc-body { padding: 0.9rem 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.pc-cat { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary-light); font-weight: 700; }
.pc-name { font-weight: 600; font-size: 0.95rem; min-height: 2.4em; }
.pc-price { color: var(--danger); font-weight: 800; font-size: 1.1rem; }
.pc-stock { font-size: 0.8rem; }
.in-stock { color: var(--success); }
.low-stock { color: var(--warn); font-weight: 600; }
.out-stock { color: var(--danger); font-weight: 600; }
.stars { color: var(--accent); font-size: 0.85rem; }
.pc-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: 0.2s;
  flex: 1;
  text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #e08600; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.empty { text-align: center; padding: 3rem; color: var(--muted); }
.empty i { font-size: 3rem; margin-bottom: 0.5rem; display: block; }

/* ===== Modal / Toast ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: 92%;
  max-width: 520px;
  padding: 1.5rem;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: #eee;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1rem;
}
.modal h2 { margin-bottom: 0.8rem; color: var(--primary); }
.modal .m-price { font-size: 1.5rem; color: var(--danger); font-weight: 800; margin: 0.5rem 0; }
.modal .m-desc { color: var(--muted); margin-bottom: 0.8rem; }

/* ===== Product option selection (chọn phân loại) ===== */
.opt-select {
  background: linear-gradient(135deg, #f6f9ff, #eef4ff);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin: 0.8rem 0;
}
.opt-select > label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.6rem;
}
.opt-select > label::before { content: "🗂️"; font-size: 0.95rem; }
.opt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.opt-chip {
  border: 2px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 24px;
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(13,71,161,0.06);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1;
}
.opt-chip:hover {
  border-color: var(--primary-light);
  background: #f0f6ff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(13,71,161,0.12);
}
.opt-chip.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 3px 10px rgba(13,71,161,0.3);
}
.opt-chip.active::before { content: "✓ "; font-weight: 800; }
.opt-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f1f3f7;
  border-color: var(--border);
  color: var(--muted);
  transform: none;
  box-shadow: none;
}
.opt-chip:disabled:hover { background: #f1f3f7; border-color: var(--border); }
.opt-soldout {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--danger);
  background: #fde5e0;
  border-radius: 10px;
  padding: 0.05rem 0.4rem;
}
.opt-chip.active .opt-soldout { color: #fff; background: rgba(255,255,255,0.25); }

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  z-index: 300;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* ===== Cart drawer ===== */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 92vw;
  height: 100vh;
  background: #fff;
  z-index: 250;
  transition: right 0.3s;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}
.cart-drawer.open { right: 0; }
.cart-drawer header { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cart-items { flex: 1; overflow-y: auto; padding: 1rem; }
.cart-item { display: flex; gap: 0.7rem; padding: 0.6rem 0; border-bottom: 1px dashed var(--border); align-items: center; }
.ci-img { width: 50px; height: 50px; background: #eef3fb; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.ci-img img { max-width: 100%; max-height: 100%; }
.ci-info { flex: 1; }
.ci-name { font-weight: 600; font-size: 0.9rem; }
.ci-price { color: var(--danger); font-size: 0.85rem; }
.qty-ctrl { display: flex; align-items: center; gap: 0.4rem; }
.qty-ctrl button { width: 26px; height: 26px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; }
.ci-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.1rem; }
.cart-footer { padding: 1rem; border-top: 1px solid var(--border); }
.cart-total { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; margin-bottom: 0.8rem; }
.cart-empty { text-align: center; color: var(--muted); padding: 2rem; }

/* ===== Checkout page ===== */
.checkout-wrap { max-width: 1000px; margin: 0 auto; padding: 2rem; }
.checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.checkout-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.checkout-card h3 { margin-bottom: 1rem; color: var(--primary); display: flex; align-items: center; gap: 0.5rem; }
.ck-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.ck-form .full { grid-column: 1 / -1; }
.ck-form label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.25rem; font-weight: 600; }
.ck-form input, .ck-form select, .ck-form textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-size: 0.9rem;
}
.ck-form input:focus, .ck-form select:focus, .ck-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,71,161,0.12); }

.voucher-box { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.voucher-box input { flex: 1; padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; outline: none; text-transform: uppercase; }
.voucher-box input:focus { border-color: var(--primary); }
.voucher-msg { font-size: 0.85rem; margin-bottom: 1rem; min-height: 1.2em; }
.voucher-msg.ok { color: var(--success); }
.voucher-msg.err { color: var(--danger); }

.order-summary .os-row { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.95rem; }
.order-summary .os-row.total { border-top: 2px solid var(--border); margin-top: 0.5rem; padding-top: 0.8rem; font-size: 1.2rem; font-weight: 800; color: var(--danger); }
.os-items { max-height: 240px; overflow-y: auto; margin-bottom: 0.8rem; border-bottom: 1px dashed var(--border); }
.os-item { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.88rem; }
.os-item .name { flex: 1; }
.os-item .qty { color: var(--muted); margin-right: 0.5rem; }
.discount-ok { color: var(--success); font-weight: 600; }
.user-badge { display: inline-block; background: #e8f5e9; color: var(--success); border: 1px solid #b9e6bd; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 700; margin-left: 0.4rem; }

/* ===== Auth modal ===== */
.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.auth-tabs button { flex: 1; padding: 0.5rem; border: 1px solid var(--border); background: #f4f6fb; border-radius: 8px; cursor: pointer; font-weight: 600; }
.auth-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.auth-form { display: grid; gap: 0.8rem; }
.auth-form label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.auth-form input { width: 100%; padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; outline: none; }
.auth-form input:focus { border-color: var(--primary); }
.auth-msg { font-size: 0.85rem; min-height: 1.2em; }
.auth-msg.err { color: var(--danger); }
.auth-msg.ok { color: var(--success); }
.reg-only { display: none; }

/* ===== Footer ===== */
.site-footer {
  background: var(--primary-dark);
  color: #ccd;
  padding: 1.5rem 2rem;
  text-align: center;
  margin-top: 2rem;
}
.site-footer b { color: #fff; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .search-box { order: 3; max-width: 100%; flex-basis: 100%; }
  .hero h2 { font-size: 1.35rem; }
  .hero p { font-size: 0.92rem; }
  .hero { padding: 1.5rem 1.2rem; }
  .hero .stats { gap: 1rem; margin-top: 1rem; }
  .stat b { font-size: 1.15rem; }
  .stat span { font-size: 0.78rem; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  /* Checkout: single column on small screens */
  .checkout-grid { grid-template-columns: 1fr; gap: 1rem; }
  .checkout-wrap { padding: 1rem; }
  .ck-form { grid-template-columns: 1fr; }

  /* Category: show dropdown, hide off-canvas toggle on mobile */
  .cat-toggle { display: none; }
  .cat-drop-wrap { display: flex; }
  .cat-sidebar { transform: translateX(-240px); box-shadow: none; }
  .cat-sidebar.open { transform: translateX(0); box-shadow: 2px 0 18px rgba(0,0,0,0.2); }
  .cat-scrim.show { display: block; }
  /* Remove the desktop left margin on mobile */
  .hero, .container, .site-footer { margin-left: 0; }
}

@media (max-width: 480px) {
  .site-header { padding: 0.5rem 1rem; }
  .header-top { gap: 0.6rem; }
  .brand h1 { font-size: 1.05rem; }
  .brand small { font-size: 0.62rem; }
  .brand i { font-size: 1.4rem; }
  .site-logo { width: 125px; height: 48px; }
  .icon-btn { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .header-actions { gap: 0.5rem; }
  .hero { padding: 1.5rem 1rem; }
  .hero p { font-size: 0.95rem; }
  .hero .stats { gap: 1rem; }
  .cart-drawer { width: 100%; max-width: 100vw; right: -100vw; }
  .banner-slider { height: 100px; }
}



