/* The Solutioners GRC — Header + Sidebar Layout */

/* ─── Top Header ─── */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #0f1923;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1100;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

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

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.header-brand img.brand-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

/* ─── Brand Flag Inline (after text) ─── */
.brand-flag-inline {
    width: 32px;
    height: 21px;
    object-fit: cover;
    border-radius: 3px;
    opacity: 0.85;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    flex-shrink: 0;
    margin-left: 2px;
}

.header-brand .brand-logo {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
    flex-shrink: 0;
}

.header-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.header-brand-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.12);
    margin: 0 4px;
}

.header-page-title {
    font-size: 13px;
    font-weight: 500;
    color: #e0e8f0;
    letter-spacing: 0.2px;
}

/* ─── Sidebar Toggle Button (in header) ─── */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    color: #e0e8f0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.08);
    color: #c0d0e0;
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* ─── Header Right ─── */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: #e0e8f0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.header-theme-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: #c0d0e0;
}

.header-theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* ─── Left Sidebar ─── */
.app-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 220px;
    background: #0b1420;
    border-right: 1px solid rgba(255,255,255,0.06);
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.app-sidebar::-webkit-scrollbar {
    width: 4px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.sidebar-nav {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
}

/* Section labels */
.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #4a5d70;
    letter-spacing: 1.2px;
    padding: 16px 16px 6px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-section-label:first-child {
    padding-top: 4px;
}

/* Nav links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: #e0e8f0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    margin: 1px 8px;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link:hover {
    color: #c0d0e0;
    background: rgba(255,255,255,0.06);
}

.sidebar-link.active {
    color: #ffffff;
    background: rgba(61, 165, 86, 0.15);
}

.sidebar-link.active .sidebar-icon {
    color: #3da556;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s ease;
}

/* ─── Content Area ─── */
.content-area {
    padding-top: 56px;
    margin-left: 220px;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

/* ─── Collapsed Sidebar ─── */
.sidebar-collapsed .app-sidebar {
    width: 60px;
}

.sidebar-collapsed .sidebar-section-label {
    opacity: 0;
    height: 12px;
    padding: 6px 0 0;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 10px;
    margin: 1px 6px;
}

.sidebar-collapsed .sidebar-label {
    display: none;
}

.sidebar-collapsed .content-area {
    margin-left: 60px;
}

/* ─── Sidebar Overlay (mobile) ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

.sidebar-overlay.active {
    display: block;
}

/* ─── Help Button ─── */
.header-help-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    color: #e0e8f0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.15s ease;
}

.header-help-btn:hover {
    background: rgba(61, 165, 86, 0.15);
    color: #ffffff;
    border-color: rgba(61, 165, 86, 0.3);
}

/* ─── Help Overlay ─── */
.help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: helpFadeIn 0.15s ease;
}

@keyframes helpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.help-modal {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .help-modal {
    background: #16213e;
    border: 1px solid rgba(255,255,255,0.08);
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

[data-theme="dark"] .help-header {
    border-bottom-color: rgba(255,255,255,0.08);
}

.help-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a5f2a;
    margin: 0;
}

[data-theme="dark"] .help-header h3 {
    color: #3da556;
}

.help-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #000000;
    line-height: 1;
    padding: 4px;
}

.help-close:hover {
    color: #333;
}

[data-theme="dark"] .help-close:hover {
    color: #e0e0e0;
}

.help-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.help-section {
    margin-bottom: 16px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

[data-theme="dark"] .help-section h4 {
    color: #e0e0e0;
}

.help-section p {
    font-size: 0.85rem;
    color: #000000;
    line-height: 1.6;
    margin: 0;
}

[data-theme="dark"] .help-section p {
    color: #e0e8f0;
}

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
    .app-sidebar {
        width: 260px;
        left: -260px;
        transition: left 0.25s ease;
    }

    .app-sidebar.mobile-open {
        left: 0;
    }

    .content-area {
        margin-left: 0 !important;
    }

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

    .header-page-title {
        display: none;
    }

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

    .header-project-selector {
        min-width: 120px !important;
        max-width: 160px !important;
    }
}

/* ─── Global Project Selector ─── */
.header-project-selector {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    min-width: 180px;
    max-width: 250px;
    margin-right: 12px;
    transition: all 0.2s;
}

.header-project-selector:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--primary-green);
}

.header-project-selector:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(61,165,86,0.2);
}

.header-project-selector option {
    background: #1a2a3a;
    color: #e0e8f0;
}

/* ─── Light Theme Overrides ─── */

[data-theme="light"] .app-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="light"] .header-brand-name {
    color: #1a2b3c;
}

[data-theme="light"] .brand-flag-inline {
    opacity: 0.9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

[data-theme="light"] .header-page-title {
    color: #000000;
}

[data-theme="light"] .header-brand-divider {
    background: #d1d9e0;
}

[data-theme="light"] .sidebar-toggle {
    color: #000000;
}

[data-theme="light"] .sidebar-toggle:hover {
    background: rgba(0,0,0,0.06);
    color: #1a2b3c;
}

[data-theme="light"] .header-theme-toggle {
    background: rgba(0,0,0,0.04);
    border-color: #d1d9e0;
    color: #000000;
}

[data-theme="light"] .header-theme-toggle:hover {
    background: rgba(0,0,0,0.08);
    color: #1a2b3c;
}

[data-theme="light"] .header-help-btn {
    background: rgba(0,0,0,0.04);
    border-color: #d1d9e0;
    color: #000000;
}

[data-theme="light"] .header-help-btn:hover {
    background: rgba(26,95,42,0.1);
    color: #1a5f2a;
    border-color: rgba(26,95,42,0.3);
}

[data-theme="light"] .header-project-selector {
    background: #f5f7fa;
    border-color: #d1d9e0;
    color: #1a2b3c;
}

[data-theme="light"] .header-project-selector:hover {
    background: #edf0f4;
    border-color: #1a5f2a;
}

[data-theme="light"] .header-project-selector option {
    background: #ffffff;
    color: #1a2b3c;
}

[data-theme="light"] .app-sidebar {
    background: #f5f7fa;
    border-right: 1px solid #e2e8f0;
}

[data-theme="light"] .app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
}

[data-theme="light"] .sidebar-section-label {
    color: #000000;
}

[data-theme="light"] .sidebar-link {
    color: #000000;
}

[data-theme="light"] .sidebar-link:hover {
    color: #1a2b3c;
    background: rgba(0,0,0,0.05);
}

[data-theme="light"] .sidebar-link.active {
    color: #1a5f2a;
    background: rgba(26,95,42,0.08);
}

[data-theme="light"] .sidebar-link.active .sidebar-icon {
    color: #1a5f2a;
}
