/**
 * Unified Portal Header Styles
 * Shared header styling for all Umzug 247 portals
 */

/* ============================================
   Header Container
   ============================================ */
.portal-header {
    background: #fff;
    border-bottom: 4px solid #adb5bd;
    height: 95px;
    position: relative;
}

/* ============================================
   Role Status Bar (admin/verifier viewing user portal)
   ============================================ */
.header-role-bar {
    background: #198754;
    color: #fff;
    padding: 4px 16px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-role-bar i {
    margin-right: 4px;
}

.header-role-separator {
    opacity: 0.6;
}

.header-role-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
}

/* ============================================
   Logo Section
   ============================================ */
.header-logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 8px;
}

.header-logo-section img {
    max-height: 40px;
    width: auto;
}

.header-portal-name {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-top: 2px;
    font-weight: 500;
}

/* ============================================
   Menu Container
   ============================================ */
.header-menu-container {
    height: 100%;
    padding: 10px 4px 12px 4px;
    /* Align with container-xl content area below */
    margin-left: max(12px, calc((100% - 1320px) / 2 + 12px));
}

/* ============================================
   Menu Buttons
   ============================================ */
.header-menu-btn {
    --header-btn-bg: #0077b6;
    --arrow-size: 12px;
    background: var(--header-btn-bg);
    color: #fff;
    border: none;
    border-radius: 6px 0 0 6px;
    padding: 8px 16px;
    padding-right: calc(16px + var(--arrow-size));
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 500;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap;
    position: relative;
    clip-path: polygon(0 0, calc(100% - var(--arrow-size)) 0, 100% 50%, calc(100% - var(--arrow-size)) 100%, 0 100%);
}

/* Remove arrow shape from Request Quotes button (all states and data-action values) */
/* Note: data-action changes from "submitRequest" to "quotesRequested" or "verificationComplete" after submission */
.header-menu-btn[data-action="submitRequest"],
.header-menu-btn[data-action="quotesRequested"],
.header-menu-btn[data-action="verificationComplete"],
.header-menu-btn.no-arrow {
    clip-path: none !important;
    border-radius: 6px !important;
    padding-right: 16px !important;
}

.header-menu-btn:hover {
    opacity: 0.85;
}

.header-menu-btn:active {
    transform: scale(0.98);
}

.header-menu-btn i {
    font-size: 1rem;
    flex-shrink: 0;
}

.header-menu-btn.active {
    box-shadow: 0 0 0 2px rgba(0, 119, 182, 0.5);
}

/* Status colors - completeness indicators */
.header-menu-btn.status-complete {
    --header-btn-bg: #28a745;
}

.header-menu-btn.status-incomplete {
    --header-btn-bg: #dc3545;
}

/* ============================================
   User Section
   ============================================ */
.header-user-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    padding: 10px 8px 12px 8px;
}

.header-system-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.header-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    transition: background-color 0.3s;
}

.header-status-dot.connected {
    background: #28a745;
}

.header-user-btn {
    background: #f0a500;
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    width: calc(100% - 8px);
    cursor: default;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Actions Section (Profile/Logout)
   ============================================ */
.header-actions-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    padding: 10px 4px 12px 4px;
    gap: 4px;
}

/* Profile/Logout buttons same size as menu buttons */
.header-profile-btn,
.header-logout-btn {
    /* Inherit all from .header-menu-btn, no overrides needed */
}

/* ============================================
   Language Selector Tab
   ============================================ */
.header-lang-tab {
    position: absolute;
    top: 0;
    right: 16px;
    background: #f8f9fa;
    border: 1px solid #adb5bd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 4px 12px;
    font-size: 0.9rem;
    z-index: 100;
}

.header-lang-tab:hover {
    background: #e9ecef;
}

.header-lang-tab .btn {
    font-size: inherit;
    line-height: 1;
}

.header-lang-tab .dropdown-menu {
    font-size: 0.9rem;
    min-width: 120px;
}

.header-lang-tab .dropdown-item.active {
    background-color: #0077b6;
}

/* ============================================
   Dropdown Menus
   ============================================ */
.header-dropdown {
    position: relative;
    width: 100%;
}

.header-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    padding: 4px 0;
}

.header-dropdown.open .header-dropdown-menu {
    display: block;
}

