/* ============================================
   LAYOUT — Header, Navigation, Footer
   ============================================ */

/* === Header === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(13, 27, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
    transition: all var(--transition-base);
}

.header.scrolled {
    box-shadow: var(--shadow-lg);
    background: rgba(13, 27, 42, 0.98);
}

.header__inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

/* Logo */
.header__logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    flex: 0 1 350px;
    min-width: 0;
}

.header__logo > img {
    flex-shrink: 0;
    box-shadow: 0 10px 24px rgba(8, 18, 31, 0.28);
}

.header__logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    font-weight: 800;
}

.header__logo-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 6px 0 6px 14px;
    border-left: 1px solid rgba(232, 101, 26, 0.35);
}

.header__logo-name {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.18em;
    line-height: 1;
    white-space: normal;
    text-transform: uppercase;
}

.header__logo-tagline {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: var(--color-text-light);
    letter-spacing: 0.04em;
    white-space: normal;
    text-transform: uppercase;
    font-weight: 800;
    opacity: 1;
    max-width: 300px;
    line-height: 1.15;
}

.header__logo-tagline-line {
    display: block;
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
}

.nav__item {
    position: relative;
}

.nav__link {
    display: block;
    padding: var(--space-2) 10px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
    text-decoration: none;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex: 0 0 auto;
}

.nav__link:hover,
.nav__link.active {
    color: var(--color-text-light);
    background: rgba(255, 255, 255, 0.08);
}

.nav__link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--color-secondary);
    border-radius: var(--radius-full);
}

/* Dropdown Menu styling */
.nav__dropdown {
    position: absolute;
    top: calc(100% + 14px);
    left: 0;
    background: var(--color-bg-card);
    min-width: 280px;
    box-shadow: 0 22px 48px rgba(7, 16, 28, 0.18);
    border-radius: 20px;
    padding: 8px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    border: 1px solid var(--color-border-light);
}

.nav__dropdown::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 28px;
    width: 14px;
    height: 14px;
    background: var(--color-bg-card);
    border-left: 1px solid var(--color-border-light);
    border-top: 1px solid var(--color-border-light);
    transform: rotate(45deg);
}

.nav__item:hover .nav__dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.nav__dropdown-item {
    position: relative;
    display: block;
}

.nav__dropdown-item + .nav__dropdown-item {
    margin-top: 2px;
}

.nav__dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    color: var(--color-text);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    font-weight: 500;
    border-radius: 12px;
}

.nav__dropdown-link:hover {
    background-color: var(--color-bg-alt);
    color: var(--color-primary);
    transform: translateX(4px);
}

.nav__dropdown-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav__dropdown-title {
    font-weight: 700;
    line-height: 1.35;
}

.nav__dropdown-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ======================== */
/* MEGA MENU — Product Menu */
/* ======================== */
.mega-menu {
    display: flex;
    min-width: 700px;
    max-width: 820px;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    left: 50%;
    transform: translateY(10px) translateX(-40%);
}

.nav__item:hover .mega-menu {
    transform: translateY(0) translateX(-40%);
}

.mega-menu::before {
    left: 40%;
}

/* Left sidebar */
.mega-menu__sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--color-bg-alt);
    border-right: 1px solid var(--color-border-light);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.mega-menu__sidebar::-webkit-scrollbar {
    width: 3px;
}
.mega-menu__sidebar::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 3px;
}

.mega-menu__cat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.mega-menu__cat i {
    font-size: 10px;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
    width: 14px;
    text-align: center;
}

.mega-menu__cat:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--color-primary);
}

.mega-menu__cat:hover i {
    color: var(--color-primary);
}

