/* ============================================
 * Compendium Cards — Shared Component Styles
 * Used by both compendium.php and compendium-pro.php
 * 
 * Standard theme: default styles
 * PRO theme: body.pro-theme overrides at bottom
 * ============================================ */

/* ─── Base Theme Variables ─── */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-yellow: #d29922;
    --accent-red: #f85149;
    --fire-orange: #ff6b35;
    --fire-red: #f85149;
    --fire-yellow: #ffc107;
    --fire-gradient: linear-gradient(135deg, #ff6b35 0%, #f85149 50%, #ff9500 100%);
}

* { box-sizing: border-box; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
}

.main-content {
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

.text-muted { color: var(--text-secondary) !important; }

/* ─── Character Card Grid ─── */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ─── Character Card (Standard Theme) ─── */
.character-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.character-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.character-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ─── Card Header ─── */
.character-header {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}

.character-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    overflow: hidden;
    flex-shrink: 0;
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-info { flex: 1; min-width: 0; }
.character-info h3 { margin: 0; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.character-info .title { margin: 4px 0 0; font-size: 0.85rem; color: var(--text-secondary); }

.character-age { text-align: center; padding: 8px 12px; background: var(--bg-tertiary); border-radius: 8px; }
.character-age .years { font-size: 1.2rem; font-weight: bold; }
.character-age .label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; }

/* ─── Card Body ─── */
.character-body { padding: 20px; flex: 1; }

.character-philosophy {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    min-height: 50px;
}

.character-strategy {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
}
.character-strategy .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: bold;
}
.character-strategy .value { font-size: 0.9rem; line-height: 1.4; }

.best-for-tag {
    display: inline-block;
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-blue);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ─── Pro Combo Badge (shown on character cards with pro-level symbol combos) ─── */
.pro-combo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2) 0%, rgba(248, 81, 73, 0.2) 100%);
    color: #ff9500;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    border: 1px solid rgba(255, 107, 53, 0.3);
    animation: proComboGlow 2s ease-in-out infinite;
}
@keyframes proComboGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(255, 107, 53, 0.2); }
    50% { box-shadow: 0 0 10px rgba(255, 107, 53, 0.4); }
}

/* ─── Momentum Badge (30-day momentum score on character cards) ─── */
.momentum-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: help;
}
.momentum-badge .hot-count {
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.85;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}
.momentum-heating {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(245, 158, 11, 0.2) 100%);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
    animation: momentumPulse 2.5s ease-in-out infinite;
}
.momentum-cooling {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.25);
}
.momentum-steady {
    background: rgba(139, 148, 158, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(139, 148, 158, 0.2);
}
@keyframes momentumPulse {
    0%, 100% { box-shadow: 0 0 3px rgba(245, 158, 11, 0.15); }
    50% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.35); }
}

