/* ============================================
   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;
}

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

.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;
}

.header__logo-name {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--color-text-light);
    letter-spacing: -0.3px;
    line-height: 1.2;
    white-space: nowrap;
}

.header__logo-tagline {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.nav__item {
    position: relative;
}

.nav__link {
    display: block;
    padding: var(--space-2) var(--space-3);
    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;
}

.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: 300px;
    box-shadow: 0 22px 48px rgba(7, 16, 28, 0.18);
    border-radius: 20px;
    padding: 10px;
    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: 6px;
}

.nav__dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    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: 14px;
}

.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);
}

/* Level 2 Dropdown (Sub-menu) */
.nav__sub-dropdown {
    position: absolute;
    top: 0;
    left: calc(100% + 12px);
    background: var(--color-bg-card);
    min-width: 280px;
    box-shadow: 0 22px 48px rgba(7, 16, 28, 0.18);
    border-radius: 20px;
    padding: 10px;
    visibility: hidden;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1001;
    border: 1px solid var(--color-border-light);
}

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

.nav__dropdown-item:hover .nav__sub-dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

/* 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: 160px;
    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);
}

.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) {
    .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;
    }

    .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); }
}
