/* css/header.css */

/* Always load Baloo 2 for the header, regardless of which base CSS the page uses */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&display=swap');

/* Force consistent font on all header elements */
#app-header,
#app-header *,
.userSelectBtn,
.userDropdown button,
.back-btn,
.versionSelector select,
.versionSelector label,
.header-title {
    font-family: "Baloo 2", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 70px;
    padding: 0 25px;
    background: var(--card);
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    position: relative;
    gap: 10px;
}

#app-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
}

.header-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.header-zone.left {
    justify-content: flex-start;
}

.header-zone.center {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    line-height: 1.2;
}

.header-zone.right {
    justify-content: flex-end;
}

/* --- Left Zone --- */
.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 45px; /* Adjust as needed */
    width: auto;
}

.logo span {
    margin-right: 2px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 800;
    font-size: 16px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.55);
    border: 2px solid rgba(0, 0, 0, 0.08);
    height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    transition: all 0.15s ease;
    line-height: 1;
    white-space: nowrap;
}

.back-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}


/* --- Center Zone --- */
.breadcrumb {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    opacity: 0.8;
}

.header-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.2;
    letter-spacing: 0;
    text-shadow: none;
}

.meta {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

/* --- Right Zone --- */
.user-display {
    font-weight: 700;
    color: var(--text);
    background: rgba(255, 255, 255, 0.4);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.05);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ===== User dropdown ===== */
.userSelectWrap {
    position: relative;
    z-index: 60;
    display: flex;
    justify-content: flex-end;
}

.userSelectBtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 800;
    color: var(--text);
    background: rgba(255,255,255,.55);
    border: 2px solid rgba(0,0,0,.08);
    height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    box-shadow: 0 8px 16px rgba(0,0,0,.10);
    transition: transform .10s ease, background .12s ease, box-shadow .12s ease;
    font-size: 16px;
    cursor: pointer;
    font-family: "Baloo 2", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    white-space: nowrap;
}

.userSelectBtn:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,.75);
    box-shadow: 0 12px 22px rgba(0,0,0,.12);
}

.userSelectBtn:active {
    transform: translateY(0px);
}

.userDropdown{
    position:absolute;
    top:100%;
    right:0;
    left:auto;
    display:flex;
    flex-direction:column;
    align-items: stretch;
    gap:8px;
    padding:8px 0;
    min-width: 140px;
    z-index: 59;
}

.userDropdown button{
    background: #ffffff;
    border: 2px solid rgba(0,0,0,.08);
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    white-space: nowrap;
    text-align: left;
    box-sizing: border-box;
    color: var(--text);
    font-size: 16px;
    font-family: "Baloo 2", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    transition: background .12s ease;
}

.userDropdown button:hover{
    background: #a8dfff;
}

.hidden{
    display:none;
}

/* --- Version Selector --- */
.versionSelector {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.versionSelector label {
    font-weight: 800;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.versionSelector select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6258' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    border: 2px solid rgba(0,0,0,.08);
    height: 44px;
    padding: 0 36px 0 14px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    font-family: "Baloo 2", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    box-shadow: 0 4px 10px rgba(0,0,0,.07);
    transition: background .12s ease, box-shadow .12s ease;
}

.versionSelector select:hover {
    background-color: rgba(255,255,255,.75);
    box-shadow: 0 6px 14px rgba(0,0,0,.10);
}

.versionSelector select:focus {
    outline: none;
    border-color: rgba(240,124,74,.5);
    box-shadow: 0 0 0 3px rgba(240,124,74,.15);
}


@media (max-width: 768px) {
    #app-header {
        grid-template-columns: auto 1fr;
    }

    .back-btn {
        display: none !important;
    }

    .header-title {
        display: none !important;
    }

    /* collapse center zone if it only contained title */
    .header-zone.center {
        display: none;
    }

    /* Make the header grid just left (logo) and right (user) */
    #app-header {
        grid-template-columns: auto 1fr;
    }

    /* Since center is gone, push right zone to the end */
    .header-zone.right {
        justify-content: flex-end;
    }

    /* Hide version selector in header on mobile */
    .header-actions .versionSelector {
        display: none;
    }
}