/* ─── Card Disclaimer Badge ─── */
.card-disclaimer {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.card-disclaimer small {
    background: rgba(139, 148, 158, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.character-card:hover .card-disclaimer { opacity: 1; }

/* ─── Card Footer Stats ─── */
.character-footer {
    display: flex;
    flex-direction: column;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.stat-row {
    display: grid;
    grid-template-columns: 50px 1fr 1fr 1fr;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
}

.stat-row + .stat-row { border-top: 1px solid var(--border-color); }

.stat-row-label { font-size: 0.6rem; text-transform: uppercase; font-weight: 600; color: var(--text-secondary); }
.stat-row-label.stock { color: #3b82f6; }
.stat-row-label.crypto { color: #f59e0b; }

.stat-row .stat { text-align: center; padding: 2px 4px; border-left: 1px solid var(--border-color); }
.stat-row .stat .value { font-size: 0.85rem; font-weight: 600; }
.stat-row .stat .label { font-size: 0.55rem; color: var(--text-secondary); text-transform: uppercase; }
.stat-row .stat.positive .value { color: var(--accent-green); }
.stat-row .stat.negative .value { color: var(--accent-red); }
.stat-row .stat.pending .value { color: var(--text-secondary); font-weight: 400; }

.stat-row-pending {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ─── Section Headers ─── */
.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 40px 0 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.section-header .icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.section-header h2 { margin: 0; font-size: 1.5rem; }

.section-header .count {
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ─── Age Spectrum ─── */
.age-ancient { color: #a855f7; }
.age-veteran { color: #3b82f6; }
.age-prime { color: #22c55e; }
.age-young { color: #eab308; }
.age-child { color: #f97316; }

/* ─── Category Badge (shown when grouped by strategy class) ─── */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.role-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
}
.role-base {
    background: rgba(88, 166, 255, 0.2);
    color: var(--accent-blue);
}
.role-derivative {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

/* ─── Base Strategy Card Highlight ─── */
.character-card.is-base-strategy {
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.15);
}

/* ─── Strategy Class Section Header ─── */
.section-header.class-section {
    border-bottom-width: 2px;
}
.class-title-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}
.class-title-link h2 {
    margin: 0;
    font-size: 1.5rem;
    transition: color 0.2s ease;
}
.class-title-link .explore-arrow {
    font-size: 1.2rem;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s ease;
    color: var(--class-color, var(--accent-blue));
}
.class-title-link:hover h2 {
    color: var(--class-color, var(--accent-blue));
}
.class-title-link:hover .explore-arrow {
    opacity: 1;
    transform: translateX(0);
}


/* ============================================
 * PRO THEME OVERRIDES
 * Applied when <body class="pro-theme">
 * ============================================ */

/* Card: fire gradient border */
body.pro-theme .character-card {
    border: 2px solid transparent;
    position: relative;
}
body.pro-theme .character-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 2px;
    background: var(--fire-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
body.pro-theme .character-card:hover::before { opacity: 1; }
body.pro-theme .character-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.3), 0 0 60px rgba(248, 81, 73, 0.15);
}

/* Card content: fire accents */
body.pro-theme .character-info .title { color: var(--fire-orange); font-weight: 500; }
body.pro-theme .character-avatar { box-shadow: 0 0 15px rgba(255, 107, 53, 0.4); }
body.pro-theme .character-philosophy { border-left: 3px solid var(--fire-orange); padding-left: 12px; }
body.pro-theme .character-strategy { background: rgba(255, 107, 53, 0.1); border: 1px solid rgba(255, 107, 53, 0.3); }
body.pro-theme .character-strategy .label { color: var(--fire-orange); }
body.pro-theme .best-for-tag { background: var(--bg-tertiary); color: var(--text-secondary); border-radius: 12px; font-size: 0.75rem; }

/* Section headers: fire gradient */
body.pro-theme .section-header { border-bottom: 2px solid; border-image: var(--fire-gradient) 1; }
body.pro-theme .section-header .icon { background: linear-gradient(135deg, rgba(255, 107, 53, 0.3) 0%, rgba(248, 81, 73, 0.3) 100%) !important; }
body.pro-theme .section-header h2 { background: var(--fire-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
body.pro-theme .section-header .count { background: var(--fire-gradient); color: #fff; font-weight: bold; }

/* PRO: strategy class additions */
body.pro-theme .character-card.is-base-strategy { border-color: var(--fire-orange); box-shadow: 0 0 12px rgba(255, 107, 53, 0.2); }
body.pro-theme .class-title-link:hover h2 { background: var(--fire-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
body.pro-theme .class-title-link .explore-arrow { color: var(--fire-orange); }
body.pro-theme .role-base { background: rgba(255, 107, 53, 0.2); color: var(--fire-orange); }
body.pro-theme .category-badge { border: 1px solid rgba(255, 107, 53, 0.2); }


/* ─── Responsive ─── */
@media (max-width: 768px) {
    .main-content { margin-left: 0; padding: 15px; }
    .characters-grid { grid-template-columns: 1fr; }
}
