/* ==============================================
   MAIN LAYOUT STRUCTURE
   ============================================== */

/* Base body handling for SPA mode */
body.spa-app {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

main.page-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
    overscroll-behavior: auto;
    overscroll-behavior-y: auto;
    padding: 0;
}

/* Offline indicator positioning */
.offline-indicator {
    position: fixed;
    top: calc(12px + var(--safe-area-top));
    right: calc(12px + var(--safe-area-right));
    z-index: calc(var(--z-modal-stacked) + 48);
    display: none;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 10px;
    border-radius: var(--radius-standard);
    border: 1px solid var(--color-border-subtle);
    background: var(--bg-secondary);
    color: var(--color-text-strong);
    font-size: var(--text-xs);
    line-height: 1;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.offline-indicator.is-offline {
    border-color: var(--color-error-strong);
}

.offline-indicator-label {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.offline-indicator-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: var(--radius-standard);
    background: var(--color-error);
    color: var(--text-primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==============================================
   STANDARD PAGE CONTAINERS
   ============================================== */

/* The main scrollable container for pages */
.page-container {
    flex-grow: 1;
    width: 100%;
    background-color: var(--bg-primary);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    font-family: var(--font-primary);
    max-width: 100%;
    margin: 0 auto;
    padding:
        0
        var(--spa-shell-inset-inline-desktop)
        var(--page-container-bottom-desktop-current, var(--spa-shell-inset-bottom-desktop));
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

/* Inner content wrapper to constrain width on large screens */
.content-wrapper {
    max-width: var(--spa-shell-max-width);
    margin: var(--spa-shell-inset-top-desktop) auto 0;
    width: 100%;
}

.page-container--footer-nav {
    --page-container-bottom-desktop-current: var(--spa-shell-inset-bottom-footer-nav);
}

@media (max-width: 768px) {

    .page-container {
        padding: 0 0 var(--page-container-bottom-mobile-current, var(--spa-shell-inset-bottom-mobile));
    }

    .content-wrapper {
        max-width: var(--spa-shell-max-width-mobile);
        padding:
            var(--content-wrapper-top-mobile-current, var(--spa-shell-inset-top-mobile))
            var(--spa-shell-inset-inline-mobile);
        margin: 0 auto;
    }

    .page-container--footer-nav {
        --page-container-bottom-mobile-current: var(--spa-shell-inset-bottom-footer-nav);
    }

    .page-container--back-button {
        --content-wrapper-top-mobile-current: var(--spa-shell-inset-top-mobile-back-button);
    }
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.section-header h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-primary-text);
    margin: 0;
}
