/* ============================================================
   DealVoucher.vn — Main Stylesheet
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --primary:       #c8102e;
  --primary-dark:  #a00d25;
  --primary-light: #fde8ec;
  --accent:        #ff6b35;
  --text-dark:     #1a1a2e;
  --text-mid:      #444;
  --text-light:    #888;
  --bg-page:       #f7f7f9;
  --bg-card:       #ffffff;
  --border:        #e8e8f0;
  --shadow-sm:     0 2px 8px rgba(0,0,0,.06);
  --shadow-md:     0 6px 24px rgba(0,0,0,.10);
  --shadow-lg:     0 16px 48px rgba(0,0,0,.15);
  --radius-sm:     8px;
  --radius-md:     16px;
  --radius-lg:     24px;
  --header-h:      64px;
  --transition:    .25s ease;
  --font:          'Be Vietnam Pro', sans-serif;
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul { list-style: none; }

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

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.logo-deal    { color: var(--primary); }
.logo-voucher { color: var(--text-dark); }
.logo-dot     { color: var(--primary); font-weight: 400; }

.brand-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.brand-nav::-webkit-scrollbar { display: none; }
.brand-nav a {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-mid);
  transition: var(--transition);
}
.brand-nav a:hover,
.brand-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-skeleton {
  height: 32px;
  width: 300px;
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200%;
  animation: shimmer 1.5s infinite;
  border-radius: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-search-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg-page);
  color: var(--text-mid);
  font-size: 1rem;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.btn-search-toggle:hover { background: var(--primary-light); color: var(--primary); }

.btn-admin {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .875rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-admin:hover { background: var(--primary-dark); }

/* Search bar */
.search-bar {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 10px 0;
  display: none;
  animation: slideDown .2s ease;
}
.search-bar.open { display: block; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
}
.search-input-wrap i { color: var(--text-light); }
.search-input-wrap input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: .9375rem;
  outline: none;
  color: var(--text-dark);
}
.btn-search-clear {
  color: var(--text-light);
  font-size: .8rem;
  display: none;
}
.btn-search-clear.visible { display: block; }

/* ── Hero Slider ─────────────────────────────────────────── */
.hero-section {
  background: #fff;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.hero-slider {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  overflow: hidden;
}

.hero-track {
  display: flex;
  gap: 16px;
  transition: transform .4s cubic-bezier(.25,.46,.45,.94);
}

.hero-slide {
  flex: 0 0 calc(50% - 8px);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.hero-slide:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.hero-slide img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.hero-slide-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.hero-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-md);
  color: var(--text-dark);
  font-size: .875rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  z-index: 10;
}
.hero-btn:hover { background: var(--primary); color: #fff; }
.hero-prev { left: 28px; }
.hero-next { right: 28px; }
.hero-btn:disabled { opacity: .3; pointer-events: none; }

.hero-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ddd;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.hero-dot.active { background: var(--primary); width: 24px; border-radius: 4px; }

/* ── Main Content ────────────────────────────────────────── */
.site-main { padding: 40px 0 60px; }

.section-header {
  text-align: center;
  margin-bottom: 28px;
}
.section-title {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}
.section-subtitle {
  font-size: .9375rem;
  color: var(--text-light);
  margin-top: 6px;
}

/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin-bottom: 28px;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 8px 18px;
  border-radius: 24px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-mid);
  background: #fff;
  border: 2px solid var(--border);
  transition: var(--transition);
}
.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Voucher Grid ────────────────────────────────────────── */
.voucher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.voucher-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.voucher-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.voucher-card-img-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg-page);
}
.voucher-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.voucher-card:hover .voucher-card-img { transform: scale(1.04); }

.voucher-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voucher-brand-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voucher-card-body {
  padding: 12px 14px 14px;
}

.voucher-card-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.voucher-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.voucher-expiry {
  font-size: .75rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}
.voucher-expiry.expiring-soon { color: #e65c00; }
.voucher-expiry.expired { color: #c0392b; text-decoration: line-through; }

.voucher-cta {
  font-size: .8rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Skeleton loader */
.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.skeleton-img {
  aspect-ratio: 2/3;
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200%;
  animation: shimmer 1.5s infinite;
}
.skeleton-body { padding: 12px 14px 14px; }
.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
}
.skeleton-line.short { width: 60%; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Load more */
.load-more-wrap { text-align: center; margin-top: 36px; }
.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 28px;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--primary);
  transition: var(--transition);
}
.btn-load-more:hover { background: var(--primary); color: #fff; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-light);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state p { font-size: 1.125rem; font-weight: 600; }
.empty-state small { font-size: .875rem; }

/* ── How To Use Section ──────────────────────────────────── */
.howto-section {
  background: #fff;
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.howto-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 36px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.howto-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.howto-step {
  text-align: center;
  padding: 28px 20px;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  position: relative;
}

.step-icon {
  width: 60px; height: 60px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem;
  margin: 0 auto 16px;
}

.step-number {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.step-text {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-mid);
  line-height: 1.5;
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background: var(--text-dark);
  color: rgba(255,255,255,.75);
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}

.footer-brand .site-logo { margin-bottom: 14px; }
.footer-brand p { font-size: .875rem; line-height: 1.7; }

.footer-links h4 {
  color: #fff;
  font-size: .9375rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.footer-links li { margin-bottom: 8px; }
.footer-links a {
  font-size: .875rem;
  color: rgba(255,255,255,.6);
  transition: var(--transition);
}
.footer-links a:hover { color: var(--primary); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 20px;
  text-align: center;
}
.footer-bottom p { font-size: .8125rem; margin-bottom: 6px; }
.disclaimer { opacity: .5; font-style: italic; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp .3s ease;
  box-shadow: var(--shadow-lg);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-page);
  color: var(--text-mid);
  font-size: .875rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  transition: var(--transition);
}
.modal-close:hover { background: var(--primary); color: #fff; }

.modal-img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: var(--bg-page);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-body {
  padding: 20px 24px 28px;
}

.modal-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--primary);
  margin-bottom: 8px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.3;
}

.modal-desc {
  font-size: .9rem;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 14px;
}

.modal-expiry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  background: #fff8e1;
  color: #b7791f;
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 500;
}

.modal-instructions {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.modal-instructions h4 {
  font-size: .875rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dark);
}
.modal-instructions p {
  font-size: .85rem;
  color: var(--text-mid);
  line-height: 1.7;
}

.btn-get-voucher {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  transition: var(--transition);
}
.btn-get-voucher:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-get-voucher i { font-size: 1.1rem; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #1a1a2e;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: .875rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn .3s ease;
  max-width: 300px;
}
.toast.success { border-left: 3px solid #38a169; }
.toast.error   { border-left: 3px solid var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .voucher-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .footer-grid  { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1/-1; }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }
  .section-title { font-size: 1.375rem; }
  .voucher-grid  { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero-slide    { flex: 0 0 calc(100% - 0px); }
  .howto-steps   { grid-template-columns: repeat(2, 1fr); }
  .footer-grid   { grid-template-columns: 1fr; gap: 24px; }
  .site-logo     { font-size: 1.25rem; }
  .brand-nav     { display: none; }
}

@media (max-width: 480px) {
  .container    { padding: 0 14px; }
  .voucher-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .howto-steps  { grid-template-columns: 1fr 1fr; }
  .hero-slide img { height: 160px; }
  .modal-box    { border-radius: var(--radius-md); }
}
