/* ============================================================================
   TIER IDENTITY TOKENS — CSS Custom Properties
   Set data-tier on <html> to activate. Default: Explorer (green).
   Tiers: Explorer (green), Creator (purple), Studio (orange), Platinum (chrome blue)
   ============================================================================ */
:root,
:root[data-tier="Explorer"] {
    --accent: #86EDA5;
    --accent-hover: #6BDB8B;
    --accent-soft: rgba(134, 237, 165, 0.15);
    --accent-muted: rgba(134, 237, 165, 0.08);
    --accent-glow: rgba(134, 237, 165, 0.3);
    --accent-border: rgba(134, 237, 165, 0.25);
    --accent-text: #86EDA5;
    --accent-rgb: 134, 237, 165;
    --tier-logo: url('/static/images/badges/explorer.png');
}

:root[data-tier="Creator"] {
    --accent: #A855F7;
    --accent-hover: #9333EA;
    --accent-soft: rgba(168, 85, 247, 0.15);
    --accent-muted: rgba(168, 85, 247, 0.08);
    --accent-glow: rgba(168, 85, 247, 0.3);
    --accent-border: rgba(168, 85, 247, 0.25);
    --accent-text: #A855F7;
    --accent-rgb: 168, 85, 247;
    --tier-logo: url('/static/images/badges/creator.png');
}

:root[data-tier="Studio"] {
    --accent: #F5A623;
    --accent-hover: #E09510;
    --accent-soft: rgba(245, 166, 35, 0.15);
    --accent-muted: rgba(245, 166, 35, 0.08);
    --accent-glow: rgba(245, 166, 35, 0.3);
    --accent-border: rgba(245, 166, 35, 0.25);
    --accent-text: #F5A623;
    --accent-rgb: 245, 166, 35;
    --tier-logo: url('/static/images/badges/studio.png');
}

:root[data-tier="Platinum"] {
    --accent: #C0CFFF;
    --accent-hover: #A0B8FF;
    --accent-soft: rgba(192, 207, 255, 0.15);
    --accent-muted: rgba(192, 207, 255, 0.08);
    --accent-glow: rgba(192, 207, 255, 0.3);
    --accent-border: rgba(192, 207, 255, 0.25);
    --accent-text: #C0CFFF;
    --accent-rgb: 192, 207, 255;
    --tier-logo: url('/static/images/badges/platinum.png');
}

:root[data-tier="Elite"] {
    --accent: #D4A017;
    --accent-hover: #B8890F;
    --accent-soft: rgba(212, 160, 23, 0.15);
    --accent-muted: rgba(212, 160, 23, 0.08);
    --accent-glow: rgba(212, 160, 23, 0.3);
    --accent-border: rgba(212, 160, 23, 0.25);
    --accent-text: #D4A017;
    --accent-rgb: 212, 160, 23;
    --tier-logo: url('/static/images/badges/elite.png');
}

/* ============================================================================
   TIER IDENTITY CUES — Subtle visual signals per tier
   ============================================================================ */

/* Tier-aware focus ring on interactive elements */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Tier-aware selection highlight */
::selection {
    background: var(--accent-soft);
    color: #fff;
}

/* Tier-aware scrollbar (webkit) */
::-webkit-scrollbar-thumb {
    background: var(--accent-muted);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-soft);
}

/* Studio + Platinum + Elite: elevated glow on cards */
:root[data-tier="Studio"] .action-card:hover,
:root[data-tier="Platinum"] .action-card:hover,
:root[data-tier="Elite"] .action-card:hover {
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* Platinum + Elite: subtle shimmer on primary buttons */
:root[data-tier="Platinum"] .btn-primary,
:root[data-tier="Platinum"] .btn-accent,
:root[data-tier="Platinum"] .upgrade-card-btn:not(.current),
:root[data-tier="Elite"] .btn-primary,
:root[data-tier="Elite"] .btn-accent,
:root[data-tier="Elite"] .upgrade-card-btn:not(.current) {
    text-shadow: 0 0 8px var(--accent-glow);
}

/* Main Styles for WatchTheFall Portal */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #121214;
    color: #EAEAEA;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

#branding-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #333;
}

.branding-logo {
    max-width: 200px;
    height: auto;
}

/* ============================================================================
   TIER BADGES — Graphite & Mint only. Differentiated by opacity/weight.
   ============================================================================ */
.tier-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    line-height: 1.4;
    vertical-align: middle;
}

/* Explorer — muted green (free tier) */
.tier-explorer {
    background: rgba(134, 237, 165, 0.08);
    color: rgba(134, 237, 165, 0.6);
    border: 1px solid rgba(134, 237, 165, 0.15);
}

/* Creator — purple (creative / expressive) */
.tier-creator {
    background: rgba(168, 85, 247, 0.12);
    color: #A855F7;
    border: 1.5px solid rgba(168, 85, 247, 0.35);
}

/* Studio — orange (hustle / energy) */
.tier-studio {
    background: rgba(245, 166, 35, 0.14);
    color: #F5A623;
    border: 2px solid rgba(245, 166, 35, 0.4);
    text-shadow: 0 0 6px rgba(245, 166, 35, 0.2);
}

