:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --white: #ffffff;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans Thai', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4rem; }

.container { width: min(1140px, 92%); margin: 0 auto; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  border-radius: 10px;
  padding: .65rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, background .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: .85rem 1.8rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: .6rem; }

/* ---------- Top announcement bar ---------- */
.topbar {
  background: var(--brand-dark);
  color: #fff;
  font-size: .9rem;
  text-align: center;
  padding: .5rem 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .9rem 0; }
.brand-logo { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.brand-logo img { height: 38px; width: auto; border-radius: 8px; }
.logo-dot { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: inline-block; }
.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a { color: var(--ink); font-weight: 500; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    linear-gradient(120deg, rgba(79, 70, 229, .92), rgba(67, 56, 202, .85)),
    var(--hero, linear-gradient(120deg, #6366f1, #4338ca));
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 5rem 0;
}
.hero-text { max-width: 620px; }
.hero .eyebrow {
  display: inline-block; background: rgba(255,255,255,.18);
  padding: .25rem .8rem; border-radius: 999px; font-size: .85rem; margin-bottom: 1rem;
}
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); }
.hero p { font-size: 1.1rem; opacity: .92; margin-bottom: 1.6rem; }
.hero .btn-primary { background: #fff; color: var(--brand-dark); }
.hero .btn-primary:hover { background: #f1f5f9; }

/* ---------- Sections ---------- */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--white); }
.section-head { text-align: center; margin-bottom: 2rem; }
.section-head h2 { font-size: 1.8rem; }

/* ---------- Brand strip ---------- */
.brand-strip { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.brand-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--white); border: 1px solid var(--line);
  padding: .5rem 1rem; border-radius: 999px; color: var(--ink); font-weight: 500;
}
.brand-chip img { height: 22px; width: auto; }
.brand-chip.active, .brand-chip:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.4rem;
}
.product-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-thumb { position: relative; aspect-ratio: 4 / 3; background: #f1f5f9; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 3rem; opacity: .4; }
.badge-featured {
  position: absolute; top: .6rem; left: .6rem;
  background: #f59e0b; color: #fff; font-size: .72rem; font-weight: 600;
  padding: .2rem .55rem; border-radius: 6px;
}
.product-body { padding: 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product-brand { font-size: .78rem; color: var(--brand); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.product-body h3 { font-size: 1.05rem; }
.product-desc { color: var(--muted); font-size: .9rem; flex: 1; }
.product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .6rem; }
.price { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.empty-state { text-align: center; color: var(--muted); padding: 3rem 0; }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: .9rem; }
.form-stack label { display: flex; flex-direction: column; gap: .35rem; font-weight: 500; font-size: .92rem; }
.form-stack label.check { flex-direction: row; align-items: center; gap: .45rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.form-row > label { flex: 1; min-width: 120px; }
input, select, textarea {
  font: inherit; padding: .6rem .75rem; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); width: 100%;
}
input[type=checkbox] { width: auto; }
input[type=color] { padding: .2rem; height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.preview { margin-top: .5rem; height: 70px; width: auto; border-radius: 8px; border: 1px solid var(--line); }
.preview-wide { height: 110px; }

/* ---------- Alerts ---------- */
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-success { background: #dcfce7; color: #15803d; }

/* ---------- Login ---------- */
.login-page { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { background: #fff; padding: 2.2rem; border-radius: var(--radius); box-shadow: var(--shadow); width: min(400px, 100%); }
.login-card h1 { font-size: 1.5rem; }
.login-hint { text-align: center; font-size: .85rem; margin-top: 1rem; }
.back-link { display: block; text-align: center; margin-top: 1rem; }

/* ---------- Footer ---------- */
.site-footer { background: #0f172a; color: #cbd5e1; margin-top: 3rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding: 2.5rem 0 1.5rem; }
.footer-brand strong { color: #fff; font-size: 1.2rem; }
.footer-contact { display: flex; flex-direction: column; gap: .3rem; text-align: right; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
  border-top: 1px solid rgba(255,255,255,.1); padding: 1rem 0; font-size: .85rem;
}
.footer-admin { color: #94a3b8; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal-card {
  position: relative; background: #fff; width: min(460px, 92%);
  margin: 6vh auto; padding: 1.8rem; border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 86vh; overflow: auto;
}
.modal-close {
  position: absolute; top: .8rem; right: 1rem; background: none; border: 0;
  font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted);
}

/* ---------- LINE floating button ---------- */
.line-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #06c755;
  color: #fff;
  font-weight: 700;
  padding: .7rem 1.1rem;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(6, 199, 85, .4);
  transition: transform .12s, box-shadow .2s;
}
.line-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(6, 199, 85, .5); }
.line-fab-icon {
  background: #fff;
  color: #06c755;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  padding: .15rem .4rem;
  border-radius: 6px;
}

@media (max-width: 640px) {
  .site-nav { gap: .8rem; font-size: .9rem; }
  .footer-contact { text-align: left; }
  .line-fab-text { display: none; }
  .line-fab { padding: .8rem; }
}
