/* =====================================================================
   Trekking2026 - Theme (ต่อยอดจาก AdminLTE 4 / Bootstrap 5)
   สีหลัก/สีรอง/ฟอนต์ ถูกกำหนดผ่านตัวแปร CSS จาก tbl_system_config (Config::themeCss)
   ===================================================================== */
:root {
  --trek-primary: #5C3A1E;
  --trek-secondary: #C9A227;
  --trek-primary-dark: color-mix(in srgb, var(--trek-primary) 75%, #000);
  --trek-primary-soft: color-mix(in srgb, var(--trek-primary) 10%, #fff);
  --trek-secondary-soft: color-mix(in srgb, var(--trek-secondary) 18%, #fff);
  --trek-cream: #FBF6EC;
  --trek-font-scale: 1;
}

/* ---------- Font resizer: ปรับขนาดทั้งหน้าผ่าน root font-size ---------- */
html { font-size: calc(16px * var(--trek-font-scale)); }

body,
.app-wrapper,
button, input, select, textarea, .btn, .form-control, .form-select, .tooltip, .popover {
  font-family: var(--trek-font), "Noto Sans Thai", system-ui, sans-serif;
}
body { background: #f6f3ee; }

/* ---------- Bootstrap overrides (primary = น้ำตาล, accent = ทอง) ---------- */
.btn-primary {
  --bs-btn-bg: var(--trek-primary); --bs-btn-border-color: var(--trek-primary);
  --bs-btn-hover-bg: var(--trek-primary-dark); --bs-btn-hover-border-color: var(--trek-primary-dark);
  --bs-btn-active-bg: var(--trek-primary-dark); --bs-btn-active-border-color: var(--trek-primary-dark);
  --bs-btn-disabled-bg: var(--trek-primary); --bs-btn-disabled-border-color: var(--trek-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--trek-primary); --bs-btn-border-color: var(--trek-primary);
  --bs-btn-hover-bg: var(--trek-primary); --bs-btn-hover-border-color: var(--trek-primary);
  --bs-btn-active-bg: var(--trek-primary); --bs-btn-active-border-color: var(--trek-primary);
}
.btn-gold {
  --bs-btn-color: #2b1a0b; --bs-btn-bg: var(--trek-secondary); --bs-btn-border-color: var(--trek-secondary);
  --bs-btn-hover-color: #2b1a0b; --bs-btn-hover-bg: color-mix(in srgb, var(--trek-secondary) 85%, #fff);
  --bs-btn-hover-border-color: var(--trek-secondary); --bs-btn-active-bg: var(--trek-secondary);
  font-weight: 600;
}
.text-primary { color: var(--trek-primary) !important; }
.text-gold { color: var(--trek-secondary) !important; }
.bg-primary { background-color: var(--trek-primary) !important; }
.bg-gold { background-color: var(--trek-secondary) !important; }
.form-control:focus, .form-select:focus {
  border-color: var(--trek-secondary);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--trek-secondary) 30%, transparent);
}
.page-link { color: var(--trek-primary); }
.active > .page-link, .page-link.active { background-color: var(--trek-primary); border-color: var(--trek-primary); }
.nav-pills .nav-link.active { background-color: var(--trek-primary); }
.nav-tabs .nav-link.active { color: var(--trek-primary); font-weight: 600; border-top: 3px solid var(--trek-secondary); }
.card-trek > .card-header { background: var(--trek-primary); color: #fff; border-bottom: 3px solid var(--trek-secondary); }
.card-trek > .card-header .card-title { font-weight: 600; }

/* ---------- Accessibility toolbar ---------- */
.a11y-toolbar { display: inline-flex; align-items: center; gap: .25rem; }
.a11y-toolbar .btn { min-width: 2.25rem; padding: .15rem .45rem; font-weight: 700; line-height: 1.4; }
.a11y-toolbar .btn[data-font-size="dec"] { font-size: .8rem; }
.a11y-toolbar .btn[data-font-size="reset"] { font-size: .95rem; }
.a11y-toolbar .btn[data-font-size="inc"] { font-size: 1.1rem; }
.a11y-toolbar .btn.active { background: var(--trek-secondary); border-color: var(--trek-secondary); color: #2b1a0b; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 2000; background: #000; color: #fff; padding: .5rem 1rem; }
.skip-link:focus { left: 0; }

/* ---------- ระบบหลังบ้าน (AdminLTE) ---------- */
.app-header.trek-header { border-bottom: 3px solid var(--trek-secondary); }
.app-sidebar.trek-sidebar { background: linear-gradient(180deg, var(--trek-primary-dark), var(--trek-primary)) !important; }
.trek-sidebar .sidebar-brand { border-bottom: 1px solid rgba(201,162,39,.4); }
.trek-sidebar .brand-link { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; }
.trek-sidebar .brand-image { height: 34px; width: auto; max-height: 34px; }
.trek-sidebar .brand-text { color: var(--trek-secondary) !important; font-weight: 700; letter-spacing: .3px; }
.trek-sidebar .nav-link { color: rgba(255,255,255,.85) !important; }
.trek-sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff !important; }
.trek-sidebar .nav-link.active { background: var(--trek-secondary) !important; color: #2b1a0b !important; font-weight: 600; }
.trek-sidebar .nav-header { color: var(--trek-secondary) !important; opacity: .9; }
.trek-sidebar .user-panel { padding: .75rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); color: #fff; display: flex; align-items: center; gap: .6rem; }
.trek-sidebar .user-panel img { width: 38px; height: 38px; object-fit: cover; border-radius: 50%; border: 2px solid var(--trek-secondary); background: #fff; }
.trek-sidebar .user-panel small { color: var(--trek-secondary); display: block; }
.app-content-header h3 { color: var(--trek-primary); font-weight: 700; }
.app-footer { font-size: .875rem; }

.small-box.trek-box { border-radius: .75rem; overflow: hidden; }
.stat-card { border: 0; border-left: 5px solid var(--trek-secondary); border-radius: .75rem; }
.stat-card .stat-icon { width: 3.25rem; height: 3.25rem; border-radius: .75rem; display: grid; place-items: center; font-size: 1.5rem; background: var(--trek-primary-soft); color: var(--trek-primary); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--trek-primary); line-height: 1.1; }

.profile-avatar { width: 128px; height: 128px; object-fit: cover; border-radius: 50%; border: 4px solid var(--trek-secondary); background: #fff; }
.table thead th { background: var(--trek-primary-soft); color: var(--trek-primary); white-space: nowrap; }
.required::after { content: " *"; color: #dc3545; }
.config-logo-preview { max-height: 72px; max-width: 200px; background: #f1f1f1; padding: 4px; border-radius: .375rem; }

/* ---------- หน้าเว็บสาธารณะ ---------- */
.public-body { background: var(--trek-cream); min-height: 100vh; display: flex; flex-direction: column; }
.public-topbar { background: var(--trek-primary-dark); color: #f3e7c9; font-size: .875rem; }
.public-topbar a { color: #f3e7c9; }
.public-nav { background: var(--trek-primary); border-bottom: 3px solid var(--trek-secondary); }
.public-nav .navbar-brand img { height: 46px; width: auto; }
.public-nav .navbar-brand .brand-title { color: var(--trek-secondary); font-weight: 700; line-height: 1.1; }
.public-nav .navbar-brand .brand-sub { color: #f3e7c9; font-size: .75rem; }
.public-nav .nav-link { color: #f3e7c9; }
.public-nav .nav-link:hover, .public-nav .nav-link.active { color: var(--trek-secondary); }

.hero {
  position: relative; color: #fff; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201,162,39,.35), transparent 60%),
    linear-gradient(160deg, #2a170a 0%, var(--trek-primary) 55%, #3b2412 100%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(45deg, rgba(201,162,39,.06) 0 2px, transparent 2px 18px);
}
.hero > .container { position: relative; z-index: 1; }
.hero-title {
  font-weight: 800; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.15;
  background: linear-gradient(180deg, #fff3c4, var(--trek-secondary) 55%, #9a7414);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 18px rgba(0,0,0,.25);
}
.hero-sub { font-size: clamp(1.15rem, 2.6vw, 1.9rem); font-weight: 700; color: #fff; }
.hero-year {
  display: inline-flex; align-items: center; gap: .75rem; color: var(--trek-secondary);
  font-weight: 700; font-size: clamp(1rem, 2vw, 1.4rem);
}
.hero-year::before, .hero-year::after { content: ""; width: 3rem; height: 2px; background: var(--trek-secondary); }
.hero-emblem { max-width: 100%; width: 340px; filter: drop-shadow(0 10px 30px rgba(0,0,0,.45)); }
.hero-org { color: #f3e7c9; }

.section-title { color: var(--trek-primary); font-weight: 800; position: relative; padding-bottom: .6rem; }
.section-title::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 72px; height: 4px; border-radius: 2px; background: var(--trek-secondary); }

.meaning-card { border: 0; border-top: 4px solid var(--trek-secondary); border-radius: .9rem; height: 100%; box-shadow: 0 6px 24px rgba(92,58,30,.08); transition: transform .2s; }
.meaning-card:hover { transform: translateY(-4px); }
.meaning-card .icon { width: 3.5rem; height: 3.5rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: var(--trek-primary); color: var(--trek-secondary); }
.meaning-card h3 { color: #8b1a1a; font-weight: 700; font-size: 1.25rem; }

.poster-frame { border: 6px solid var(--trek-secondary); border-radius: 1rem; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.25); background: #000; }
.poster-frame img { width: 100%; height: auto; display: block; }

.cta-band { background: linear-gradient(90deg, var(--trek-primary-dark), var(--trek-primary)); color: #fff; border-top: 3px solid var(--trek-secondary); }
.public-footer { background: #24150a; color: #d9c9a3; font-size: .9rem; }
.public-footer a { color: var(--trek-secondary); }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 220px); display: flex; align-items: center; padding: 2rem 0; }
.auth-card { border: 0; border-radius: 1rem; overflow: hidden; box-shadow: 0 12px 40px rgba(92,58,30,.18); }
.auth-card .auth-head { background: var(--trek-primary); color: #fff; border-bottom: 4px solid var(--trek-secondary); text-align: center; padding: 1.5rem 1rem 1.25rem; }
.auth-card .auth-head img { height: 72px; }
.auth-card .auth-head h1 { font-size: 1.25rem; color: var(--trek-secondary); font-weight: 700; margin: .5rem 0 0; }
.login-kind .btn-check:checked + .btn { background: var(--trek-primary); color: #fff; border-color: var(--trek-primary); }
.pw-strength { height: 6px; border-radius: 3px; background: #e9ecef; overflow: hidden; }
.pw-strength > span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }

@media (max-width: 575.98px) {
  .public-nav .navbar-brand .brand-sub { display: none; }
  .hero-emblem { width: 240px; }
}
@media print {
  .app-sidebar, .app-header, .app-footer, .a11y-toolbar, .no-print { display: none !important; }
}