/* Beta Tester — gold (status / prestige) — overrides tier badge visually */
.status-beta_tester {
    background: rgba(212, 160, 23, 0.14);
    color: #D4A017;
    border: 2px solid rgba(212, 160, 23, 0.45);
    text-shadow: 0 0 6px rgba(212, 160, 23, 0.25);
}

/* Platinum — icy chrome blue (hidden internal supertier, manually granted) */
.tier-platinum {
    background: rgba(192, 207, 255, 0.12);
    color: #C0CFFF;
    border: 2px solid rgba(192, 207, 255, 0.4);
    text-shadow: 0 0 8px rgba(192, 207, 255, 0.35);
    font-weight: 700;
}

/* Elite — gold (invitation-only, hidden from public) */
.tier-elite {
    background: rgba(212, 160, 23, 0.14);
    color: #D4A017;
    border: 2px solid rgba(212, 160, 23, 0.45);
    text-shadow: 0 0 8px rgba(212, 160, 23, 0.3);
    font-weight: 700;
}

/* Admin — Brandr gold (email-locked role) — filled, dominant */
.role-admin {
    background: rgba(199, 165, 60, 0.25);
    color: #C7A53C;
    border: 2px solid rgba(199, 165, 60, 0.6);
    text-shadow: 0 0 8px rgba(199, 165, 60, 0.3);
    font-weight: 700;
}

/* ============================================================================
   USAGE WIDGET — Progress bar for Dashboard limit awareness
   ============================================================================ */
.usage-widget {
    background: #202024;
    border: 1px solid #2a2a2e;
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.usage-widget .usage-info {
    flex: 1;
    min-width: 0;
}

.usage-widget .usage-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
}

.usage-widget .usage-numbers {
    font-size: 15px;
    font-weight: 600;
    color: #EAEAEA;
    margin-bottom: 8px;
}

.usage-widget .usage-numbers .usage-accent {
    color: var(--accent);
}

.usage-bar {
    width: 100%;
    height: 6px;
    background: #2a2a2e;
    border-radius: 3px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.4s ease;
}

.usage-bar-fill.warning {
    background: #f0ad4e;
}

.usage-bar-fill.critical {
    background: #e05252;
}

.usage-widget .usage-cta {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 600;
}

.usage-widget .usage-cta:hover {
    text-decoration: underline;
}

/* ============================================================================
   LIMIT BANNER — Contextual warning shown when at or over limit
   ============================================================================ */
.limit-banner {
    background: rgba(224, 82, 82, 0.08);
    border: 1px solid rgba(224, 82, 82, 0.25);
    border-radius: 8px;
    padding: 12px 18px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #EAEAEA;
    display: flex;
    align-items: center;
    gap: 10px;
}

.limit-banner a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}

.limit-banner a:hover {
    color: var(--accent-hover);
}

/* ============================================================================
   UPGRADE MODAL — Velvet rope intercept when hitting a limit
   ============================================================================ */
.upgrade-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.upgrade-modal-overlay.active {
    display: flex;
}

.upgrade-modal {
    background: #202024;
    border: 1px solid #2a2a2e;
    border-radius: 14px;
    padding: 36px 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.upgrade-modal .modal-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.upgrade-modal h2 {
    font-size: 20px;
    font-weight: 700;
    color: #EAEAEA;
    margin-bottom: 10px;
}

.upgrade-modal p {
    font-size: 14px;
    color: #888;
    line-height: 1.6;
    margin-bottom: 24px;
}

.upgrade-modal .upgrade-btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--accent);
    color: #121214;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.upgrade-modal .upgrade-btn:hover {
    background: var(--accent-hover);
}

.upgrade-modal .modal-dismiss {
    display: block;
    margin-top: 14px;
    font-size: 13px;
    color: #666;
    background: none;
    border: none;
    cursor: pointer;
}

.upgrade-modal .modal-dismiss:hover {
    color: #888;
}

@media (max-width: 600px) {
    .usage-widget {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .usage-widget .usage-cta {
        text-align: center;
    }
}

/* ============================================================================
   UPGRADE PLAN MODAL — Profile page tier selection
   ============================================================================ */
.upgrade-modal-overlay.wide .upgrade-modal {
    max-width: 540px;
}

.upgrade-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
    text-align: left;
}

.upgrade-card {
    background: var(--accent-muted);
    border: 1px solid var(--accent-soft);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.upgrade-card.current-plan {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

.upgrade-card-info h3 {
    font-size: 16px;
    font-weight: 700;
    color: #EAEAEA;
    margin-bottom: 4px;
}

.upgrade-card-info p {
    font-size: 13px;
    color: #888;
    margin: 0;
    line-height: 1.4;
}

.upgrade-card .upgrade-card-btn {
    padding: 8px 18px;
    background: var(--accent);
    color: #121214;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.upgrade-card .upgrade-card-btn:hover {
    background: var(--accent-hover);
}

.upgrade-card .upgrade-card-btn.current {
    background: #2a2a2e;
    color: #888;
    cursor: default;
}

.tier-warning {
    background: rgba(224, 82, 82, 0.08);
    border: 1px solid rgba(224, 82, 82, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 14px;
    font-size: 13px;
    color: #EAEAEA;
}

.tier-warning a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}

.tier-warning a:hover {
    color: var(--accent-hover);
}

@media (max-width: 600px) {
    .upgrade-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .upgrade-card .upgrade-card-btn {
        width: 100%;
    }
}