/* =====================================================================
   UbonShop — Stylesheet
   แนวคิด: ตลาดท้องถิ่นอีสานร่วมสมัย (warm terracotta + olive + cream)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@400;500;600;700&family=Mitr:wght@500;600;700&display=swap');

:root {
  --clay:        #c0492b;   /* ส้มอิฐ - สีหลัก */
  --clay-dark:   #9a3620;
  --olive:       #5a6e3a;   /* เขียวมะกอก - accent */
  --olive-dark:  #3f4f28;
  --gold:        #d8a23a;   /* ทอง - highlight */
  --cream:       #f7f1e6;   /* ครีม - พื้นหลัง */
  --cream-2:     #efe6d4;
  --ink:         #2c241d;   /* น้ำตาลเข้ม - ตัวอักษร */
  --ink-soft:    #6b5d4f;
  --line:        #e2d6c0;
  --white:       #fffdf9;
  --ok:          #3f7d52;
  --danger:      #b3402a;

  --radius:   14px;
  --radius-s: 9px;
  --shadow:   0 6px 22px rgba(80, 50, 20, 0.10);
  --shadow-lg:0 14px 40px rgba(80, 50, 20, 0.16);
  --maxw: 1180px;

  --font-head: 'Mitr', sans-serif;
  --font-body: 'Bai Jamjuree', sans-serif;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(216,162,58,0.07), transparent 38%),
    radial-gradient(circle at 88% 0%, rgba(90,110,58,0.07), transparent 40%);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--clay); text-decoration: none; transition: color .15s; }
a:hover { color: var(--clay-dark); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { font-family: var(--font-head); color: var(--ink); line-height: 1.25; font-weight: 600; }

/* ---------------- Top bar ---------------- */
.topbar {
  background: var(--olive-dark);
  color: #e9ecd9;
  font-size: 13px;
  padding: 7px 0;
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topbar a { color: #f0e8d2; }

/* ---------------- Header ---------------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 0 rgba(192,73,43,0.06);
}
.site-header .container {
  display: flex; align-items: center; gap: 24px;
  padding-top: 14px; padding-bottom: 14px;
}
.logo {
  font-family: var(--font-head);
  font-weight: 700; font-size: 26px;
  color: var(--clay); display: flex; align-items: center; gap: 9px;
  white-space: nowrap;
}
.logo .mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--clay), var(--gold));
  display: grid; place-items: center; color: #fff; font-size: 20px;
  box-shadow: 0 4px 12px rgba(192,73,43,0.35);
}
.logo small { display: block; font-family: var(--font-body); font-size: 11px; color: var(--ink-soft); font-weight: 500; margin-top: -3px; }

.search-bar { flex: 1; display: flex; max-width: 520px; }
.search-bar input {
  flex: 1; border: 1.5px solid var(--line); border-right: none;
  border-radius: var(--radius-s) 0 0 var(--radius-s);
  padding: 11px 16px; font-family: var(--font-body); font-size: 14px;
  background: var(--cream); color: var(--ink); outline: none;
}
.search-bar input:focus { border-color: var(--clay); background: #fff; }
.search-bar button {
  border: none; background: var(--clay); color: #fff;
  padding: 0 20px; border-radius: 0 var(--radius-s) var(--radius-s) 0;
  cursor: pointer; font-size: 16px;
}
.search-bar button:hover { background: var(--clay-dark); }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: var(--radius-s);
  border: 1.5px solid transparent; cursor: pointer; transition: all .16s;
  white-space: nowrap;
}
.btn-primary { background: var(--clay); color: #fff; }
.btn-primary:hover { background: var(--clay-dark); color: #fff; transform: translateY(-1px); }
.btn-olive { background: var(--olive); color: #fff; }
.btn-olive:hover { background: var(--olive-dark); color:#fff; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--clay); color: var(--clay); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--clay) 0%, var(--clay-dark) 100%);
  color: #fff7ec; padding: 64px 0 72px;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 22px);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 2; }
.hero h1 { color: #fff; font-size: clamp(30px, 5vw, 50px); max-width: 660px; }
.hero p { font-size: 17px; max-width: 540px; margin-top: 14px; color: #ffe9d2; }
.hero-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.5); }
.hero .btn-ghost:hover { background: rgba(255,255,255,0.12); color:#fff; }
.hero-badge {
  display: inline-block; background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3); color: #fff;
  padding: 5px 14px; border-radius: 30px; font-size: 13px; font-weight: 600;
  margin-bottom: 18px;
}

/* ---------------- Section ---------------- */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 26px; position: relative; padding-left: 16px; }
.section-head h2::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 5px;
  background: var(--gold); border-radius: 4px;
}
.section-head .more { font-weight: 600; font-size: 14px; }

/* ---------------- Category chips ---------------- */
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px;
}
.cat-card {
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 22px 14px; text-align: center; transition: all .18s; color: var(--ink);
}
.cat-card:hover { border-color: var(--clay); transform: translateY(-3px); box-shadow: var(--shadow); color: var(--ink); }
.cat-card .ico {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px;
  background: var(--cream-2); display: grid; place-items: center; font-size: 26px;
}
.cat-card span { font-weight: 600; font-size: 14px; }

