/*
Theme Name:  CabinHitech Child
Template:    kadence
Description: Child theme สำหรับ cabinhitech.com — Smart Home Affiliate
Version:     1.0.0
Author:      CabinHitech
Text Domain: cabinhitech-child
*/

/* ════════════════════════════════════════════
   DESIGN SYSTEM — CSS VARIABLES
════════════════════════════════════════════ */
:root {
  --bg-base:        #0a0a0f;
  --bg-card:        #12121a;
  --bg-elevated:    #1a1a2e;
  --bg-hover:       #1f1f30;
  --primary:        #00e5ff;
  --primary-dim:    rgba(0,229,255,0.12);
  --secondary:      #7c3aed;
  --secondary-dim:  rgba(124,58,237,0.12);
  --guide-gold:     #fbbf24;
  --guide-dim:      rgba(251,191,36,0.12);
  --agg-purple:     #a78bfa;
  --agg-dim:        rgba(167,139,250,0.1);
  --compare-cyan:   #00e5ff;
  --success:        #10b981;
  --danger:         #ef4444;
  --text-primary:   #f0f0f5;
  --text-secondary: #9ca3af;
  --text-muted:     #6b7280;
  --border:         rgba(255,255,255,0.07);
  --border-glow:    rgba(0,229,255,0.25);
  --radius:         14px;
  --radius-sm:      8px;
  --radius-pill:    100px;
  --font:           'Sarabun', 'Noto Sans Thai', sans-serif;
}

/* ════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #0a0a0f;
  min-height: 100%;
}

body {
  background: var(--bg-base) !important;
  color: var(--text-primary) !important;
  font-family: var(--font) !important;
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }

/* ════════════════════════════════════════════
   ซ่อน Kadence Header & Footer เดิม
   (เราใช้ header.php / footer.php แทน)
════════════════════════════════════════════ */
#masthead,
.site-header-wrap,
.kadence-top-header-wrap,
#colophon,
.site-footer-wrap {
  display: none !important;
}

/* ════════════════════════════════════════════
   READING PROGRESS BAR
════════════════════════════════════════════ */
#progress-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--agg-purple));
  z-index: 9999; transition: width 0.1s linear;
}

/* ════════════════════════════════════════════
   HEADER — 2 ROW
════════════════════════════════════════════ */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(10,10,15,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-top { border-bottom: 1px solid var(--border); }
.header-top-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 24px; height: 54px;
  display: flex; align-items: center;
  position: relative;
}
.logo {
  font-size: 1.35rem; font-weight: 800;
  color: var(--primary); letter-spacing: -0.5px; flex-shrink: 0;
}
.logo span { color: var(--guide-gold); }
.header-top-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.header-search {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
}
.header-search input[type="search"],
.header-search input[type="text"] {
  width: 100%; height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 40px 0 16px;
  color: #ffffff;
  font-family: var(--font); font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.08);
}
.header-search .search-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
  display: flex; align-items: center;
}
.header-search .search-icon svg { width: 15px; height: 15px; }

.btn-cta-header {
  padding: 8px 20px; border-radius: var(--radius-pill);
  background: var(--primary); color: #000 !important;
  font-size: 0.82rem; font-weight: 700;
  transition: opacity 0.2s; white-space: nowrap;
}
.btn-cta-header:hover { opacity: 0.85; }

.hamburger {
  display: none; flex-direction: column; gap: 5px;
  width: 36px; height: 36px; align-items: center; justify-content: center;
  background: var(--bg-elevated); border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
}
.hamburger span { width: 18px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: all 0.3s; }

/* ── ROW 2 MEGA NAV ── */
.header-mega { position: relative; }
.mega-nav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 20px; display: flex; align-items: stretch; height: 44px;
}
.mega-nav-item { position: static; display: flex; align-items: stretch; }
.mega-nav-link {
  display: flex; align-items: center; gap: 5px;
  padding: 0 13px; height: 100%;
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary); white-space: nowrap;
  cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s; font-family: var(--font);
}
.mega-nav-link .nav-icon  { font-size: 0.85rem; }
.mega-nav-link .nav-chevron { font-size: 0.5rem; color: var(--text-muted); margin-left: 1px; transition: transform 0.25s; }
.mega-nav-item:hover .mega-nav-link  { color: var(--primary); border-bottom-color: var(--primary); }
.mega-nav-item:hover .nav-chevron    { transform: rotate(180deg); }
.mega-nav-item.has-hot .mega-nav-link::after {
  content: 'HOT'; font-size: 0.55rem; font-weight: 700;
  background: rgba(239,68,68,0.2); color: #ef4444;
  padding: 1px 4px; border-radius: 3px; margin-left: 2px;
}
.mega-nav-item.has-new .mega-nav-link::after {
  content: 'NEW'; font-size: 0.55rem; font-weight: 700;
  background: var(--primary-dim); color: var(--primary);
  padding: 1px 4px; border-radius: 3px; margin-left: 2px;
}

