/* ─── Global Theme Styles – ToanWeb BDS ─────────────────────────────────────
   Loaded on every page. BDS CSS variables come from the Vue bundle (main.css).
   ─────────────────────────────────────────────────────────────────────────── */

/* ─── Reset / Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Be Vietnam Pro',
                 Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #111827;
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

/* offset for sticky header */
#main-content { padding-top: 64px; }

/* WP Admin Bar offset */
.admin-bar .site-header { top: 32px; }
.admin-bar #main-content { padding-top: calc(64px + 32px); }
@media screen and (max-width: 782px) {
    .admin-bar .site-header { top: 46px; }
    .admin-bar #main-content { padding-top: calc(64px + 46px); }
}

/* ─── Site Header ────────────────────────────────────────────────────────────── */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    height: 64px;
}

.site-header__inner {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 0;
}

/* Logo */
.site-header__logo { flex-shrink: 0; margin-right: 36px; }

.site-header__logo img {
    height: 40px;
    width: auto;
    display: block;
}

.site-header__logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.site-header__logo-text {
    font-size: 17px;
    font-weight: 800;
    color: var(--bds-primary, #312E8D);
    letter-spacing: -.3px;
    white-space: nowrap;
}

/* Primary Nav */
.site-header__nav { flex: 1; display: flex; align-items: center; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav > li { position: relative; }

.site-nav > li > a {
    display: block;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    border-radius: 8px;
    transition: background .15s, color .15s;
    white-space: nowrap;
    text-decoration: none;
}

.site-nav > li > a:hover,
.site-nav > li.current-menu-item > a,
.site-nav > li.current-menu-parent > a {
    color: var(--bds-primary, #312E8D);
    background: var(--bds-primary-light, #EEF2FF);
}

/* Dropdown */
.site-nav .sub-menu {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    min-width: 200px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 6px;
    z-index: 200;
    list-style: none;
}

.site-nav li:hover > .sub-menu { display: block; }

.site-nav .sub-menu li a {
    display: block;
    padding: 9px 14px;
    font-size: 13px;
    color: #374151;
    border-radius: 7px;
    transition: background .12s, color .12s;
    white-space: nowrap;
    text-decoration: none;
}

.site-nav .sub-menu li a:hover { background: var(--bds-primary-light, #EEF2FF); color: var(--bds-primary, #312E8D); }

/* Right area – lives inside .site-header__nav so desktop uses flex push-right,
   mobile uses position:fixed to stay in header bar when nav panel is closed */
.site-header__right {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Hamburger */
.site-header__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: 8px;
    border-radius: 8px;
    transition: background .15s;
}
.site-header__burger:hover { background: #F3F4F6; }
.site-header__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #374151;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.site-header--open .site-header__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header--open .site-header__burger span:nth-child(2) { opacity: 0; }
.site-header--open .site-header__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile overlay */
.site-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 998;
}
.site-nav-overlay.is-open { display: block; }

/* ─── Site Footer ────────────────────────────────────────────────────────────── */
.site-footer {
    background: #fff;
    border-top: 1px solid #E5E7EB;
    margin-top: 0;
}

.site-footer__container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-footer__top .site-footer__container {
    display: grid;
    grid-template-columns: 2fr 1.4fr 1.4fr;
    gap: 48px;
    padding-top: 48px;
    padding-bottom: 48px;
}

/* Brand col */
.site-footer__brand { }
.site-footer__logo img { height: 36px; width: auto; }
.site-footer__logo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 800;
    color: var(--bds-primary, #312E8D);
    text-decoration: none;
    margin-bottom: 12px;
}
.site-footer__tagline {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.6;
    margin: 10px 0 8px;
    max-width: 280px;
}
.site-footer__license {
    font-size: 12px;
    color: #9CA3AF;
    line-height: 1.5;
    margin: 0;
    max-width: 280px;
}

/* Links col */
.site-footer__col-title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--bds-primary, #312E8D);
    display: inline-block;
}
.site-footer__links { display: flex; flex-direction: column; gap: 8px; }
.site-footer__links li a {
    font-size: 13px;
    color: #6B7280;
    text-decoration: none;
    transition: color .12s;
}
.site-footer__links li a:hover { color: var(--bds-primary, #312E8D); }

/* Contact col */
.site-footer__contact { display: flex; flex-direction: column; gap: 12px; }
.site-footer__contact li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
}
.site-footer__contact li svg { flex-shrink: 0; margin-top: 2px; color: var(--bds-primary, #312E8D); }
.site-footer__contact li a { color: var(--bds-primary, #312E8D); }
.site-footer__contact li a:hover { text-decoration: underline; }

/* Bottom bar */
.site-footer__bottom {
    border-top: 1px solid #E5E7EB;
    padding: 16px 0;
}
.site-footer__bottom .site-footer__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.site-footer__copy, .site-footer__powered {
    font-size: 12px;
    color: #9CA3AF;
    margin: 0;
}
.site-footer__powered a { color: #9CA3AF; }
.site-footer__powered a:hover { color: var(--bds-primary, #312E8D); }

/* ─── Sub-menu toggle button (mobile) ──────────────────────────────────────── */
.site-nav__sub-toggle {
    display: none; /* hidden on desktop */
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .site-header__nav {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        z-index: 999;
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        overflow-y: auto;
        gap: 0;
    }
    .site-header__nav.is-open { display: flex; }

    /* Right section stays in the header bar on mobile (outside nav, always visible) */
    .site-header__right {
        margin-left: auto;
    }

    .site-nav { flex-direction: column; width: 100%; gap: 0; }
    .site-nav > li > a { font-size: 15px; padding: 12px 16px; border-radius: 10px; }

    /* Sub-menu: hidden by default on mobile; shown when li has .is-open */
    .site-nav .sub-menu {
        display: none;
        position: static;
        box-shadow: none;
        padding: 0 0 0 12px;
        border-left: 2px solid var(--bds-primary-light, #EEF2FF);
        margin: 0 0 4px 16px;
    }
    .site-nav li.is-open > .sub-menu { display: block; }

    /* Toggle button shown on mobile for items with children */
    .site-nav__sub-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        background: #F3F4F6;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        color: #374151;
        transition: background .15s;
    }
    .site-nav__sub-toggle:hover { background: var(--bds-primary-light, #EEF2FF); color: var(--bds-primary, #312E8D); }
    .site-nav__sub-toggle svg { transition: transform .2s; }
    .site-nav li.is-open > a .site-nav__sub-toggle svg,
    .site-nav li.is-open > .site-nav__sub-toggle svg { transform: rotate(180deg); }

    /* Parent li needs width + relative for the absolutely-positioned toggle button */
    .site-nav > li { width: 100%; position: relative; }

    .site-header__burger { display: flex; }

    .site-footer__top .site-footer__container {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

@media (max-width: 520px) {
    .site-footer__bottom .site-footer__container { flex-direction: column; text-align: center; }
    .site-header__logo-text { font-size: 15px; }
}