.mega-menu__cat.active {
    background: white;
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.mega-menu__cat.active i {
    color: var(--color-secondary);
}

.mega-menu__count {
    margin-left: auto;
    font-size: 11px;
    background: var(--color-primary);
    color: white;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

/* Right content */
.mega-menu__content {
    flex: 1;
    padding: 20px 24px;
    min-height: 200px;
    position: relative;
}

.mega-menu__panel {
    display: none;
}

.mega-menu__panel.active {
    display: block;
    animation: megaFadeIn 0.2s ease;
}

@keyframes megaFadeIn {
    from { opacity: 0; transform: translateX(6px); }
    to { opacity: 1; transform: translateX(0); }
}

.mega-menu__panel-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-secondary);
    display: inline-block;
}

.mega-menu__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.mega-menu__child {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.mega-menu__child:hover {
    background: rgba(232, 101, 26, 0.08);
    color: var(--color-secondary);
    border-left-color: var(--color-secondary);
    padding-left: 20px;
    font-weight: 600;
}

/* Arrow indicator */
.nav__has-sub > .nav__dropdown-link::after {
    content: '\f0da';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    margin-left: auto;
    color: var(--color-text-muted);
}
.nav__has-sub > .nav__dropdown-link:hover::after {
    color: var(--color-primary);
}

/* For main link with dropdown */
.nav__link.has-dropdown {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav__link.has-dropdown::after {
    content: '\f0d7';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    transition: transform var(--transition-fast);
}

.nav__item:hover > .nav__link.has-dropdown::after {
    transform: rotate(180deg);
}

/* Search in header */
.header__search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
    transition: all var(--transition-fast);
}

.header__search:focus-within {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.header__search-input {
    background: none;
    border: none;
    outline: none;
    color: var(--color-text-light);
    font-size: var(--text-sm);
    width: 140px;
    padding: 0 var(--space-2);
}

.header__search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.header__search-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: var(--space-1);
    transition: color var(--transition-fast);
}

.header__search-btn:hover {
    color: var(--color-secondary);
}

/* Mobile menu toggle */
.header__menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 24px;
    cursor: pointer;
    padding: var(--space-2);
}

/* Hotline button */
.header__hotline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--gradient-secondary);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.header__hotline:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-orange-glow);
    color: white;
}

.header__hotline i {
    animation: pulse 2s infinite;
}

/* === Main Content Spacer === */
.main-content {
    margin-top: var(--header-height);
}

/* === Footer === */
.footer {
    background: var(--gradient-dark);
    color: rgba(255, 255, 255, 0.7);
    padding-top: var(--space-16);
}

.footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: var(--space-10);
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.footer__title {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text-light);
    margin-bottom: var(--space-6);
    position: relative;
    padding-bottom: var(--space-3);
}

.footer__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--color-secondary);
    border-radius: var(--radius-full);
}

.footer__description {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

.footer__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.footer__link {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.footer__link:hover {
    color: var(--color-secondary);
    transform: translateX(4px);
}

.footer__link i {
    font-size: var(--text-xs);
    width: 16px;
}

/* Contact info in footer */
.footer__contact-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.footer__contact-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-secondary);
    flex-shrink: 0;
}

