/* =========================================================
   AluminiumGlass
   HEADER.CSS
   Global Public Website Header
   ========================================================= */

/* ---------------------------------------------------------
   Header Variables
   --------------------------------------------------------- */

:root {
    --header-height: 72px;
    --header-bg: #ffffff;
    --header-border: #e5e7eb;
    --header-text: #111827;
    --header-muted: #6b7280;
    --header-primary: #2563eb;
    --header-primary-hover: #1d4ed8;
    --header-hover-bg: #f3f4f6;
    --header-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --header-z-index: 1000;
}


/* ---------------------------------------------------------
   Main Header
   --------------------------------------------------------- */

.site-header {
    width: 100%;
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    position: relative;
    z-index: var(--header-z-index);
}

.site-header.is-sticky {
    position: sticky;
    top: 0;
}


/* ---------------------------------------------------------
   Header Container
   --------------------------------------------------------- */

.header-container {
    width: 100%;
    max-width: 1440px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}


/* ---------------------------------------------------------
   Brand / Logo
   --------------------------------------------------------- */

.header-brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    color: var(--header-text);
}

.header-brand:hover {
    text-decoration: none;
}

.header-logo {
    display: block;
    width: auto;
    max-width: 190px;
    max-height: 48px;
    object-fit: contain;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.header-brand-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--header-text);
    letter-spacing: -0.3px;
}

.header-brand-tagline {
    margin-top: 3px;
    font-size: 11px;
    color: var(--header-muted);
    font-weight: 500;
}


/* ---------------------------------------------------------
   Main Header Navigation Area
   --------------------------------------------------------- */

.header-main {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
    gap: 20px;
}


/* ---------------------------------------------------------
   Header Search
   --------------------------------------------------------- */

.header-search {
    display: flex;
    align-items: center;
    width: min(100%, 480px);
    min-width: 220px;
}

