/* ============================================================================
   SkillsPassport - ISOLATED UNIFIED HEADER CSS (sph- prefix)
   ============================================================================ */

:root {
    --sph-bg: #2d2d2d;
    --sph-text: #ffffff;
    --sph-primary: #B91C1C;
    --sph-primary-dark: #991B1B;
    --sph-bg-white: #ffffff;
    --sph-text-primary: #333333;
    --sph-text-secondary: #666666;
    --sph-text-muted: #999999;
    --sph-radius-md: 8px;
    --sph-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --sph-z-sticky: 3000;
    --sph-z-dropdown: 3100;
}

/* MAIN CONTAINER - STRICTLY FLAT & DARK */
.sph-navbar {
    background-color: var(--sph-bg) !important;
    background: var(--sph-bg) !important;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: var(--sph-z-sticky);
    height: 60px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 0 !important;
}

.sph-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-decoration: none !important;
}

.sph-logo-box {
    width: 38px;
    height: 38px;
    background: var(--sph-bg-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    overflow: hidden;
    /* Ensure image fits shape */
}

.sph-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sph-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sph-text);
    letter-spacing: -0.01em;
}

.sph-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sph-user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    transition: background 0.2s;
}

.sph-user-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sph-avatar-box {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.sph-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sph-chevron {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

/* User Dropdown */
.sph-dropdown {
    position: absolute;
    top: 100%;
    right: 16px;
    width: 280px;
    background: #fff;
    border-radius: var(--sph-radius-md);
    box-shadow: var(--sph-shadow-lg);
    margin-top: 8px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    z-index: var(--sph-z-dropdown);
    border: 1px solid #e2e8f0;
}

.sph-dropdown.active {
    display: flex !important;
}

.sph-dropdown-header {
    padding: 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.sph-dropdown-header strong {
    display: block;
    color: var(--sph-text-primary);
    font-size: 0.95rem;
}

.sph-dropdown-header span {
    display: block;
    color: var(--sph-text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

.sph-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

.sph-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sph-text-primary);
    font-size: 0.85rem;
    transition: background 0.2s;
    text-decoration: none !important;
}

.sph-item:hover {
    background: #f1f5f9;
    color: var(--sph-primary);
}

.sph-item i {
    width: 20px;
    text-align: center;
    color: #64748b;
}

.sph-item:hover i {
    color: var(--sph-primary);
}

/* Nested Subitems */
.sph-item-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.sph-item-row .sph-item {
    flex: 1;
}

.sph-item-toggle {
    background: none;
    border: none;
    padding: 0 16px;
    height: 40px;
    color: #64748b;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sph-item-toggle:hover {
    color: var(--sph-primary);
}

.sph-menu-group.active .sph-item-toggle {
    transform: rotate(90deg);
}

.sph-sub-container {
    background: #fafafa;
    border-left: 3px solid #e2e8f0;
    margin-left: 8px;
    display: none;
    /* COLLAPSED BY DEFAULT */
}

.sph-menu-group.active .sph-sub-container {
    display: block;
}

.sph-subitem {
    padding: 8px 16px 8px 32px;
    font-size: 0.8rem;
}

.sph-item.active,
.sph-subitem.active {
    background: #fef2f2;
    color: var(--sph-primary);
    font-weight: 600;
}

/* Modal */
.sph-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    backdrop-filter: blur(4px);
}

.sph-modal-overlay.active {
    display: flex;
}

.sph-modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.sph-modal-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
}

.sph-modal-title {
    font-weight: 600;
    margin: 0;
}

.sph-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

.sph-modal-body {
    padding: 20px;
}

.sph-role-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.sph-role-option {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
}

.sph-role-option:hover,
.sph-role-option.active {
    background: #fef2f2;
    border-color: var(--sph-primary);
}