/* ==========================================================================
   site.css — giao diện dùng chung.
   Màu chủ đạo lấy từ config.js qua biến CSS, nên đổi thương hiệu không cần
   sửa file này.
   ========================================================================== */

:root {
  --primary: #0e7490;
  --primary-dark: #0b5b71;
  --primary-soft: #ecfeff;
  --accent: #ea580c;
  --accent-dark: #c2410c;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* --- Header --------------------------------------------------------------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.logo-box { width: 42px; height: 42px; flex: 0 0 42px; display: flex; align-items: center; justify-content: center; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .5px; font-size: 15px;
}
.logo-img { width: auto; height: 42px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-weight: 800; font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); font-size: 15px; padding: 8px 12px; border-radius: 9px; }
.nav a:hover { color: var(--ink); background: var(--bg); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 11px; border: 1px solid transparent;
  font-size: 15px; font-weight: 700; font-family: var(--font);
  cursor: pointer; text-decoration: none; transition: .15s ease;
  line-height: 1.2;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-block { width: 100%; }

/* --- Hero ----------------------------------------------------------------- */
.hero {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; padding: 68px 0 76px;
}
.hero h1 { font-size: clamp(28px, 4.4vw, 44px); line-height: 1.18; margin: 0 0 16px; font-weight: 800; letter-spacing: -.5px; }
.hero p.lead { font-size: clamp(16px, 2vw, 19px); opacity: .92; margin: 0 0 28px; max-width: 620px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-outline { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.5); }
.hero .btn-outline:hover { background: rgba(255,255,255,.2); }

.ref-banner {
  display: none; margin-top: 26px; padding: 12px 16px; border-radius: 11px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  font-size: 14px;
}
.ref-banner.show { display: block; }
.ref-banner b { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 1px; }

/* --- Sections ------------------------------------------------------------- */
section { padding: 60px 0; }
.section-head { margin-bottom: 30px; }
.section-head h2 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 8px; font-weight: 800; letter-spacing: -.3px; }
.section-head p { color: var(--muted); margin: 0; font-size: 16px; }
.bg-white { background: #fff; }

/* --- Cards / grid --------------------------------------------------------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
.card-pad { padding: 22px; }
.tour-img { width: 100%; height: 176px; object-fit: cover; background: var(--primary-soft); }
.tour-img-empty {
  height: 176px; background: linear-gradient(135deg, var(--primary-soft), #fff);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 700; font-size: 15px; text-align: center; padding: 16px;
}
.tour-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tour-title { font-size: 18px; font-weight: 800; margin: 0; }
.tour-meta { font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.tour-sum { font-size: 14.5px; color: #475569; margin: 0; flex: 1; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; }
.price { font-size: 19px; font-weight: 800; color: var(--accent); }
.price small { font-size: 12px; font-weight: 600; color: var(--muted); display: block; }

/* --- Steps ---------------------------------------------------------------- */
.steps { counter-reset: s; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.step { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 20px; }
.step-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary); font-weight: 800; display: flex; align-items: center;
  justify-content: center; margin-bottom: 12px; font-size: 15px;
}
.step h3 { margin: 0 0 6px; font-size: 16.5px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* --- Forms ---------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: var(--font); color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 116, 144, .12);
}
textarea { min-height: 92px; resize: vertical; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }

.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.form-note { font-size: 13px; color: var(--muted); margin-top: 14px; }

/* --- Alerts / badges ------------------------------------------------------ */
.alert { padding: 14px 16px; border-radius: 11px; font-size: 14.5px; margin-bottom: 18px; border: 1px solid; }
.alert-ok { background: var(--ok-soft); border-color: #bbf7d0; color: #14532d; }
.alert-warn { background: var(--warn-soft); border-color: #fde68a; color: #78350f; }
.alert-err { background: var(--danger-soft); border-color: #fecaca; color: #7f1d1d; }
.alert-info { background: var(--primary-soft); border-color: #a5f3fc; color: #164e63; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-mute { background: #f1f5f9; color: var(--muted); }

/* --- Stats ---------------------------------------------------------------- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.5px; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.hl { border-color: var(--primary); background: var(--primary-soft); }

/* --- Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8fafc; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }

/* --- Ref link box --------------------------------------------------------- */
.reflink { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.reflink input { flex: 1; min-width: 240px; font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; background: #f8fafc; }

/* --- Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tab {
  padding: 12px 16px; border: none; background: none; cursor: pointer;
  font-size: 14.5px; font-weight: 700; color: var(--muted); font-family: var(--font);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.panel { display: none; }
.panel.active { display: block; }

/* --- Auth pages ----------------------------------------------------------- */
.auth-page { min-height: calc(100vh - 68px); display: flex; align-items: center; padding: 40px 0; }
.auth-card { max-width: 440px; margin: 0 auto; width: 100%; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-switch button { background: none; border: none; color: var(--primary); font-weight: 700; cursor: pointer; font-size: 14px; font-family: var(--font); }

/* --- Toast ---------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  padding: 13px 22px; border-radius: 11px; color: #fff; font-size: 14.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s ease; z-index: 100; max-width: 92vw;
  text-align: center; box-shadow: 0 10px 30px rgba(15,23,42,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-ok { background: #0f172a; }
.toast-error { background: var(--danger); }

/* --- Modal ---------------------------------------------------------------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px;
}
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); max-width: 460px; width: 100%; padding: 26px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 6px; font-size: 19px; }
.modal .sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* --- Footer --------------------------------------------------------------- */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 40px 0 32px; font-size: 14px; margin-top: 20px; }
.site-footer a { color: #e2e8f0; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 24px; }
.site-footer h4 { color: #fff; font-size: 15px; margin: 0 0 10px; }
.site-footer p { margin: 4px 0; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 18px; color: #94a3b8; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.hidden { display: none !important; }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .hero { padding: 46px 0 52px; }
  section { padding: 44px 0; }
  .site-header .wrap { min-height: 62px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .nav { width: 100%; justify-content: flex-start; }
  .nav a { padding: 6px 10px; font-size: 14px; }
  .form-card { padding: 20px; }
}
