/* ===== เหมียวช้อป — สไตล์ร่วม ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --orange: #F2803B; --orange-dark: #D96524; --cream: #FFF6EC;
  --brown: #5C4033; --green: #2E8B6E; --red: #E05B4C;
}
body { font-family: 'Segoe UI', 'Leelawadee UI', Tahoma, sans-serif; background: var(--cream); color: var(--brown); min-height: 100vh; }

header {
  background: linear-gradient(135deg, var(--orange), #F5A96B);
  color: #fff; padding: 18px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 12px rgba(0,0,0,.12);
}
header .logo { font-size: 1.5rem; font-weight: 700; cursor: pointer; }
header .tagline { font-size: .8rem; opacity: .9; }
.btn {
  border: none; border-radius: 12px; padding: 10px 18px; font-size: 1rem; cursor: pointer;
  font-family: inherit; transition: .15s; font-weight: 600;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(1.1); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: #fff; color: var(--brown); border: 2px solid var(--orange); }
.btn-small { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px 16px 90px; }
.hero { text-align: center; padding: 22px 10px 10px; }
.hero h1 { font-size: 1.7rem; margin-bottom: 6px; }
.hero p { color: #8a6d55; }

/* กริดสินค้า */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 20px; }
.card {
  background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 3px 12px rgba(92,64,51,.1);
  display: flex; flex-direction: column; transition: .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(92,64,51,.16); }
