/* =========================================
   THE WAR ROOM - CORE STYLES
========================================= */

.wr-card { background: var(--c-parchment); border: 1px solid var(--c-border-gold-muted); border-radius: 4px; padding: 20px; box-shadow: 3px 4px 10px rgba(0,0,0,0.3); color: var(--c-ink); position: relative; }
.wr-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--c-gold-dim); border-radius: 4px 4px 0 0; }

.wr-stat-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed rgba(140, 115, 53, 0.3); }
.wr-stat-label { font-size: 0.85rem; font-weight: bold; color: var(--c-ink-faded); text-transform: uppercase; letter-spacing: 1px; }
.wr-stat-value { font-family: monospace; font-size: 1rem; font-weight: bold; color: var(--c-ink); }

.search-container { position: relative; width: 100%; }
.search-input { width: 100%; padding: 12px; font-size: 1.1rem; background: #1e1611; color: var(--c-gold-bright); border: 2px solid var(--c-gold-dim); border-radius: 4px; text-align: center; box-sizing: border-box; }
.search-input:focus { outline: none; border-color: var(--c-teal); box-shadow: 0 0 10px rgba(20, 184, 166, 0.3); }

.dropdown-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--c-paper-bright); border: 1px solid var(--c-border-gold-muted); border-top: none; z-index: 100; display: none; max-height: 250px; overflow-y: auto; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.dropdown-item { padding: 10px 15px; cursor: pointer; color: var(--c-ink); font-weight: bold; border-bottom: 1px solid rgba(0,0,0,0.05); display: flex; justify-content: space-between; }
.dropdown-item:hover { background: rgba(140, 115, 53, 0.1); }

.h2h-center { text-align: center; display: flex; flex-direction: column; justify-content: center; height: 100%; }
.h2h-score { font-size: 4rem; font-family: 'Palatino Linotype', Georgia, serif; font-weight: bold; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; gap: 20px; }

.wr-name { font-size: 1.8rem; font-family: 'Palatino Linotype', Georgia, serif; color: var(--c-ink); margin: 0 0 5px 0; text-align: center; text-transform: uppercase; letter-spacing: 1px; }
.wr-tier { text-align: center; font-size: 0.9rem; color: var(--c-teal); font-weight: bold; margin-bottom: 20px; }

/* Dashboard Tabs */
.wr-tabs { display: flex; gap: 10px; margin-bottom: 15px; border-bottom: 2px solid rgba(180, 148, 70, 0.3); padding-bottom: 10px; overflow-x: auto; }
.wr-tab { background: transparent; border: 1px solid rgba(180, 148, 70, 0.5); color: var(--c-gold-dim); padding: 8px 16px; cursor: pointer; font-family: 'Palatino Linotype', Georgia, serif; font-weight: bold; border-radius: 4px; transition: all 0.2s; white-space: nowrap; }
.wr-tab:hover { background: rgba(180, 148, 70, 0.1); color: var(--c-gold-bright); }
.wr-tab.active { background: rgba(180, 148, 70, 0.2); border-color: var(--c-gold-bright); color: var(--c-gold-bright); box-shadow: 0 0 10px rgba(180, 148, 70, 0.2); }

.wr-group-header { font-size: 1.1rem; color: #cbd5e1; border-bottom: 1px solid rgba(255,255,255,0.1); margin: 25px 0 10px 0; padding-bottom: 5px; display: flex; justify-content: space-between; align-items: baseline; }
.wr-group-score { font-family: monospace; font-size: 1.2rem; }

/* Hero Card Interactive Elements */
.win-ring { 
    width: 44px !important; 
    height: 44px !important; 
    border-radius: 50% !important; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    position: relative; 
    transition: all 0.2s ease-out; 
    flex-shrink: 0; 
    margin-left: 15px; 
    padding: 0 !important; 
}

.win-ring::before { 
    content: ''; 
    position: absolute; 
    top: 5px;  
    left: 5px;  
    width: 34px; 
    height: 34px; 
    background: var(--c-parchment); 
    border-radius: 50% !important; 
}

.win-ring-text { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    font-weight: bold; 
    font-family: monospace; 
    font-size: 0.85rem; 
    color: var(--c-ink); 
    z-index: 2; 
    margin: 0;
    padding: 0;
    line-height: 1;
}

.record-details { display: flex; flex-direction: column; width: 100%; }

.form-bar-container { width: 100%; height: 6px; background: rgba(0,0,0,0.1); border-radius: 3px; overflow: hidden; display: flex; margin-top: 8px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); }
.form-bar-win { background: var(--c-win); height: 100%; transition: width 0.5s ease-out; }
.form-bar-loss { background: var(--c-loss); height: 100%; transition: width 0.5s ease-out; }