/* Social icons */
.footer__social {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.footer__social-link {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    transition: all var(--transition-base);
}

.footer__social-link:hover {
    background: var(--color-secondary);
    color: white;
    transform: translateY(-3px);
}

/* Footer bottom */
.footer__bottom {
    margin-top: var(--space-12);
    padding: var(--space-6) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.footer__bottom-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer__copyright {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.4);
}

/* === Scroll to Top === */
.scroll-top {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: 999;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

/* === Responsive Layout === */
@media (max-width: 1024px) {
    .header__logo {
        flex-basis: 310px;
    }

    .header__logo-tagline {
        max-width: 250px;
        font-size: 10px;
    }

    .nav__link {
        padding-inline: 8px;
        font-size: 13px;
    }

    .header__search {
        display: none;
    }

    .footer__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Mobile nav */
    .nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(13, 27, 42, 0.98);
        flex-direction: column;
        padding: var(--space-6);
        gap: var(--space-2);
        transform: translateX(100%);
        transition: transform var(--transition-base);
    }

    .nav.open {
        transform: translateX(0);
    }

    .nav__link {
        width: 100%;
        padding: var(--space-4);
        font-size: var(--text-lg);
    }

    .nav__item {
        width: 100%;
    }

    .nav__dropdown,
    .nav__sub-dropdown {
        position: static;
        min-width: 100%;
        visibility: visible;
        opacity: 1;
        transform: none;
        display: block;
        margin-top: 8px;
        padding: 8px;
        border-radius: 16px;
        box-shadow: none;
    }

    .nav__dropdown::before,
    .nav__sub-dropdown::before {
        display: none;
    }

    .nav__dropdown-item + .nav__dropdown-item {
        margin-top: 4px;
    }

    .nav__dropdown-link {
        padding: 12px 14px;
    }

    .nav__sub-dropdown {
        margin-left: 12px;
        border-style: dashed;
    }

    .mega-menu {
        display: block;
        min-width: 0;
        max-width: none;
        width: 100%;
        left: auto;
        transform: none;
        overflow: visible;
    }

    .nav__item:hover .mega-menu {
        transform: none;
    }

    .mega-menu::before {
        display: none;
    }

    .mega-menu__sidebar {
        width: 100%;
        min-width: 0;
        max-height: none;
        padding: 0;
        background: transparent;
        border-right: 0;
        overflow: visible;
    }

    .mega-menu__content {
        padding: 12px 0 0;
        min-height: 0;
    }

    .mega-menu__panel {
        display: block;
        padding: 14px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px;
    }

    .mega-menu__panel + .mega-menu__panel {
        margin-top: 10px;
    }

    .mega-menu__panel-title {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .mega-menu__grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .mega-menu__child {
        padding: 10px 12px;
        background: rgba(255, 255, 255, 0.04);
        border-color: rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.82);
    }

    .mega-menu__cat {
        background: rgba(255, 255, 255, 0.04);
        color: rgba(255, 255, 255, 0.82);
    }

    .mega-menu__cat i,
    .mega-menu__count {
        color: inherit;
    }

    .header__logo {
        flex: 1 1 auto;
        max-width: calc(100% - 56px);
        gap: 10px;
    }

    .header__logo > img {
        height: 40px !important;
        margin-right: 0 !important;
    }

    .header__logo-text {
        gap: 3px;
        padding: 4px 0 4px 10px;
    }

    .header__logo-name {
        font-size: 9px;
        letter-spacing: 0.14em;
    }

    .header__logo-tagline {
        max-width: none;
        font-size: 8px;
        line-height: 1.15;
    }

    .header__actions {
        gap: var(--space-2);
    }

    .header__menu-toggle {
        display: block;
    }

    .header__search,
    .header__hotline {
        display: none;
    }

    /* Footer mobile */
    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .footer__bottom-inner {
        flex-direction: column;
        gap: var(--space-4);
    }
}

/* === Expanding Floating Contact Widget === */
.floating-contact-menu {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    z-index: 9999;
}

.fab-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    align-items: center;
    /* Ensure it doesn't block clicks when invisible */
    pointer-events: none;
}

.floating-contact-menu:hover .fab-actions {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.fab-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.fab-btn:hover {
    transform: scale(1.1);
    color: white;
}

.fab-btn.zalo { background: #0088FF; font-size: 14px; font-weight: bold; }
.fab-btn.phone { background: #4CAF50; }
.fab-btn.email { background: #EA4335; }

.fab-main-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #FF8C00;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.4);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    animation: pulse-orange 2s infinite;
}

.fab-main-btn:hover {
    background: #e67e00;
    box-shadow: 0 6px 20px rgba(230, 126, 0, 0.6);
}

.fab-main-btn i {
    font-size: 18px;
}

@keyframes pulse-orange {
    0% { box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.6); }
    70% { box-shadow: 0 0 0 12px rgba(255, 140, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 140, 0, 0); }
}
