/*
 * Agoogi Header Utilities v1
 * Adds weather + account dropdown without replacing the existing navigation.
 */

.header-brand-row .brand-container {
    justify-content: space-between !important;
}

.header-brand-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.header-weather-widget,
.header-account-menu {
    position: relative;
}

.header-weather-widget > summary,
.header-account-menu > summary {
    list-style: none;
}

.header-weather-widget > summary::-webkit-details-marker,
.header-account-menu > summary::-webkit-details-marker {
    display: none;
}

/* Weather chip */
.header-weather-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 7px 11px;
    border: 1px solid #dbe3ee;
    border-radius: 15px;
    background: linear-gradient(145deg, #ffffff, #f6fbff);
    color: #0f172a;
    box-shadow: 0 5px 16px rgba(15, 23, 42, .05);
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.header-weather-summary:hover,
.header-weather-summary:focus-visible,
.header-weather-widget[open] .header-weather-summary {
    border-color: #7dd3fc;
    box-shadow: 0 8px 22px rgba(3, 105, 161, .11);
}

.header-weather-summary:focus-visible,
.header-account-summary:focus-visible {
    outline: 3px solid rgba(14, 165, 233, .28);
    outline-offset: 2px;
}

.header-weather-icon {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: #e0f7ff;
    font-size: 18px;
    line-height: 1;
}

.header-weather-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.header-weather-copy strong {
    font-size: 15px;
}

.header-weather-copy small {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #64748b;
    font-size: 11px;
    white-space: nowrap;
}

.header-weather-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1500;
    width: min(340px, calc(100vw - 24px));
    padding: 16px;
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 24px 55px rgba(15, 23, 42, .16);
    backdrop-filter: blur(12px);
}

.header-weather-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.header-weather-panel-heading > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.header-weather-panel-heading strong {
    font-size: 17px;
    line-height: 1.25;
}

.header-weather-panel-heading small {
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
}

.header-weather-panel-icon {
    font-size: 32px;
    line-height: 1;
}

.header-weather-condition {
    margin: 13px 0 12px;
    color: #0369a1;
    font-weight: 800;
}

.header-weather-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.header-weather-facts span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 9px 10px;
    border-radius: 12px;
    background: #f8fafc;
}

.header-weather-facts small {
    color: #64748b;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.header-weather-facts strong {
    margin-top: 2px;
    font-size: 13px;
}

.header-weather-note,
.header-weather-credit {
    margin: 11px 0 0;
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}

.header-weather-credit a {
    color: #0369a1;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Desktop account dropdown */
.header-account-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 6px 10px 6px 7px;
    border: 1px solid #dbe3ee;
    border-radius: 15px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 5px 16px rgba(15, 23, 42, .045);
    cursor: pointer;
}

.header-account-summary:hover,
.header-account-menu[open] .header-account-summary {
    border-color: #94a3b8;
    background: #f8fafc;
}

.header-account-avatar {
    display: grid;
    place-items: center;
    width: 33px;
    height: 33px;
    flex: 0 0 33px;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(145deg, #0f172a, #0369a1);
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
}

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

.header-account-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.08;
    text-align: left;
}

.header-account-copy small {
    color: #64748b;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.header-account-copy strong {
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    white-space: nowrap;
}

.header-account-chevron {
    color: #64748b;
    font-size: 14px;
}

.header-account-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1500;
    width: min(390px, calc(100vw - 24px));
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    background: rgba(255, 255, 255, .99);
    box-shadow: 0 24px 55px rgba(15, 23, 42, .16);
}

.header-account-heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 4px 4px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.header-account-heading strong,
.header-account-heading small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-account-heading strong {
    font-size: 15px;
}

.header-account-heading small {
    color: #64748b;
    font-size: 11px;
}

.header-account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 11px 0;
}

.header-account-grid a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #ffffff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
}

.header-account-grid a:hover,
.header-account-grid a:focus-visible {
    border-color: #bae6fd;
    background: #f0f9ff;
    color: #0369a1;
}

.header-account-logout {
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.header-account-logout button {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    background: #0f172a;
    color: #ffffff;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.header-account-logout button:hover,
.header-account-logout button:focus-visible {
    background: #1e293b;
}

/* The account list now lives in the brand row on desktop. */
@media (min-width: 901px) {
    .mobile-account-dropdown {
        display: none !important;
    }
}

/* Mobile keeps account options inside the existing off-canvas drawer. */
@media (max-width: 900px) {
    .desktop-account-menu {
        display: none !important;
    }

    .header-brand-actions {
        gap: 6px;
    }

    .header-weather-summary {
        min-height: 42px;
        padding: 5px 8px;
        gap: 6px;
    }

    .header-weather-icon {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .header-weather-copy small {
        display: none;
    }

    .header-weather-copy strong {
        font-size: 13px;
    }

    .header-weather-panel {
        position: fixed;
        top: 82px;
        right: 10px;
        width: min(330px, calc(100vw - 20px));
    }

    .mobile-account-dropdown > summary small {
        margin-left: auto;
        margin-right: 8px;
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
    }

    .mobile-account-menu {
        max-height: none !important;
    }

    .mobile-account-logout {
        margin: 6px 0 0 !important;
        width: 100% !important;
    }

    .mobile-account-logout .nav-link-button {
        justify-content: center !important;
        border-color: #0f172a !important;
        background: #0f172a !important;
        color: #ffffff !important;
    }
}

@media (max-width: 620px) {
    .brand span {
        display: none;
    }

    .header-brand-row .site-logo,
    .header-brand-row .brand img {
        height: 52px !important;
        max-height: 52px !important;
        max-width: 145px !important;
    }

    .header-brand-row .brand-container {
        width: min(100%, 96%) !important;
        gap: 8px !important;
    }
}

@media (max-width: 390px) {
    .header-weather-copy {
        display: none;
    }

    .header-weather-summary {
        width: 40px;
        justify-content: center;
        padding-inline: 5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-weather-summary {
        transition: none;
    }
}