.faction-btn { background: #1e1611; border: 1px solid var(--c-gold-dim); color: var(--c-gold-bright); padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; font-weight: bold; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.faction-btn:hover { background: var(--c-teal); border-color: var(--c-teal); color: #fff; box-shadow: 0 0 10px rgba(20, 184, 166, 0.4); transform: translateY(-1px); }

/* 30-Day Timeline Graph */
.timeline-graph { display: flex; align-items: flex-end; gap: 2px; height: 40px; width: 100%; border-bottom: 1px solid rgba(140, 115, 53, 0.3); padding-bottom: 2px; margin-top: 15px; }
.timeline-bar-wrapper { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; cursor: pointer; transition: background 0.2s; }
.timeline-bar-wrapper:hover { background: rgba(255,255,255,0.05); }
.timeline-bar-win { background: var(--c-win); width: 100%; transition: height 0.4s ease-out; }
.timeline-bar-loss { background: var(--c-loss); width: 100%; transition: height 0.4s ease-out; }

/* Custom Tooltip for the Graph */
.timeline-bar-wrapper:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: var(--c-gold-bright);
    padding: 6px 10px;
    font-size: 0.75rem;
    font-family: monospace;
    border: 1px solid var(--c-gold-dim);
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    margin-bottom: 6px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

/* Clickable Stat Animations */
.clickable-stat { cursor: pointer; transition: all 0.2s ease; border-radius: 4px; padding: 0 4px; display: inline-block; }
.clickable-stat:hover { background: rgba(255,255,255,0.1); box-shadow: 0 0 10px rgba(255,255,255,0.1); transform: scale(1.05); }
.win-ring.clickable-stat:hover { box-shadow: 0 0 15px rgba(255,255,255,0.2); transform: scale(1.05); }

/* Faction Pill Tags */
.faction-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; padding-top: 15px; border-top: 1px dashed rgba(140, 115, 53, 0.2); }
.faction-pill { background: rgba(0,0,0,0.15); border: 1px solid rgba(140, 115, 53, 0.3); color: var(--c-ink); padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; cursor: pointer; transition: all 0.2s; font-family: monospace; font-weight: bold; }
.faction-pill:hover { background: var(--c-teal); color: #fff; border-color: var(--c-teal); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(20, 184, 166, 0.3); }
.faction-pill span { color: var(--c-ink-faded); margin-left: 4px; font-size: 0.7rem; }
.faction-pill:hover span { color: rgba(255,255,255,0.8); }

/* Faction Pill Active States */
.faction-pill.active-A { background: #14b8a6; color: #fff; border-color: #14b8a6; box-shadow: 0 4px 8px rgba(20, 184, 166, 0.4); transform: translateY(-2px); }
.faction-pill.active-A span { color: rgba(255,255,255,0.9); }
.faction-pill.active-B { background: #b49446; color: #fff; border-color: #b49446; box-shadow: 0 4px 8px rgba(180, 148, 70, 0.4); transform: translateY(-2px); }
.faction-pill.active-B span { color: rgba(255,255,255,0.9); }

.faction-pill.disabled { opacity: 0.3; cursor: not-allowed; filter: grayscale(100%); pointer-events: none; }
.faction-pill.no-matchup { opacity: 0.5; border-style: dashed; border-color: rgba(140, 115, 53, 0.2); }

/* Full-Width Analytics Canvas */
.analytics-canvas {
    width: 100%;
    background: #15110e; 
    border: 1px solid rgba(180, 148, 70, 0.3); 
    border-radius: 6px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

#chart-scroll-area::-webkit-scrollbar { height: 8px; }
#chart-scroll-area::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
#chart-scroll-area::-webkit-scrollbar-thumb { background: rgba(180, 148, 70, 0.5); border-radius: 4px; }
#chart-scroll-area::-webkit-scrollbar-thumb:hover { background: var(--c-gold-bright); }

.wr-card .tier-icon { width: 40px; height: 40px; object-fit: contain; }

/* =========================================
   UNIVERSAL FLIP PAGE BUTTON
========================================= */
.flip-page-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(140, 115, 53, 0.1);
    border: 1px solid rgba(140, 115, 53, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.flip-page-btn:hover {
    background: rgba(140, 115, 53, 0.25);
    border-color: rgba(140, 115, 53, 0.6);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.css-flip-page-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--c-gold-bright, #b49446);
    border-top-color: transparent; 
    position: relative;
}

.css-flip-page-icon::after {
    content: '';
    position: absolute;
    top: -2px; 
    right: -4px; 
    border-width: 4px;
    border-style: solid;
    border-color: transparent transparent var(--c-gold-bright, #b49446) transparent;
    transform: rotate(45deg); 
}

/* =========================================
   OVERLAY MODE (GRID SYSTEM)
========================================= */
.wr-top-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: stretch;
    width: 100%;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
}

/* 🟢 OVERLAY MODE: Makes the cards pop out on top of the screen! */
.wr-top-row.overlay-mode {
    position: fixed;
    top: 120px; /* 👈 THE FIX: Drops the cards below BOTH headers! */
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1400px;
    z-index: 1000;
    background: rgba(15, 12, 10, 0.98);
    padding: 30px;
    border-radius: 8px;
    border: 1px inset var(--c-gold-dim);
    box-shadow: 0 20px 50px rgba(0,0,0,0.9);
}

@media (max-width: 900px) {
    .wr-top-row { grid-template-columns: 1fr; }
    .wr-top-row.overlay-mode { top: 120px; height: 75vh; overflow-y: auto; }
}

.overlay-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 990;
    cursor: pointer;
}

/* 🟢 The Slim Sticky Bar */
.sticky-player-bar {
    position: -webkit-sticky; 
    position: sticky;
    top: 50px; 
    z-index: 950; 
    background: rgba(21, 17, 14, 0.95);
    border-bottom: 2px solid rgba(180, 148, 70, 0.5);
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Georgia, serif;
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    margin-bottom: 20px;
    
    /* 🟢 NEW: Hide by default, slide down slightly */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* 🟢 NEW: The class Javascript will add when it sticks */
.sticky-player-bar.is-stuck {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.sticky-player-bar:hover {
    background: rgba(30, 25, 20, 0.98);
    border-bottom-color: var(--c-gold-bright);
}
#stickyNameA { color: #14b8a6; text-transform: uppercase; }
#stickyNameB { color: #b49446; text-transform: uppercase; }

/* 🟢 War Room Collapsible Header */
.wr-header-toggle {
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.wr-header-toggle:hover {
    background: rgba(180, 148, 70, 0.05) !important; /* Subtle gold glow */
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}