/* Explain: Styles for the app shell (sidebar, drawer, tab bar) used in Members and Admin areas. */
/* ============================================================
   App shell — shared by the members area and the admin back office.
   A tool sidebar on desktop, a slide-in drawer plus a bottom tab bar
   on phones and tablets, with one view shown at a time.
   ============================================================ */

.app-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
}

@media (max-width: 1023px) {
    .app-shell {
        padding-bottom: 4.75rem;
    }
}

@media (min-width: 1024px) {
    .app-shell {
        grid-template-columns: 16.5rem minmax(0, 1fr);
        gap: 1.75rem;
    }
}

/* ===== Sidebar ===== */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: min(19rem, 88vw);
    padding: 1.25rem 1rem;
    overflow-y: auto;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transform: translateX(-106%);
    transition: transform 0.3s ease;
}

.app-shell.is-drawer-open .app-sidebar {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .app-sidebar {
        position: sticky;
        top: 5.5rem;
        left: auto;
        bottom: auto;
        z-index: 1;
        width: auto;
        max-height: calc(100vh - 7rem);
        transform: none;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-xs);
    }
}

.app-scrim {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: none;
    background: rgba(12, 16, 48, 0.5);
}

.app-shell.is-drawer-open .app-scrim {
    display: block;
}

@media (min-width: 1024px) {
    .app-scrim {
        display: none !important;
    }
}

.app-sidebar-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.35rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.app-avatar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
}

.app-sidebar-name {
    display: block;
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-email {
    display: block;
    overflow: hidden;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.app-nav-section {
    margin: 1rem 0 0.35rem;
    padding-inline: 0.8rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    min-height: 42px;
    padding: 0.6rem 0.8rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.app-nav-link i {
    width: 1.15rem;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.92rem;
}

.app-nav-link:hover {
    background: var(--surface-alt);
    color: var(--text-color);
}

.app-nav-link.is-active {
    background: var(--primary-soft);
    color: var(--primary-color);
    font-weight: 700;
}

.app-sidebar-foot {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* ===== Main column ===== */
.app-main {
    min-width: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.15rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    box-shadow: var(--shadow-xs);
}

.app-topbar-title {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-color);
}

.app-topbar-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.app-menu-btn {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    color: var(--text-color);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.app-menu-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-color);
}

@media (min-width: 1024px) {
    .app-menu-btn {
        display: none;
    }
}

.app-views {
    min-width: 0;
}

.app-view > section {
    margin-top: 0;
}

/* ===== Bottom tab bar (phones & tablets) ===== */
.app-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.2rem;
    max-width: 34rem;
    margin-inline: auto;
    padding: 0.4rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -10px 28px -22px rgba(12, 16, 48, 0.6);
}

@media (min-width: 1024px) {
    .app-tabbar {
        display: none;
    }
}

.app-tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    min-height: 48px;
    padding: 0.3rem 0.15rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.64rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.18s ease, background 0.18s ease;
}

.app-tab-link i {
    font-size: 1.05rem;
}

.app-tab-link.is-active {
    color: var(--primary-color);
    background: var(--primary-soft);
}

/* ===== Overview helpers ===== */
.app-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem;
}

.app-hero-title {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text-color);
}

.app-section-title {
    margin-top: 2rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

@media print {
    .app-sidebar,
    .app-tabbar,
    .app-scrim {
        display: none !important;
    }
}