/* ---------------- Product grid ---------------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.product-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: all .18s; display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(192,73,43,0.3); }
.product-thumb {
  aspect-ratio: 1/1; background: var(--cream-2); position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .ph { font-size: 46px; opacity: .35; }
.product-badge {
  position: absolute; top: 10px; left: 10px; background: var(--clay); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.product-body { padding: 14px; display: flex; flex-direction: column; flex: 1; }
.product-shop { font-size: 12px; color: var(--olive); font-weight: 600; margin-bottom: 4px; }
.product-name { font-size: 14.5px; font-weight: 600; color: var(--ink); margin-bottom: 8px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.product-price { margin-top: auto; display: flex; align-items: baseline; gap: 8px; }
.product-price .now { font-family: var(--font-head); font-size: 19px; color: var(--clay); font-weight: 700; }
.product-price .was { font-size: 13px; color: var(--ink-soft); text-decoration: line-through; }

/* ---------------- Shop card ---------------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.shop-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: all .18s;
}
.shop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.shop-cover { height: 90px; background: linear-gradient(120deg, var(--olive), var(--olive-dark)); position: relative; }
.shop-card-body { padding: 16px; padding-top: 34px; position: relative; }
.shop-logo {
  width: 56px; height: 56px; border-radius: 14px; background: var(--cream-2);
  border: 3px solid var(--white); position: absolute; top: -28px; left: 16px;
  display: grid; place-items: center; font-size: 24px; color: var(--clay);
  font-family: var(--font-head); font-weight: 700; overflow: hidden;
}
.shop-logo img { width: 100%; height: 100%; object-fit: cover; }
.shop-card h3 { font-size: 17px; }
.shop-meta { font-size: 13px; color: var(--ink-soft); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.shop-meta .tag { background: var(--cream-2); padding: 2px 10px; border-radius: 20px; font-weight: 600; color: var(--olive-dark); }

/* ---------------- Forms / Auth ---------------- */
.auth-wrap { min-height: 70vh; display: grid; place-items: center; padding: 40px 20px; }
.auth-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; padding: 36px 34px;
}
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 26px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--ink); }
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-s);
  font-family: var(--font-body); font-size: 14.5px; background: var(--cream); color: var(--ink);
  outline: none; transition: border-color .15s, background .15s;
}
.form-control:focus { border-color: var(--clay); background: #fff; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-foot { text-align: center; margin-top: 22px; font-size: 14px; color: var(--ink-soft); }
.role-toggle { display: flex; gap: 10px; margin-bottom: 22px; }
.role-toggle label {
  flex: 1; border: 1.5px solid var(--line); border-radius: var(--radius-s);
  padding: 12px; text-align: center; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: all .15s; background: var(--cream);
}
.role-toggle input { display: none; }
.role-toggle input:checked + label,
.role-toggle label:has(input:checked) { border-color: var(--clay); background: #fff; color: var(--clay); box-shadow: 0 0 0 3px rgba(192,73,43,0.12); }

/* ---------------- Flash ---------------- */
.flash-zone { margin: 16px auto; max-width: var(--maxw); padding: 0 20px; }
.flash { padding: 12px 18px; border-radius: var(--radius-s); margin-bottom: 10px; font-weight: 500; font-size: 14px; border: 1px solid; }
.flash-success { background: #e8f3ea; color: var(--ok); border-color: #b9dcc2; }
.flash-error { background: #fae9e4; color: var(--danger); border-color: #f0c4b8; }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--ink); color: #d8ccba; margin-top: 50px; padding: 44px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer h4 { font-family: var(--font-head); color: #fff; margin-bottom: 14px; font-size: 16px; }
.site-footer a { color: #c9bba7; display: block; padding: 3px 0; font-size: 14px; }
.site-footer a:hover { color: var(--gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); margin-top: 30px; padding-top: 18px; text-align: center; font-size: 13px; color: #9c8d79; }

/* ---------------- Breadcrumb ---------------- */
.breadcrumb { padding: 16px 0; font-size: 13.5px; color: var(--ink-soft); }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--clay); }

/* ---------------- Empty state ---------------- */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty .ico { font-size: 50px; opacity: .4; margin-bottom: 12px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .site-header .container { flex-wrap: wrap; }
  .search-bar { order: 3; max-width: 100%; width: 100%; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .header-actions .btn span { display: none; }
}