.mega-dropdown {
  position: fixed; top: 98px; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: none; z-index: 250;
}
.mega-nav-item:hover .mega-dropdown { display: flex; }

.dropdown-inner {
  max-width: 1280px; margin: 0 auto; padding: 24px; display: flex;
}
.dropdown-cats { flex: 1; display: grid; }
.dropdown-col-heading {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 8px 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border); grid-column: 1 / -1;
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  transition: background 0.15s; text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-elevated); }
.di-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0; transition: border-color 0.15s;
}
.dropdown-item:hover .di-icon { border-color: var(--border-glow); }
.di-name { font-size: 0.82rem; font-weight: 700; color: var(--text-secondary); line-height: 1.3; transition: color 0.15s; }
.di-sub  { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }
.dropdown-item:hover .di-name { color: var(--primary); }

.dropdown-side {
  width: 220px; flex-shrink: 0;
  margin-left: 24px; padding-left: 24px;
  border-left: 1px solid var(--border);
}
.ds-heading { font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.ds-article {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color 0.2s; display: block; text-decoration: none;
}
.ds-article:hover { border-color: var(--border-glow); }
.ds-thumb { height: 90px; background: var(--bg-base); display: flex; align-items: center; justify-content: center; font-size: 2rem; border-bottom: 1px solid var(--border); }
.ds-body  { padding: 10px 12px; }
.ds-badge { font-size: 0.62rem; font-weight: 700; margin-bottom: 4px; }
.ds-badge.guide   { color: var(--guide-gold); }
.ds-badge.compare { color: var(--primary); }
.ds-badge.agg     { color: var(--agg-purple); }
.ds-title { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); line-height: 1.4; margin-bottom: 6px; }
.ds-link  { font-size: 0.7rem; font-weight: 700; color: var(--primary); }

/* ── MOBILE NAV ── */
.mobile-nav {
  display: none; flex-direction: column; gap: 1px;
  padding: 10px 16px 16px; border-top: 1px solid var(--border);
  background: rgba(10,10,15,0.98); max-height: 75vh; overflow-y: auto;
}
.mobile-nav.open { display: flex; }
.mobile-nav-section { padding: 6px 0 2px; }
.mobile-nav-section-title { font-size: 0.65rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); padding: 4px 10px 6px; }
.mobile-nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600; color: var(--text-secondary);
  transition: background 0.15s, color 0.15s; text-decoration: none;
}
.mobile-nav-link:hover { background: var(--bg-elevated); color: var(--primary); }

/* ════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */
.site-footer-custom { background: var(--bg-card); border-top: 1px solid var(--border); }
.footer-main {
  max-width: 1280px; margin: 0 auto;
  padding: 48px 24px 32px;
  display: grid; grid-template-columns: 260px 1fr 1fr 1fr; gap: 40px;
}
.footer-logo { font-size: 1.3rem; font-weight: 800; color: var(--primary); margin-bottom: 10px; display: block; }
.footer-logo span { color: var(--guide-gold); }
.footer-tagline { font-size: 0.82rem; color: var(--text-muted); line-height: 1.65; margin-bottom: 14px; }
.footer-social { display: flex; gap: 8px; }
.social-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s; text-decoration: none;
}
.social-btn:hover { color: var(--primary); border-color: var(--border-glow); }
.footer-col h4 { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; transition: color 0.2s; text-decoration: none; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  max-width: 1280px; margin: 0 auto; padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.footer-disclosure { font-size: 0.75rem; color: var(--text-muted); max-width: 700px; line-height: 1.6; }
.footer-disclosure strong { color: var(--text-secondary); }
.footer-copy { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ════════════════════════════════════════════
   SCROLL TOP
════════════════════════════════════════════ */
#scroll-top {
  position: fixed; bottom: 24px; right: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity 0.3s, border-color 0.2s;
}
#scroll-top.visible { opacity: 1; pointer-events: all; }
#scroll-top:hover { border-color: var(--border-glow); color: var(--primary); }

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 1100px) { .footer-main { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .header-mega { display: none; }
  .btn-cta-header { display: none; }
  .hamburger { display: flex; }
  .mega-dropdown { top: 54px; }
  .header-search { display: none; }
}
@media (max-width: 640px) {
  .footer-main { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; }
}
