/* ============================================================
   app.css – สไตล์หลักของเว็บ PremiumApp
   ธีม: ขาว-แดง
   แก้สีหลัก: หา --red แล้วเปลี่ยนค่าได้เลย
   แก้ฟอนต์: หา font-family แล้วเปลี่ยนชื่อฟอนต์ได้เลย
   ============================================================ */

/* ---- ตัวแปรสี (แก้ตรงนี้ที่เดียว ทั้งเว็บเปลี่ยนตาม) ---- */
:root {
  --red: #e31b23;           /* สีแดงหลัก */
  --red-hover: #c0141b;     /* สีแดงตอน hover */
  --red-light: #fff5f5;     /* พื้นหลังสีแดงอ่อน */
  --red-border: #ffc0c0;    /* ขอบสีแดงอ่อน */
  --white: #ffffff;
  --bg: #f7f7f7;            /* พื้นหลังทั้งหน้า */
  --gray-100: #f0f0f0;
  --gray-200: #e0e0e0;
  --gray-400: #9e9e9e;
  --gray-600: #555555;
  --gray-800: #1a1a1a;
  --text: #1a1a1a;          /* สีข้อความหลัก */
  --text-sub: #666666;      /* สีข้อความรอง */
  --text-hint: #999999;     /* สีข้อความจาง */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow: 0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 10px;           /* มุมโค้งทั่วไป */
  --radius-lg: 16px;        /* มุมโค้งการ์ด */
  --transition: 0.2s ease;
}

/* ---- รีเซ็ตพื้นฐาน ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Sarabun', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ---- Container ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: var(--white);
  border-bottom: 2px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

/* โลโก้ */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Kanit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-icon {
  background: var(--red);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.brand-red { color: var(--red); }

/* เมนูกลาง */
.navbar-menu {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--text-sub);
  transition: var(--transition);
  font-family: 'Kanit', sans-serif;
  font-weight: 400;
}
.nav-link:hover, .nav-link.active {
  color: var(--red);
  background: var(--red-light);
}

/* ปุ่มด้านขวา */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.btn-cart {
  position: relative;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--gray-100);
  font-size: 18px;
  transition: var(--transition);
}
.btn-cart:hover { background: var(--gray-200); }
.cart-count {
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  font-family: 'Kanit', sans-serif;
}

/* Dropdown ผู้ใช้ */
.dropdown { position: relative; }
.btn-user {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  background: white;
  font-size: 14px;
  font-family: 'Kanit', sans-serif;
  transition: var(--transition);
}
.btn-user:hover { border-color: var(--red); color: var(--red); }
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  overflow: hidden;
  z-index: 200;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a,
.dropdown-menu button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  font-family: 'Sarabun', sans-serif;
  background: none;
  border: none;
  color: var(--text);
  transition: var(--transition);
}
.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: var(--red-light);
  color: var(--red);
}

/* ปุ่ม Hamburger มือถือ */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  margin-left: auto;
}

/* ============================================================
   MOBILE MENU
   ============================================================ */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  font-family: 'Kanit', sans-serif;
  font-size: 15px;
}
.mobile-menu a:hover { background: var(--red-light); color: var(--red); }

/* ============================================================
   BUTTONS (ปุ่มต่างๆ)
   แก้สี: เปลี่ยน var(--red) ได้เลย
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-family: 'Kanit', sans-serif;
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-red {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-red:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn-outline {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-outline:hover { background: var(--red-light); }
.btn-gray {
  background: var(--gray-100);
  color: var(--text);
  border-color: var(--gray-200);
}
.btn-gray:hover { background: var(--gray-200); }
.btn-lg { padding: 14px 32px; font-size: 17px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ============================================================
   ALERT / FLASH MESSAGE
   ============================================================ */
.alert {
  padding: 14px 20px;
  font-size: 15px;
  font-family: 'Sarabun', sans-serif;
  border-left: 4px solid;
}
.alert-success {
  background: #f0fff4;
  border-color: #22c55e;
  color: #166534;
}
.alert-error {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

/* ============================================================
   CARD (กล่องสินค้า)
   ============================================================ */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--gray-100);
}
.card-body { padding: 16px; }
.card-title {
  font-family: 'Kanit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.card-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 10px; }

/* ============================================================
   BADGE / TAG
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
}
.badge-red { background: var(--red); color: white; }
.badge-red-light { background: var(--red-light); color: var(--red); }
.badge-green { background: #f0fff4; color: #166534; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-gold { background: #fffbeb; color: #92400e; }

/* ============================================================
   PRICE (ราคา)
   ============================================================ */
.price {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  color: var(--red);
}
.price-lg { font-size: 28px; }
.price-md { font-size: 20px; }
.price-old {
  font-size: 14px;
  color: var(--text-hint);
  text-decoration: line-through;
  font-weight: 400;
}
.price-discount {
  background: var(--red);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  font-family: 'Kanit', sans-serif;
}

/* ============================================================
   FORM (ฟอร์มกรอกข้อมูล)
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gray-800);
  font-family: 'Kanit', sans-serif;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: 'Sarabun', sans-serif;
  color: var(--text);
  background: white;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227,27,35,0.08);
}
.form-input.error { border-color: var(--red); }
.form-error { font-size: 13px; color: var(--red); margin-top: 4px; }
.form-textarea { min-height: 100px; resize: vertical; }

/* ============================================================
   TABLE (ตาราง)
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  background: var(--gray-100);
  padding: 12px 16px;
  text-align: left;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tr:hover td { background: var(--red-light); }
.table tr:last-child td { border-bottom: none; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 32px 0;
}
.page-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  background: white;
  font-size: 14px;
  font-family: 'Kanit', sans-serif;
  transition: var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

/* ============================================================
   SECTION / PAGE LAYOUT
   ============================================================ */
.section { padding: 60px 0; }
.section-sm { padding: 40px 0; }
.section-title {
  font-family: 'Kanit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.section-title span { color: var(--red); }
.section-sub { color: var(--text-sub); font-size: 16px; margin-bottom: 32px; }
.page-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 28px 0;
  margin-bottom: 32px;
}
.page-header h1 {
  font-family: 'Kanit', sans-serif;
  font-size: 24px;
  font-weight: 700;
}

/* ============================================================
   GRID สินค้า
   ============================================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--gray-800);
  color: #ccc;
  margin-top: 80px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 48px 0 40px;
}
.footer-brand p { font-size: 14px; margin-top: 10px; color: #888; }
.footer-brand .brand-text { color: white; font-family: 'Kanit', sans-serif; font-size: 20px; }
.footer-links h4 {
  font-family: 'Kanit', sans-serif;
  font-size: 15px;
  color: white;
  margin-bottom: 14px;
}
.footer-links a {
  display: block;
  font-size: 14px;
  color: #888;
  margin-bottom: 8px;
  transition: var(--transition);
}
.footer-links a:hover { color: var(--red); }
.footer-bottom {
  border-top: 1px solid #333;
  padding: 16px 0;
  font-size: 13px;
  color: #666;
}

/* ============================================================
   RESPONSIVE – มือถือ
   ============================================================ */
@media (max-width: 768px) {
  .navbar-menu, .navbar-actions { display: none; }
  .navbar-toggle { display: block; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .section { padding: 40px 0; }
  .section-title { font-size: 22px; }
}
@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
}
