/* =========================================================================
   vip-app.css — VIP App-style Account Center  (Phase 5h v8af27)
   -------------------------------------------------------------------------
   Mobile-first native-app experience for /vip/account dashboard + global
   bottom Tab Bar on all /vip/* pages (mobile only).

   Components:
     - Profile header  (.profile-header)
     - Stats row        (.stats-row)
     - Status card      (.vip-status-card)
     - Quick actions    (.quick-actions)
     - Promo banner     (.promo-banner)
     - Menu sections    (.menu-card / .menu-item)
     - Bottom tab bar   (.vip-tab-bar)  — injected by vip-tab-bar.js

   Scoped under .vip-app-view (dashboard) or html.vip-page (tab bar)
   to avoid leaking to advertiser pages.
   ========================================================================= */

/* ═══════════════════════════ Layout ═══════════════════════════ */
.vip-app-view {
    max-width: 430px;
    margin: 0 auto;
    padding-bottom: 20px;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ═══════════════════════════ Profile Header ═══════════════════ */
.vip-app-view .profile-header {
    padding: 20px 16px 24px;
    background: linear-gradient(180deg, #1a1520 0%, #0a0a0f 100%);
    position: relative;
    overflow: hidden;
}
.vip-app-view .profile-header::before {
    content: '';
    position: absolute;
    top: -60px; right: -40px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(var(--gold-ffd700-rgb, 255,215,0),0.25) 0%, transparent 70%);
    pointer-events: none;
}
.vip-app-view .profile-top {
    display: flex;
    align-items: center;
    gap: 14px;
}
.vip-app-view .profile-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    border: 2.5px solid var(--vip-gold, #ffd700);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 20px rgba(var(--gold-ffd700-rgb, 255,215,0),0.25);
}
.vip-app-view .profile-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.vip-app-view .profile-info {
    flex: 1;
    min-width: 0;
}
.vip-app-view .profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--vip-text-primary, #f0f0f0);
}
.vip-app-view .profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--gold-c5a200, #c5a200), var(--gold-ffd700, #ffd700));
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.vip-app-view .profile-badge svg { width: 12px; height: 12px; }
.vip-app-view .profile-badge.is-free {
    background: rgba(255,255,255,0.08);
    color: var(--vip-text-secondary, #8a8a9a);
}
.vip-app-view .vip-expiry {
    font-size: 12px;
    color: var(--vip-text-secondary, #8a8a9a);
    margin-top: 4px;
}
.vip-app-view .profile-settings-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #1e1e28;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vip-text-secondary, #8a8a9a);
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
    transition: background 0.2s;
}
.vip-app-view .profile-settings-btn:hover { background: #282838; }

/* ═══════════════════════════ Stats Row ════════════════════════ */
.vip-app-view .stats-row {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding: 14px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.vip-app-view .stat-item {
    text-align: center;
    cursor: pointer;
    flex: 1;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}
.vip-app-view .stat-item:hover { opacity: 0.8; }
.vip-app-view .stat-item:not(:last-child) {
    border-right: 1px solid rgba(255,255,255,0.06);
}
.vip-app-view .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--vip-text-primary, #f0f0f0);
    line-height: 1;
}
.vip-app-view .stat-label {
    font-size: 11px;
    color: var(--vip-text-secondary, #8a8a9a);
    margin-top: 4px;
}

/* ═══════════════════════════ VIP Status Card ══════════════════ */
.vip-app-view .vip-status-card {
    margin: 16px;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--gold-2a2518, #2a2518) 0%, #1a1610 100%);
    border: 1px solid rgba(var(--gold-ffd700-rgb, 255,215,0),0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.vip-app-view .vip-status-card.is-free {
    background: linear-gradient(135deg, #1a1a22 0%, #141419 100%);
    border-color: rgba(255,255,255,0.08);
}
.vip-app-view .vip-status-info { flex: 1; }
.vip-app-view .vip-status-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--vip-gold, #ffd700);
}
.vip-app-view .vip-status-card.is-free .vip-status-title {
    color: var(--vip-text-secondary, #8a8a9a);
}
.vip-app-view .vip-status-desc {
    font-size: 12px;
    color: var(--vip-text-secondary, #8a8a9a);
    margin-top: 3px;
}
.vip-app-view .vip-status-btn {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--gold-c5a200, #c5a200), var(--gold-ffd700, #ffd700));
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.vip-app-view .vip-status-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--gold-ffd700-rgb, 255,215,0),0.3);
    color: #000;
}

/* ═══════════════════════════ Quick Actions Grid ═══════════════ */
.vip-app-view .quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 16px;
}
.vip-app-view .quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    text-decoration: none;
    color: inherit;
}
.vip-app-view .quick-action:active { background: #1a1a22; }
.vip-app-view .quick-action-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
}
.vip-app-view .quick-action-icon.gold  { background: rgba(var(--gold-ffd700-rgb, 255,215,0),0.12); }
.vip-app-view .quick-action-icon.pink  { background: rgba(233,30,99,0.12); }
.vip-app-view .quick-action-icon.blue  { background: rgba(33,150,243,0.12); }
.vip-app-view .quick-action-icon.green { background: rgba(76,175,80,0.12); }
.vip-app-view .quick-action-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e91e63;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.vip-app-view .quick-action-badge:empty { display: none; }
.vip-app-view .quick-action-label {
    font-size: 11px;
    color: var(--vip-text-secondary, #8a8a9a);
    text-align: center;
    line-height: 1.2;
}

/* ═══════════════════════════ Section / Menu ═══════════════════ */
.vip-app-view .section {
    margin: 0 16px 12px;
}
.vip-app-view .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.vip-app-view .section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--vip-text-primary, #f0f0f0);
}
.vip-app-view .menu-card {
    background: #141419;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
}
.vip-app-view .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-decoration: none !important;
    color: var(--vip-text-primary, #f0f0f0) !important;
}
.vip-app-view .menu-item:last-child { border-bottom: none; }
.vip-app-view .menu-item:active { background: #1a1a22; }
.vip-app-view .menu-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.vip-app-view .menu-icon.gold  { background: rgba(var(--gold-ffd700-rgb, 255,215,0),0.12); }
.vip-app-view .menu-icon.pink  { background: rgba(233,30,99,0.12); }
.vip-app-view .menu-icon.blue  { background: rgba(33,150,243,0.12); }
.vip-app-view .menu-icon.green { background: rgba(76,175,80,0.12); }
.vip-app-view .menu-icon.gray  { background: rgba(255,255,255,0.06); }
.vip-app-view .menu-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}
.vip-app-view .menu-arrow {
    color: #555566;
    font-size: 14px;
}
.vip-app-view .menu-extra {
    font-size: 12px;
    color: var(--vip-text-secondary, #8a8a9a);
    margin-right: 4px;
}
.vip-app-view .menu-item.is-danger { color: #e91e63 !important; }
.vip-app-view .menu-item.is-danger .menu-icon { background: rgba(233,30,99,0.08); }
.vip-app-view .menu-item.is-danger .menu-arrow { color: rgba(233,30,99,0.5); }

/* ═══════════════════════════ Promo Banner ═════════════════════ */
.vip-app-view .promo-banner {
    margin: 0 16px 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1a2030, #162028);
    border: 1px solid rgba(33,150,243,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
}
.vip-app-view .promo-banner:hover { border-color: rgba(33,150,243,0.35); }
.vip-app-view .promo-icon  { font-size: 28px; flex-shrink: 0; }
.vip-app-view .promo-text   { flex: 1; }
.vip-app-view .promo-title  { font-size: 13px; font-weight: 600; color: var(--vip-text-primary, #f0f0f0); }
.vip-app-view .promo-desc   { font-size: 11px; color: var(--vip-text-secondary, #8a8a9a); margin-top: 2px; }
.vip-app-view .promo-arrow  { color: #555566; flex-shrink: 0; }

/* ═══════════════════════════ Sub-page Header ═════════════════ */
/* Back button + title bar for sub-pages (Following, History, etc.) */
.vip-app-view .vip-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.vip-app-view .vip-page-header-info { flex: 1; min-width: 0; }
.vip-app-view .vip-back-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #1e1e28;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vip-text-secondary, #8a8a9a) !important;
    text-decoration: none !important;
    flex-shrink: 0;
    transition: background 0.2s;
    font-size: 14px;
}
.vip-app-view .vip-back-btn:hover { background: #282838; }
.vip-app-view .vip-page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--vip-text-primary, #f0f0f0);
    margin: 0;
    line-height: 1.2;
}
.vip-app-view .vip-page-subtitle {
    font-size: 12px;
    color: var(--vip-text-secondary, #8a8a9a);
    margin-top: 2px;
}
.vip-app-view .vip-page-header-action {
    flex-shrink: 0;
}

/* ═══════════════════════════ Sub-page Content ════════════════ */
.vip-app-view .vip-page-content {
    padding: 16px;
}
/* Existing .vip-card from vip-pages.css: normalize spacing inside app-view */
.vip-app-view .vip-page-content > .vip-card,
.vip-app-view .vip-page-content > .vip-mb-3 {
    margin-bottom: 16px;
}
.vip-app-view .vip-page-content > .vip-card:last-child {
    margin-bottom: 0;
}
/* VIP status card inside sub-pages (Membership) */
.vip-app-view .vip-page-content > .vip-status-card {
    margin: 0 0 16px;
}

/* ═══════════════════════════ Bottom Tab Bar ═══════════════════ */
/* Injected by vip-tab-bar.js. Hidden by default; shown on mobile only. */
.vip-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: 68px;
    background: #111116;
    border-top: 1px solid rgba(255,255,255,0.06);
    align-items: stretch;
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom, 0);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
/* !important needed: vip-pages.css has `html.vip-page body a:not(...)` at
   specificity (0,3,3) setting `color: inherit` on every <a>. Without
   !important the tab bar colors lose the cascade fight. */
.vip-tab-bar .vip-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    color: #555566 !important;
    text-decoration: none !important;
}
.vip-tab-bar .vip-tab.active { color: var(--vip-gold, #ffd700) !important; }
.vip-tab-bar .vip-tab:active { opacity: 0.7; }
.vip-tab-bar .vip-tab-icon {
    width: 24px; height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
}
.vip-tab-bar .vip-tab-badge {
    position: absolute;
    top: -5px; right: -10px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e91e63;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vip-tab-bar .vip-tab-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* ═══════════════════════════ Animations ═══════════════════════ */
@keyframes vipFadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.vip-app-view .profile-header  { animation: vipFadeInUp 0.4s ease; }
.vip-app-view .vip-status-card { animation: vipFadeInUp 0.4s ease 0.05s both; }
.vip-app-view .quick-actions   { animation: vipFadeInUp 0.4s ease 0.1s  both; }
.vip-app-view .promo-banner    { animation: vipFadeInUp 0.4s ease 0.15s both; }
.vip-app-view .section:nth-of-type(1) { animation: vipFadeInUp 0.4s ease 0.2s  both; }
.vip-app-view .section:nth-of-type(2) { animation: vipFadeInUp 0.4s ease 0.25s both; }
/* Sub-page animations */
.vip-app-view .vip-page-header  { animation: vipFadeInUp 0.4s ease; }
.vip-app-view .vip-page-content { animation: vipFadeInUp 0.4s ease 0.05s both; }

/* ═══════════════════════════ Responsive ═══════════════════════ */

/* --- Mobile: show tab bar, hide shell nav links, add bottom space --- */
@media (max-width: 768px) {
    .vip-tab-bar {
        display: flex;
    }
    /* Body padding so content isn't hidden behind the fixed tab bar */
    html.vip-page body {
        padding-bottom: 80px !important;
    }
    /* Hide the desktop header nav links — tab bar replaces them.
       Keep the privacy-toggle button visible. */
    html.vip-page .vip-shell-nav a {
        display: none !important;
    }
    /* Hide footer on mobile — tab bar is the visual bottom */
    html.vip-page .vip-shell-footer {
        display: none;
    }

    /* ═══ Messages Conversation — mobile single-pane chat ═══════
       v8af30 — The 3-pane layout (sidebar + thread-list + conversation)
       is unusable at 430px. Fix: hide sidebar, hide Tab Bar on
       conversation page (standard chat UX — composer needs full bottom
       edge), show conversation pane full-screen below header.
       Desktop 3-pane is preserved (min-width:901px block in vip-pages.css).
       ═══════════════════════════════════════════════════════════════ */

    /* 0. Hide Tab Bar on conversation page — composer owns the bottom edge.
          "← All conversations" link returns to messages list where Tab Bar
          reappears automatically (page no longer :has conversation-page). */
    html.vip-page:has(main.vip-msg-conversation-page) .vip-tab-bar {
        display: none !important;
    }

    /* 1. Keep viewport locked but let the shell size for mobile
          (override the un-media-queried 100vh lock from vip-pages.css:1161) */
    html.vip-page:has(main.vip-msg-conversation-page) body {
        padding-bottom: 0 !important;
    }

    /* 2. Hide sidebar — Tab Bar replaces navigation */
    main.vip-msg-conversation-page > .vip-dashboard > .vip-sidebar {
        display: none !important;
    }

    /* 3. Main area: fill from shell header to viewport bottom
          (Tab Bar is hidden, so no 68px subtraction needed) */
    main.vip-shell-main.vip-msg-conversation-page {
        height: calc(100vh - var(--vip-shell-header-h, 71px)) !important;
        max-height: calc(100vh - var(--vip-shell-header-h, 71px)) !important;
        min-height: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* 4. Dashboard: flex column, no grid */
    main.vip-msg-conversation-page > .vip-dashboard {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    /* 5. Content area fills after sidebar removal */
    main.vip-msg-conversation-page > .vip-dashboard > .vip-content {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

    /* 6. Content header: compact, back link prominent */
    main.vip-msg-conversation-page .vip-content-header {
        flex: 0 0 auto !important;
        padding: 10px 12px !important;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    main.vip-msg-conversation-page .vip-content-header .vip-content-title {
        font-size: 1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 7. Split card: fills remaining space, single-column (thread pane
          already display:none from vip-pages.css @media ≤900px) */
    main.vip-msg-conversation-page .vip-msg-page.is-split {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
    }

    /* 8. Conversation pane: flex column, full width */
    main.vip-msg-conversation-page .vip-msg-conversation-pane {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        width: 100% !important;
    }

    /* 9. Partner header: compact */
    main.vip-msg-conversation-page .vip-msg-conversation-header {
        flex: 0 0 auto !important;
        padding: 10px 12px !important;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    /* 10. Message stream: scrollable middle zone */
    main.vip-msg-conversation-page .vip-msg-stream {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 12px !important;
    }

    /* 11. Composer: fixed at bottom of conversation pane */
    main.vip-msg-conversation-page .vip-msg-composer {
        flex: 0 0 auto !important;
        padding: 8px 12px !important;
        border-top: 1px solid rgba(255,255,255,0.06) !important;
    }
    main.vip-msg-conversation-page .vip-msg-composer textarea {
        font-size: 14px !important;
    }

    /* 12. Hide closed/awaiting banners overflow */
    main.vip-msg-conversation-page .vip-form-error,
    main.vip-msg-conversation-page .vip-mb-2 {
        flex: 0 0 auto !important;
        padding: 0 12px !important;
    }
}

/* --- Desktop: widen the app view, no tab bar --- */
@media (min-width: 769px) {
    .vip-app-view {
        max-width: 500px;
        padding: 24px 0;
    }
}
