:root {
  --bg: #0b0f1a;
  --bg-alt: #10162b;
  --card: #161d33;
  --card-hover: #1b2340;
  --border: #232c4d;
  --text: #e8ecf8;
  --muted: #9aa3c0;
  --accent: #6c5ce7;
  --accent-2: #fd79a8;
  --green: #00b894;
  --orange: #fdcb6e;
  --red: #ff6b6b;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
  --font: 'Inter', 'Noto Sans Thai', sans-serif;
}

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

/* Hidden attribute must always win over any CSS display rule */
[hidden] { display:none !important; }

html { scroll-behavior:smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108,92,231,.18), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, rgba(253,121,168,.10), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height:1.6;
  min-height:100vh;
}

a { color:inherit; text-decoration:none; }
img { max-width:100%; display:block; }

.container { width:min(1120px, 92%); margin:0 auto; }

/* ===== Header ===== */
.site-header {
  position: sticky; top:0; z-index:50;
  background: rgba(11,15,26,.85);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
.header-inner {
  display:flex; align-items:center; justify-content:space-between;
  height:68px;
}
.brand { display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.2rem; }
.brand-logo { font-size:1.4rem; }
.main-nav { display:flex; gap:28px; }
.main-nav a { color:var(--muted); font-weight:500; transition:color .2s; }
.main-nav a:hover { color:var(--text); }
.header-actions { display:flex; align-items:center; gap:14px; }
.lang-btn {
  background:transparent; color:var(--text);
  border:1px solid var(--border); border-radius:10px;
  padding:6px 14px; cursor:pointer; font-weight:700; font-family:inherit;
  transition:all .2s;
}
.lang-btn:hover { border-color:var(--accent); background:rgba(108,92,231,.15); }
.cart-btn {
  position:relative; background:var(--card); color:var(--text);
  border:1px solid var(--border); border-radius:12px;
  width:46px; height:46px; display:grid; place-items:center; cursor:pointer;
  transition:all .2s;
}
.cart-btn:hover { border-color:var(--accent); }
.cart-count {
  position:absolute; top:-6px; right:-6px;
  background:var(--accent); color:#fff; font-size:.7rem; font-weight:700;
  min-width:19px; height:19px; border-radius:50%; display:grid; place-items:center;
  padding:0 4px;
}

/* ===== Buttons ===== */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:none; cursor:pointer; font-family:inherit; font-weight:700;
  border-radius:12px; padding:13px 26px; font-size:1rem;
  transition:all .2s;
}
.btn-primary { background:linear-gradient(135deg, var(--accent), #8b5cf6); color:#fff; box-shadow:0 6px 20px rgba(108,92,231,.35); }
.btn-primary:hover { transform:translateY(-2px); box-shadow:0 10px 26px rgba(108,92,231,.45); }
.btn-ghost { background:transparent; color:var(--text); border:1px solid var(--border); }
.btn-ghost:hover { border-color:var(--accent); }
.btn-outline { background:transparent; color:var(--text); border:1px solid var(--border); }
.btn-outline:hover { border-color:var(--accent); }
.btn-block { width:100%; }

/* ===== Hero ===== */
.hero { padding:70px 0 90px; }
.hero-inner { display:grid; grid-template-columns:1.1fr .9fr; gap:40px; align-items:center; }
.hero-badge {
  display:inline-block; background:rgba(253,203,110,.12); color:var(--orange);
  border:1px solid rgba(253,203,110,.3); border-radius:999px;
  padding:6px 16px; font-weight:600; font-size:.85rem; margin-bottom:20px;
}
.hero-title { font-size:clamp(2rem, 5vw, 3.2rem); font-weight:800; line-height:1.2; margin-bottom:18px; }
.hero-sub { color:var(--muted); font-size:1.1rem; margin-bottom:30px; max-width:560px; }
.hero-cta { display:flex; gap:14px; flex-wrap:wrap; margin-bottom:34px; }
.hero-trust { display:flex; gap:22px; flex-wrap:wrap; color:var(--muted); font-size:.92rem; }

.hero-art { position:relative; height:320px; }
.hero-card-proxy {
  position:absolute; inset:0; margin:auto; width:180px; height:180px;
  background:var(--card); border:1px solid var(--border); border-radius:30px;
  display:grid; place-items:center; font-size:4rem;
  box-shadow:var(--shadow); z-index:2;
}
.orb { position:absolute; border-radius:50%; filter:blur(60px); opacity:.5; }
.orb1 { width:220px; height:220px; background:var(--accent); top:10px; right:0; }
.orb2 { width:180px; height:180px; background:var(--accent-2); bottom:0; left:20px; }

/* ===== Sections ===== */
.section { padding:70px 0; }
.section-alt { background:var(--bg-alt); border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.section-head { text-align:center; margin-bottom:44px; }
.section-title { font-size:clamp(1.6rem, 3vw, 2.2rem); font-weight:800; margin-bottom:8px; }
.section-sub { color:var(--muted); }

/* ===== Filter tabs ===== */
.filter-tabs { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; margin-bottom:36px; }
.filter-tab {
  background:var(--card); color:var(--muted); border:1px solid var(--border);
  border-radius:999px; padding:9px 22px; cursor:pointer; font-weight:600;
  font-family:inherit; transition:all .2s;
}
.filter-tab:hover { color:var(--text); }
.filter-tab.active {
  background:linear-gradient(135deg, var(--accent), #8b5cf6); color:#fff; border-color:transparent;
}

/* ===== Product Grid ===== */
.product-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:24px;
}
.product-card {
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:0; position:relative; overflow:hidden; transition:all .25s;
  display:flex; flex-direction:column;
}
.product-card:hover { transform:translateY(-4px); border-color:var(--accent); background:var(--card-hover); }
.product-card-body { padding:26px; display:flex; flex-direction:column; flex:1; }
.product-badge {
  position:absolute; top:14px; right:14px; z-index:2;
  background:linear-gradient(135deg, var(--red), var(--orange)); color:#fff;
  font-size:.72rem; font-weight:800; padding:4px 10px; border-radius:999px;
}
.product-badge-new {
  position:absolute; top:14px; left:14px; z-index:2;
  background:linear-gradient(135deg, var(--green), #00cec9); color:#fff;
  font-size:.72rem; font-weight:800; padding:4px 10px; border-radius:999px;
}
.product-card-img {
  width:100%; aspect-ratio:4/3; object-fit:cover; display:block;
}
.product-icon { font-size:2.4rem; margin-bottom:14px; padding:26px 26px 0; }
.product-cat { font-size:.75rem; text-transform:uppercase; letter-spacing:1px; color:var(--accent); font-weight:700; }
.product-name { font-size:1.2rem; font-weight:700; margin:6px 0 8px; }
.product-desc { color:var(--muted); font-size:.9rem; flex-grow:1; margin-bottom:16px; }
.product-features { list-style:none; margin-bottom:18px; display:grid; gap:6px; }
.product-features li { color:var(--muted); font-size:.88rem; display:flex; gap:8px; }
.product-features li::before { content:"✓"; color:var(--green); font-weight:700; }
.product-price { display:flex; align-items:baseline; gap:8px; margin-bottom:18px; }
.price-now { font-size:1.7rem; font-weight:800; }
.price-old { color:var(--muted); text-decoration:line-through; font-size:.95rem; }
.price-per { color:var(--muted); font-size:.8rem; }
.add-btn { margin-top:auto; }

/* ===== Product action buttons (details + add) ===== */
.product-actions { display:grid; grid-template-columns:1fr 1.4fr; gap:10px; margin-top:auto; }
.product-actions .btn { padding:12px 14px; font-size:.92rem; }

/* ===== Steps ===== */
.steps { display:grid; grid-template-columns:repeat(3, 1fr); gap:24px; }
.step {
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:30px; text-align:center;
}
.step-num {
  width:52px; height:52px; margin:0 auto 16px; border-radius:50%;
  background:linear-gradient(135deg, var(--accent), #8b5cf6); color:#fff;
  display:grid; place-items:center; font-size:1.3rem; font-weight:800;
}
.step h3 { margin-bottom:8px; font-size:1.1rem; }
.step p { color:var(--muted); font-size:.9rem; }

/* ===== FAQ ===== */
.faq-list { max-width:720px; margin:0 auto; display:grid; gap:14px; }
.faq-item {
  background:var(--card); border:1px solid var(--border); border-radius:12px; padding:0 20px;
}
.faq-item summary {
  cursor:pointer; font-weight:600; padding:16px 0; list-style:none;
  display:flex; justify-content:space-between; align-items:center;
}
.faq-item summary::-webkit-details-marker { display:none; }
.faq-item summary::after { content:"+"; color:var(--accent); font-size:1.4rem; }
.faq-item[open] summary::after { content:"−"; }
.faq-item p { color:var(--muted); padding-bottom:18px; font-size:.92rem; }

/* ===== Footer ===== */
.site-footer { background:var(--bg-alt); border-top:1px solid var(--border); padding:46px 0; }
.footer-inner { display:grid; gap:18px; text-align:center; }
.footer-brand .brand-name { font-weight:800; font-size:1.2rem; }
.footer-brand p, .footer-contact { color:var(--muted); font-size:.9rem; }
.footer-contact { display:flex; gap:20px; justify-content:center; flex-wrap:wrap; }
.footer-copy { color:var(--muted); font-size:.8rem; }

/* ===== Cart Drawer ===== */
.drawer-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:60; backdrop-filter:blur(2px);
}
.cart-drawer {
  position:fixed; top:0; right:0; height:100%; width:min(400px, 92vw);
  background:var(--bg-alt); border-left:1px solid var(--border);
  z-index:70; display:flex; flex-direction:column; transform:translateX(100%); transition:transform .3s;
}
.cart-drawer.open { transform:translateX(0); }
.drawer-head {
  display:flex; justify-content:space-between; align-items:center;
  padding:22px 24px; border-bottom:1px solid var(--border);
}
.drawer-close, .modal-close {
  background:transparent; color:var(--text); border:none; font-size:1.4rem; cursor:pointer;
}
.drawer-body { flex-grow:1; overflow-y:auto; padding:20px 24px; }
.cart-items { display:grid; gap:14px; }
.cart-item {
  display:flex; gap:14px; background:var(--card); border:1px solid var(--border);
  border-radius:12px; padding:14px; align-items:center;
}
.cart-item-icon { font-size:1.8rem; }
.cart-item-info { flex-grow:1; }
.cart-item-name { font-weight:600; font-size:.95rem; }
.cart-item-price-sm { color:var(--muted); font-size:.8rem; margin:2px 0 6px; }
.qty-stepper {
  display:inline-flex; align-items:center; gap:2px;
  background:var(--bg); border:1px solid var(--border); border-radius:8px; overflow:hidden;
}
.qty-btn {
  background:transparent; color:var(--text); border:none; cursor:pointer;
  width:28px; height:26px; font-size:1.1rem; line-height:1; transition:background .2s;
}
.qty-btn:hover { background:rgba(108,92,231,.18); }
.qty-val { min-width:26px; text-align:center; font-weight:700; }
.cart-item-qty { color:var(--muted); font-size:.82rem; }
.cart-item-price { font-weight:700; }
.cart-item-remove { background:transparent; border:none; color:var(--muted); cursor:pointer; font-size:1.1rem; }
.cart-item-remove:hover { color:var(--red); }
.cart-empty { color:var(--muted); text-align:center; padding:40px 0; }
.drawer-foot { padding:20px 24px; border-top:1px solid var(--border); }
.cart-total-line {
  display:flex; justify-content:space-between; font-weight:700; font-size:1.15rem; margin-bottom:16px;
}

/* ===== Modal ===== */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.7); z-index:80;
  display:grid; place-items:center; padding:20px;
}
.modal {
  background:var(--bg-alt); border:1px solid var(--border); border-radius:20px;
  width:min(430px, 100%); padding:30px; position:relative; max-height:90vh; overflow-y:auto;
}
.modal-close { position:absolute; top:16px; right:16px; }
.modal-title { text-align:center; margin-bottom:22px; font-size:1.4rem; }
.pay-info { background:var(--card); border:1px solid var(--border); border-radius:12px; padding:16px; margin-bottom:20px; }
.pay-info p { display:flex; justify-content:space-between; color:var(--muted); }
.pay-info strong { color:var(--text); }
.qr-wrap {
  background:#fff; border-radius:16px; padding:16px; width:min(240px, 80%);
  margin:0 auto 18px; box-shadow:var(--shadow);
}
.qr-wrap img { width:100%; border-radius:8px; }
.qr-note { text-align:center; color:var(--muted); font-size:.9rem; margin-bottom:20px; }
.pay-actions { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.success-icon { font-size:3.6rem; text-align:center; margin-bottom:10px; }
#successView p { text-align:center; color:var(--muted); margin-bottom:24px; }

/* ===== Product detail modal ===== */
.modal-detail { width:min(520px, 100%); }
.detail-head { display:flex; gap:16px; align-items:center; margin-bottom:16px; }
.detail-icon { font-size:2.6rem; background:var(--card); border:1px solid var(--border); border-radius:16px; width:64px; height:64px; display:grid; place-items:center; flex-shrink:0; }
.detail-name { font-size:1.35rem; font-weight:800; margin-bottom:4px; }
.detail-price { display:flex; align-items:baseline; gap:10px; }
.detail-now { font-size:1.5rem; font-weight:800; color:var(--accent); }
.detail-now small { font-size:.8rem; color:var(--muted); font-weight:500; }
.detail-old { color:var(--muted); text-decoration:line-through; font-size:.9rem; }
.detail-desc { color:var(--muted); font-size:.95rem; margin-bottom:18px; }
.detail-sec { font-size:.85rem; text-transform:uppercase; letter-spacing:1px; color:var(--accent); font-weight:700; margin:18px 0 10px; }
.detail-features { margin-bottom:4px; }
.spec-list { background:var(--card); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.spec-row { display:flex; justify-content:space-between; padding:11px 16px; border-bottom:1px solid var(--border); font-size:.9rem; }
.spec-row:last-child { border-bottom:none; }
.spec-label { color:var(--muted); }
.spec-value { font-weight:600; text-align:right; }
.mt-add { margin-top:22px; }

/* ===== Auth modal ===== */
#authModal input[type=text], #authModal input[type=email], #authModal input[type=password] {
  background:var(--bg-alt); border:1px solid var(--border); border-radius:10px;
  padding:12px 14px; color:var(--text); font-family:inherit; width:100%;
  margin-bottom:12px; font-size:.95rem;
}
#authModal input:focus { outline:none; border-color:var(--accent); }
.auth-msg { padding:8px 0; font-size:.85rem; text-align:center; min-height:18px; color:var(--muted); }
.auth-tabs button { font-size:.9rem; }

/* ===== Pagination & Search ===== */
.pagination button{ background:var(--card); color:var(--text); border:1px solid var(--border); border-radius:10px; padding:8px 14px; cursor:pointer; font-family:inherit; font-weight:600; transition:all .2s; min-width:40px; }
.pagination button:hover{ border-color:var(--accent); }
.pagination button.active{ background:linear-gradient(135deg,var(--accent),#8b5cf6); color:#fff; border-color:transparent; }
.pagination button:disabled{ opacity:.4; cursor:not-allowed; }
.search-box input:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(108,92,231,.15); }
#searchInput::placeholder{ color:var(--muted); }

/* ===== Admin helpers ===== */
.admin-search{ background:var(--bg-alt); border:1px solid var(--border); border-radius:10px; padding:10px 14px; color:var(--text); font-family:inherit; width:260px; }
.admin-search:focus{ outline:none; border-color:var(--accent); }
.page-info{ color:var(--muted); font-size:.85rem; }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .hero-inner { grid-template-columns:1fr; }
  .hero-art { height:220px; }
  .main-nav { display:none; }
  .steps { grid-template-columns:1fr; }
  .hero-cta { flex-direction:column; }
  .hero-cta .btn { width:100%; }
}

/* ===== Toast Notifications ===== */
.toast-container{position:fixed;top:20px;right:20px;z-index:9999;display:flex;flex-direction:column;gap:10px;pointer-events:none}
.toast{display:flex;align-items:center;gap:12px;padding:14px 20px;border-radius:12px;background:var(--card);border:1px solid var(--border);box-shadow:0 8px 32px rgba(0,0,0,.4);color:var(--text);font-size:.9rem;min-width:300px;max-width:420px;pointer-events:auto;animation:toastIn .3s ease;opacity:1;transition:opacity .3s,transform .3s}
.toast.out{opacity:0;transform:translateX(100%)}
.toast-icon{font-size:1.2rem;flex-shrink:0;width:28px;text-align:center}
.toast-body{flex:1;line-height:1.4}
.toast-title{font-weight:700;margin-bottom:2px;font-size:.85rem}
.toast-msg{color:var(--muted);font-size:.82rem}
.toast-close{background:none;border:none;color:var(--muted);cursor:pointer;font-size:1rem;padding:0 0 0 8px;flex-shrink:0;transition:color .2s}
.toast-close:hover{color:var(--text)}
.toast.success{border-color:var(--green)}
.toast.success .toast-icon{color:var(--green)}
.toast.error{border-color:var(--red)}
.toast.error .toast-icon{color:var(--red)}
.toast.warning{border-color:var(--orange)}
.toast.warning .toast-icon{color:var(--orange)}
.toast.info{border-color:var(--accent)}
.toast.info .toast-icon{color:var(--accent)}
@keyframes toastIn{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}

/* ===== Confirm Dialog ===== */
.confirm-overlay{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:10000;display:flex;justify-content:center;align-items:center;animation:fadeIn .2s}
.confirm-box{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:28px;max-width:400px;width:90%;box-shadow:0 20px 60px rgba(0,0,0,.5);animation:scaleIn .2s ease}
.confirm-icon{font-size:2.2rem;text-align:center;margin-bottom:12px}
.confirm-title{font-size:1.1rem;font-weight:700;text-align:center;margin-bottom:8px}
.confirm-msg{color:var(--muted);font-size:.9rem;text-align:center;margin-bottom:24px;line-height:1.5}
.confirm-actions{display:flex;gap:10px;justify-content:center}
.confirm-actions .btn{min-width:120px}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes scaleIn{from{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}

/* ===== Loading Spinner ===== */
.spinner{display:inline-block;width:18px;height:18px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .6s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.btn.loading{pointer-events:none;opacity:.7}
.btn.loading::after{content:'';display:inline-block;width:14px;height:14px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .6s linear infinite;margin-left:8px;vertical-align:middle}