.card img { width: 100%; height: 200px; object-fit: cover; background: #f3ece3; display: block; }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-name { font-weight: 700; font-size: 1.02rem; }
.card-desc { font-size: .85rem; color: #97785f; flex: 1; }
.card-price { color: var(--orange-dark); font-weight: 800; font-size: 1.15rem; }
.empty-note { text-align: center; color: #a58a72; padding: 60px 0; font-size: 1.1rem; }

/* ปุ่มตะกร้าลอย */
.cart-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  background: var(--orange); color: #fff; border: none; border-radius: 50px;
  padding: 14px 22px; font-size: 1.05rem; font-weight: 700; cursor: pointer; font-family: inherit;
  box-shadow: 0 6px 18px rgba(217,101,36,.45); display: flex; align-items: center; gap: 8px;
}
.cart-fab:hover { background: var(--orange-dark); }
.cart-badge {
  background: #fff; color: var(--orange-dark); border-radius: 20px; padding: 1px 9px; font-size: .85rem;
}

/* โมดัล */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(60,40,25,.5); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 18px; max-width: 520px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 22px;
}
.modal h2 { margin-bottom: 14px; font-size: 1.25rem; }
.modal-close { float: right; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #a58a72; }

/* ตะกร้า */
.cart-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #ecd9c3; }
.cart-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.cart-item .info { flex: 1; }
.cart-item .info .n { font-weight: 600; font-size: .95rem; }
.cart-item .info .p { color: var(--orange-dark); font-size: .85rem; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid #e5c9ab; background: var(--cream);
  cursor: pointer; font-size: 1rem; font-weight: 700; color: var(--brown);
}
.cart-total-row { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.15rem; padding: 14px 0 4px; }

.ship-note {
  display: inline-block; background: #fff; border: 2px dashed #f2b98a; color: var(--orange-dark);
  padding: 8px 18px; border-radius: 30px; margin-top: 10px; font-size: .92rem; font-weight: 600;
}

/* หน้าชำระเงิน */
.pay-detail {
  background: var(--cream); border: 2px dashed #ecd9c3; border-radius: 12px;
  padding: 14px; margin: 12px 0; font-size: .95rem; line-height: 1.8;
}
.pay-detail .bank-name { font-weight: 700; }
.pay-detail .acc-num { font-size: 1.2rem; font-weight: 800; letter-spacing: 1px; color: var(--orange-dark); }
.pay-detail .pay-empty { color: #97785f; font-style: italic; }

/* ฟอร์ม */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 2px solid #ecd9c3; border-radius: 10px;
  font-family: inherit; font-size: .95rem; background: #fffdf9; color: var(--brown);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--orange); }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.form-actions .btn { flex: 1; }

/* แจ้งเตือน */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--green); color: #fff; padding: 12px 24px; border-radius: 12px;
  font-weight: 600; z-index: 200; opacity: 0; transition: .25s; pointer-events: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

/* ติดตามคำสั่งซื้อ */
.track-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.track-steps { display: flex; margin: 16px 0 10px; }
.track-step { flex: 1; text-align: center; position: relative; }
.track-step:not(:last-child)::after {
  content: ''; position: absolute; top: 18px; left: calc(50% + 20px); width: calc(100% - 40px);
  height: 3px; background: #ecd9c3; border-radius: 2px;
}
.track-step.done:not(:last-child)::after { background: var(--green); }
.track-step .dot {
  width: 38px; height: 38px; margin: 0 auto 5px; border-radius: 50%; background: #efe3d3;
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
  filter: grayscale(1); opacity: .5; position: relative; z-index: 1;
}
.track-step.current .dot { background: var(--orange); opacity: 1; filter: none; box-shadow: 0 0 0 4px #fbe0cc; }
.track-step.done .dot { background: var(--green); opacity: 1; filter: none; }
.track-step .lbl { font-size: .68rem; color: #9a8871; font-weight: 600; }
.track-step.current .lbl { color: var(--orange-dark); }
.track-step.done .lbl { color: var(--green); }
.track-tracking {
  background: #e9f4fb; border: 2px dashed #a9cfe4; color: #1c5a80;
  padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-size: .95rem; line-height: 1.7;
}
.track-link { color: #1c6ea4; font-weight: 700; text-decoration: none; font-size: .85rem; white-space: nowrap; }
.track-link:hover { text-decoration: underline; }
.track-cancel { background: #fdeae7; color: var(--red); padding: 12px; border-radius: 10px; text-align: center; font-weight: 700; margin: 10px 0; }
.track-note { font-size: .85rem; color: #97785f; background: var(--cream); padding: 8px 12px; border-radius: 8px; margin-top: 10px; }

/* ===== หลังบ้าน ===== */
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 60px; }
.login-box {
  max-width: 380px; margin: 60px auto; background: #fff; padding: 30px; border-radius: 18px;
  box-shadow: 0 4px 20px rgba(92,64,51,.15); text-align: center;
}
.login-box input { width: 100%; margin: 14px 0; padding: 12px; border: 2px solid #ecd9c3; border-radius: 10px; font-size: 1rem; }
.tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.tabs button {
  flex: 1; padding: 12px; border: 2px solid var(--orange); background: #fff; color: var(--orange-dark);
  border-radius: 12px; font-size: 1rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.tabs button.active { background: var(--orange); color: #fff; }
.panel { display: none; }
.panel.active { display: block; }
.admin-form { background: #fff; padding: 20px; border-radius: 16px; box-shadow: 0 3px 12px rgba(92,64,51,.1); margin-bottom: 24px; }
.admin-form h3 { margin-bottom: 12px; }
.img-preview {
  width: 100%; max-height: 180px; object-fit: contain; border-radius: 10px; background: #f3ece3;
  display: none; margin-bottom: 10px;
}
.admin-list-item {
  background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px;
  display: flex; gap: 14px; align-items: center; box-shadow: 0 2px 8px rgba(92,64,51,.08);
}
.admin-list-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #f3ece3; }
.admin-list-item .grow { flex: 1; }
.admin-list-item .t { font-weight: 700; }
.admin-list-item .s { font-size: .85rem; color: #97785f; }

/* การ์ดออเดอร์ */
.order-card { background: #fff; border-radius: 16px; padding: 18px; margin-bottom: 16px; box-shadow: 0 3px 12px rgba(92,64,51,.1); }
.day-header {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--orange), #F5A96B); color: #fff;
  padding: 10px 18px; border-radius: 12px; margin: 22px 0 12px; font-weight: 700;
  box-shadow: 0 3px 10px rgba(217,101,36,.25);
}
.panel .day-header:first-child { margin-top: 0; }
.order-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.order-id { font-weight: 800; }
.order-status {
  padding: 4px 14px; border-radius: 20px; font-size: .85rem; font-weight: 700; color: #fff;
}
.status-new { background: var(--orange); }
.status-confirmed { background: #3B7DD8; }
.status-shipped { background: var(--green); }
.status-done { background: #7a7a7a; }
.status-cancelled { background: var(--red); }
.pay-badge { padding: 4px 12px; border-radius: 20px; font-size: .85rem; font-weight: 700; color: #fff; }
.paystatus-waiting { background: #E8A93B; }
.paystatus-paid { background: var(--green); }
.paystatus-unpaid { background: var(--red); }
.slip-thumb {
  max-width: 130px; max-height: 130px; object-fit: cover; border-radius: 10px;
  cursor: zoom-in; border: 2px solid #ecd9c3; background: #f3ece3;
}
.order-customer { background: var(--cream); border-radius: 10px; padding: 10px 14px; font-size: .92rem; margin-bottom: 10px; }
.order-items-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.order-items-table td, .order-items-table th { padding: 6px 8px; border-bottom: 1px dashed #ecd9c3; text-align: left; }
.order-items-table .r { text-align: right; }
.order-total { text-align: right; font-weight: 800; font-size: 1.05rem; padding-top: 10px; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card img { height: 140px; }
  header .tagline { display: none; }
}