.header-dropdown-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.15s;
    color: #212529;
}

.header-dropdown-item:hover {
    background: #f8f9fa;
}

/* Status colors for dropdown items */
.header-dropdown-item.status-complete {
    border-left: 3px solid #28a745;
}

.header-dropdown-item.status-incomplete {
    border-left: 3px solid #dc3545;
}

/* Dropdown caret icon */
.header-menu-btn[data-dropdown] .fa-caret-down {
    margin-left: 2px;
    font-size: 0.7rem;
    opacity: 0.8;
}

/* ============================================
   Mobile Toggle Button
   ============================================ */
.header-mobile-toggle {
    display: none;
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1.2rem;
    color: #495057;
    cursor: pointer;
    z-index: 100;
}

.header-mobile-toggle:hover {
    background: #e9ecef;
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */
@media (max-width: 991.98px) {
    .portal-header {
        height: auto;
        min-height: auto;
        padding: 12px 0;
    }

    .portal-header > .container-fluid > .row {
        flex-wrap: wrap;
        flex-direction: column;
    }

    /* Logo section - centered on top */
    .header-logo-section {
        flex: 0 0 auto;
        width: 100%;
        padding: 0 16px 8px 16px;
        flex-direction: row;
        justify-content: center;
        border-bottom: 1px solid #dee2e6;
        margin-bottom: 8px;
    }

    .header-logo-section img {
        max-height: 36px;
    }

    .header-portal-name {
        font-size: 0.7rem;
        margin-left: 8px;
        margin-top: 0;
    }

    /* Menu container - wrap on mobile */
    .header-menu-container {
        width: 100%;
        padding: 8px 16px;
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 8px !important;
    }

    .header-menu-container .header-menu-btn,
    .header-menu-container .header-dropdown {
        flex: 1 1 auto;
        min-width: 120px;
    }

    .header-menu-btn {
        font-size: 0.85rem;
        padding: 10px 12px;
        padding-right: 12px;
        border-radius: 6px;
        justify-content: center;
        width: 100%;
        clip-path: none;
    }

    .header-menu-btn i {
        font-size: 1rem;
        margin-right: 8px;
    }

    /* User section - full width row */
    .header-user-section {
        display: flex;
        width: 100%;
        padding: 8px 16px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 12px;
        border-top: 1px solid #dee2e6;
        margin-top: 8px;
    }

    .header-system-status {
        font-size: 0.7rem;
        margin-bottom: 0;
    }

    .header-user-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
        width: auto;
    }

    /* Actions section - full width row */
    .header-actions-section {
        display: flex;
        width: 100%;
        padding: 8px 16px;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
    }

    .header-actions-section .header-menu-btn {
        width: auto;
        min-width: 100px;
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    /* HIDE mobile toggle - menu always visible */
    .header-mobile-toggle {
        display: none !important;
    }

    /* Language tab repositioning for mobile */
    .header-lang-tab {
        right: 16px;
        top: 8px;
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    /* Dropdown adjustments for mobile */
    .header-dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        background: #f8f9fa;
        border-radius: 0;
        margin-top: 4px;
        width: 100%;
    }

    .header-dropdown-item {
        font-size: 0.8rem;
        padding: 8px 16px;
    }
}

/* Extra small devices */
@media (max-width: 575.98px) {
    .portal-header {
        padding: 8px 0;
    }

    .header-logo-section {
        padding: 0 12px 6px 12px;
    }

    .header-logo-section img {
        max-height: 30px;
    }

    .header-portal-name {
        font-size: 0.6rem;
    }

    .header-menu-container {
        padding: 6px 12px;
        gap: 6px !important;
    }

    .header-menu-btn {
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    .header-menu-btn i {
        font-size: 0.9rem;
    }

    .header-user-section,
    .header-actions-section {
        padding: 6px 12px;
    }

    .header-user-btn {
        font-size: 0.7rem;
        padding: 6px 10px;
    }

    .header-actions-section .header-menu-btn {
        font-size: 0.7rem;
        padding: 6px 10px;
        min-width: 80px;
    }

    .header-system-status {
        font-size: 0.6rem;
    }

    .header-lang-tab {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.header-hidden {
    display: none !important;
}

.header-visible {
    display: flex !important;
}