.header-search-form {
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;

    background: #ffffff;
    border: 1px solid var(--header-border);
    border-radius: 10px;

    overflow: hidden;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.header-search-form:focus-within {
    border-color: var(--header-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.header-search-icon {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
    color: var(--header-muted);
}

.header-search-icon svg {
    width: 20px;
    height: 20px;
}

.header-search-input {
    width: 100%;
    height: 100%;

    padding: 0 12px;

    border: 0;
    outline: 0;
    background: transparent;

    color: var(--header-text);
    font-size: 14px;
}

.header-search-input::placeholder {
    color: #9ca3af;
}

.header-search-button {
    height: 36px;
    min-width: 72px;

    margin-right: 4px;
    padding: 0 14px;

    border: 0;
    border-radius: 8px;

    background: var(--header-primary);
    color: #ffffff;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

.header-search-button:hover {
    background: var(--header-primary-hover);
}

.header-search-button:active {
    transform: scale(0.98);
}


/* ---------------------------------------------------------
   Navigation
   --------------------------------------------------------- */

.header-nav {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header-nav-list {
    display: flex;
    align-items: center;
    gap: 4px;

    margin: 0;
    padding: 0;

    list-style: none;
}

.header-nav-item {
    position: relative;
}

.header-nav-link {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    padding: 0 12px;

    border-radius: 8px;

    color: var(--header-text);
    text-decoration: none;

    font-size: 14px;
    font-weight: 600;

    white-space: nowrap;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.header-nav-link:hover,
.header-nav-link.active {
    background: var(--header-hover-bg);
    color: var(--header-primary);
}

.header-nav-link:focus-visible {
    outline: 2px solid var(--header-primary);
    outline-offset: 2px;
}


/* ---------------------------------------------------------
   Dropdown Arrow
   --------------------------------------------------------- */

.header-nav-arrow {
    width: 14px;
    height: 14px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    transition: transform 0.2s ease;
}

.header-nav-item:hover .header-nav-arrow {
    transform: rotate(180deg);
}


/* ---------------------------------------------------------
   Dropdown Menu
   --------------------------------------------------------- */

.header-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;

    width: 220px;

    padding: 8px;

    background: #ffffff;
    border: 1px solid var(--header-border);
    border-radius: 10px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.10);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-5px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;
}

.header-nav-item:hover > .header-dropdown,
.header-nav-item:focus-within > .header-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.header-dropdown-link {
    width: 100%;
    min-height: 40px;

    display: flex;
    align-items: center;

    padding: 0 12px;

    border-radius: 7px;

    color: var(--header-text);
    text-decoration: none;

    font-size: 14px;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.header-dropdown-link:hover {
    background: var(--header-hover-bg);
    color: var(--header-primary);
}


/* ---------------------------------------------------------
   Header Actions
   --------------------------------------------------------- */

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-action {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    padding: 0 12px;

    border: 1px solid transparent;
    border-radius: 8px;

    background: transparent;
    color: var(--header-text);

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.header-action:hover {
    background: var(--header-hover-bg);
    color: var(--header-primary);
}

.header-action-primary {
    background: var(--header-primary);
    color: #ffffff;
}

.header-action-primary:hover {
    background: var(--header-primary-hover);
    color: #ffffff;
}

.header-action-outline {
    border-color: var(--header-border);
}

.header-action-outline:hover {
    border-color: var(--header-primary);
}


/* ---------------------------------------------------------
   Header Icon Button
   --------------------------------------------------------- */

.header-icon-button {
    position: relative;

    width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: var(--header-text);

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.header-icon-button:hover {
    background: var(--header-hover-bg);
    color: var(--header-primary);
}

.header-icon-button svg {
    width: 20px;
    height: 20px;
}


/* ---------------------------------------------------------
   Notification Badge
   --------------------------------------------------------- */

.header-notification-badge {
    position: absolute;
    top: 4px;
    right: 3px;

    min-width: 17px;
    height: 17px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 4px;

    border: 2px solid #ffffff;
    border-radius: 999px;

    background: #dc2626;
    color: #ffffff;

    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}


/* ---------------------------------------------------------
   User Account
   --------------------------------------------------------- */

.header-user {
    position: relative;
}

.header-user-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    min-height: 42px;

    padding: 4px 8px 4px 5px;

    border: 0;
    border-radius: 10px;

    background: transparent;

    cursor: pointer;

    transition: background 0.2s ease;
}

.header-user-button:hover {
    background: var(--header-hover-bg);
}

.header-user-avatar {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 50%;

    background: #e5e7eb;
    color: var(--header-text);

    font-size: 13px;
    font-weight: 700;
}

.header-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    min-width: 0;
}

.header-user-name {
    max-width: 120px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: var(--header-text);

    font-size: 13px;
    font-weight: 700;
}

.header-user-role {
    margin-top: 1px;

    color: var(--header-muted);

    font-size: 11px;
}


/* ---------------------------------------------------------
   User Dropdown
   --------------------------------------------------------- */

.header-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;

    width: 230px;

    padding: 8px;

    background: #ffffff;
    border: 1px solid var(--header-border);
    border-radius: 10px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.10);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-5px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;
}

.header-user:hover .header-user-menu,
.header-user:focus-within .header-user-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.header-user-menu-link {
    min-height: 40px;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 0 12px;

    border-radius: 7px;

    color: var(--header-text);
    text-decoration: none;

    font-size: 14px;
}

.header-user-menu-link:hover {
    background: var(--header-hover-bg);
    color: var(--header-primary);
}

.header-user-menu-divider {
    height: 1px;

    margin: 7px 0;

    background: var(--header-border);
}


/* ---------------------------------------------------------
   Mobile Menu Toggle
   --------------------------------------------------------- */

.header-menu-toggle {
    width: 42px;
    height: 42px;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid var(--header-border);
    border-radius: 8px;

    background: #ffffff;
    color: var(--header-text);

    cursor: pointer;
}

.header-menu-toggle:hover {
    background: var(--header-hover-bg);
}

.header-menu-toggle span,
.header-menu-toggle::before,
.header-menu-toggle::after {
    content: "";

    position: absolute;

    width: 20px;
    height: 2px;

    border-radius: 2px;

    background: currentColor;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.header-menu-toggle {
    position: relative;
}

.header-menu-toggle span {
    position: relative;
}

.header-menu-toggle::before {
    transform: translateY(-6px);
}

.header-menu-toggle::after {
    transform: translateY(6px);
}

.header-menu-toggle.is-active span {
    opacity: 0;
}

.header-menu-toggle.is-active::before {
    transform: rotate(45deg);
}

.header-menu-toggle.is-active::after {
    transform: rotate(-45deg);
}


/* ---------------------------------------------------------
   Mobile Navigation Panel
   --------------------------------------------------------- */

.mobile-navigation {
    display: none;

    width: 100%;

    background: #ffffff;
    border-top: 1px solid var(--header-border);
    border-bottom: 1px solid var(--header-border);

    box-shadow: var(--header-shadow);
}

.mobile-navigation.is-open {
    display: block;
}

.mobile-navigation-list {
    margin: 0;
    padding: 8px 16px;

    list-style: none;
}

.mobile-navigation-link {
    width: 100%;
    min-height: 44px;

    display: flex;
    align-items: center;

    padding: 0 12px;

    border-radius: 8px;

    color: var(--header-text);
    text-decoration: none;

    font-size: 15px;
    font-weight: 600;
}

.mobile-navigation-link:hover,
.mobile-navigation-link.active {
    background: var(--header-hover-bg);
    color: var(--header-primary);
}


/* ---------------------------------------------------------
   Header CTA
   --------------------------------------------------------- */

.header-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;

    padding: 0 16px;

    border: 0;
    border-radius: 8px;

    background: var(--header-primary);
    color: #ffffff;

    text-decoration: none;

    font-size: 14px;
    font-weight: 700;

    white-space: nowrap;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

.header-cta:hover {
    background: var(--header-primary-hover);
    color: #ffffff;
}

.header-cta:active {
    transform: translateY(1px);
}


/* ---------------------------------------------------------
   Location Selector
   --------------------------------------------------------- */

.header-location {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    min-height: 40px;

    padding: 0 10px;

    border: 0;
    border-radius: 8px;

    background: transparent;

    color: var(--header-text);

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

.header-location:hover {
    background: var(--header-hover-bg);
    color: var(--header-primary);
}

.header-location-icon {
    width: 18px;
    height: 18px;

    flex-shrink: 0;
}

.header-location-text {
    max-width: 130px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ---------------------------------------------------------
   Header Overlay
   --------------------------------------------------------- */

.header-overlay {
    position: fixed;
    inset: 0;

    z-index: calc(var(--header-z-index) - 1);

    background: rgba(0, 0, 0, 0.45);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.header-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}


/* ---------------------------------------------------------
   Accessibility
   --------------------------------------------------------- */

.header-nav-link:focus,
.header-action:focus,
.header-icon-button:focus,
.header-user-button:focus,
.header-location:focus,
.header-cta:focus {
    outline: 2px solid var(--header-primary);
    outline-offset: 2px;
}

.header-nav-link:focus:not(:focus-visible),
.header-action:focus:not(:focus-visible),
.header-icon-button:focus:not(:focus-visible),
.header-user-button:focus:not(:focus-visible),
.header-location:focus:not(:focus-visible),
.header-cta:focus:not(:focus-visible) {
    outline: none;
}


/* ---------------------------------------------------------
   Reduced Motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .header-nav-arrow,
    .header-dropdown,
    .header-user-menu,
    .header-menu-toggle span,
    .header-menu-toggle::before,
    .header-menu-toggle::after,
    .header-overlay {
        transition: none;
    }
}


/* ---------------------------------------------------------
   Tablet
   --------------------------------------------------------- */

@media (max-width: 1100px) {

    .header-container {
        padding: 0 18px;
        gap: 16px;
    }

    .header-search {
        width: min(100%, 350px);
    }

    .header-nav-link {
        padding: 0 9px;
        font-size: 13px;
    }

    .header-user-info {
        display: none;
    }

    .header-action {
        padding: 0 9px;
    }
}


/* ---------------------------------------------------------
   Mobile
   --------------------------------------------------------- */

@media (max-width: 768px) {

    :root {
        --header-height: 62px;
    }

    .site-header {
        height: var(--header-height);
    }

    .header-container {
        padding: 0 14px;
        gap: 10px;
    }

    .header-logo {
        max-width: 145px;
        max-height: 42px;
    }

    .header-brand-name {
        font-size: 19px;
    }

    .header-brand-tagline {
        display: none;
    }

    .header-main {
        gap: 6px;
    }

    .header-search {
        display: none;
    }

    .header-nav {
        display: none;
    }

    .header-actions {
        gap: 4px;
    }

    .header-action {
        display: none;
    }

    .header-cta {
        display: none;
    }

    .header-location {
        display: none;
    }

    .header-user-info {
        display: none;
    }

    .header-user-button {
        padding: 3px;
    }

    .header-menu-toggle {
        display: inline-flex;
    }

    .mobile-navigation {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;

        z-index: var(--header-z-index);

        max-height: calc(100vh - var(--header-height));

        overflow-y: auto;
    }

    .mobile-navigation.is-open {
        display: block;
    }
}


/* ---------------------------------------------------------
   Small Mobile
   --------------------------------------------------------- */

@media (max-width: 480px) {

    .header-container {
        padding: 0 10px;
    }

    .header-logo {
        max-width: 125px;
    }

    .header-brand-name {
        font-size: 18px;
    }

    .header-icon-button {
        width: 38px;
        height: 38px;
    }

    .header-user-avatar {
        width: 32px;
        height: 32px;
    }

    .mobile-navigation-list {
        padding-left: 10px;
        padding-right: 10px;
    }
}


/* ---------------------------------------------------------
   Print
   --------------------------------------------------------- */

@media print {

    .site-header {
        height: auto;

        border: 0;
        box-shadow: none;

        position: static;
    }

    .header-search,
    .header-nav,
    .header-actions,
    .header-menu-toggle,
    .mobile-navigation {
        display: none !important;
    }

    .header-container {
        justify-content: flex-start;
        padding: 0;
    }
}