/* ============================================================================
 * App Shell — sticky top header + bottom navigation
 *
 * Used by:
 *   - header-app.php
 *   - template-parts/footer/bottom-nav.php
 *
 * Loaded globally by enqueue_custom_styles() in functions.php so every
 * mobile-template page picks up the same shell.
 * ============================================================================ */

:root {
    --hp-app-header-h: 56px;   /* fixed bar — fits logo + avatar */
    --hp-app-content-gap: 4px; /* space between header bottom and page content (56 + 4 = 60px) */
    --hp-app-content-offset: calc(var(--hp-app-header-h) + var(--hp-app-content-gap));
    --hp-photo-size: 80px;
    --hp-photo-radius: 12px;
    --hp-border-subtle: #e9ecef;
    --hp-text-muted: #6c757d;
    --hp-surface-muted: #f8f9fa;
}

/* Shared empty / placeholder patterns (members directory, profile viewer) */
.hp-empty-message {
    margin: 0;
    padding: 20px 16px;
    text-align: center;
    font-size: 0.9375rem;
    color: var(--hp-text-muted);
    line-height: 1.45;
}
.hp-photo-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--hp-photo-size);
    height: var(--hp-photo-size);
    border-radius: var(--hp-photo-radius);
    background: linear-gradient(145deg, #6c757d, #495057);
    border: 2px solid #dee2e6;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    flex-shrink: 0;
    box-sizing: border-box;
}
.hp-photo-thumb {
    width: var(--hp-photo-size);
    height: var(--hp-photo-size);
    border-radius: var(--hp-photo-radius);
    object-fit: cover;
    border: 2px solid #dee2e6;
    flex-shrink: 0;
    display: block;
}

/* ───────────────────────────── Top App Header ───────────────────────────── */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--hp-app-header-h);
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.menu-btn,
.search-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #212529;
    cursor: pointer;
    padding: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-title {
    font-family: 'Dancing Script', cursive;
    font-size: 28px;
    font-weight: 400;
    flex: 1;
    text-align: left;
    letter-spacing: 0;
    color: #212529;
    margin: 0;
    line-height: 1.2;
}

a.app-title.app-title-logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    min-width: 0;
}

.app-title-img {
    height: 36px;
    width: auto;
    max-width: min(200px, 100%);
    object-fit: contain;
    display: block;
}

.app-title-bold { font-weight: 700; }

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar .avatar-image,
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    background: #007bff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

/* Offset main content below the fixed app header (single source — do not duplicate on body) */
body:has(.app-header) #page.site {
    padding-top: var(--hp-app-content-offset);
}


/* ───────────────────────────── Bottom Navigation ───────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    height: 80px;
    display: flex;
    flex-direction: column;
}

.bottom-nav.expanded {
    height: auto;
    max-height: 80vh;
}

.nav-main {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    height: 80px;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #6c757d;
    font-size: 13px;
    padding: 12px;
    min-width: 60px;
    min-height: 60px;
    transition: color 0.2s;
    justify-content: center;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-item.active { color: #007bff; }

/* Expanded "More" drawer */
.nav-expanded {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    background: #fff;
    visibility: hidden;
}

.bottom-nav.expanded .nav-expanded {
    max-height: calc(80vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 1;
    visibility: visible;
}

.expanded-content { padding: 16px; }

.expanded-section { margin-bottom: 20px; }
.expanded-section:last-child { margin-bottom: 0; }

.expanded-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.expanded-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.expanded-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #212529;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 8px;
    min-height: 80px;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
}

.expanded-item:active {
    background: #e9ecef;
    transform: scale(0.95);
}

.expanded-item i {
    font-size: 24px;
    color: #007bff;
    margin-bottom: 8px;
}

.expanded-item span {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

/* Body padding so content isn't hidden behind the bottom bar */
body:has(.bottom-nav)            { padding-bottom: 100px; }
body:has(.bottom-nav.expanded)   { padding-bottom: 0; }

/* Fallback for browsers without :has() support */
@supports not selector(:has(*)) {
    body.has-bottom-nav { padding-bottom: 100px; }
}
