/* =========================================================================
   PYLA STATS EXPLORER - MODERN CRIMSON DARK THEME
   ========================================================================= */
:root {
    /* Backgrounds */
    --bg-base: #060608;
    --bg-surface: #0a0b0e;
    --bg-card: rgba(14, 15, 20, 0.75);
    --bg-card-hover: rgba(22, 24, 32, 0.9);
    --bg-card-solid: #101218;
    --bg-glass: rgba(16, 18, 26, 0.6);

    /* Brand Colors */
    --brand-main: #ff2a44;
    --brand-hover: #ff455d;
    --brand-dim: rgba(255, 42, 68, 0.12);
    --brand-glow: rgba(255, 42, 68, 0.4);
    --brand-border: rgba(255, 42, 68, 0.3);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #949ba8;
    --text-muted: #5e6473;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);

    /* Status & Alerts */
    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.12);
    --success-border: rgba(34, 197, 94, 0.3);
    --error: #ff4444;
    --error-dim: rgba(255, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --info: #38bdf8;
    --info-dim: rgba(56, 189, 248, 0.12);

    /* Layout & Fonts */
    --sidebar-width: 240px;
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background Atmospheric Glow */
#vfx-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(circle at 10% 15%, rgba(255, 42, 68, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 90% 85%, rgba(255, 42, 68, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(10, 11, 14, 0.8) 0%, var(--bg-base) 100%);
}

/* App Shell */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    width: 100vw;
}

/* =========================================================================
   SIDEBAR
   ========================================================================= */
.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
    width: 36px;
    height: 36px;
    filter: drop-shadow(0 0 12px var(--brand-glow));
}

.brand-copy {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.1;
}

.brand-title span {
    color: var(--brand-main);
}

.brand-subtitle {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: var(--text-secondary);
}

.nav-menu {
    flex: 1;
    padding: 20px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-category {
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 10px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--text-primary);
    background: var(--brand-dim);
    border-color: var(--brand-border);
    box-shadow: inset 3px 0 0 var(--brand-main);
}

.sidebar-footer {
    padding: 16px 18px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-text {
    display: flex;
    flex-direction: column;
}

.status-text span:first-child {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.status-text span:last-child {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.sidebar-community-links {
    display: flex;
    gap: 8px;
}

.community-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    text-decoration: none;
}

.community-btn img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.community-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-light);
}

/* =========================================================================
   MAIN CONTENT AREA
   ========================================================================= */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px 14px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(6, 6, 8, 0.4);
    backdrop-filter: blur(10px);
}

.page-header {
    display: flex;
    flex-direction: column;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
}

.badge-success {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.badge-danger {
    background: var(--error-dim);
    color: var(--error);
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.badge-warning {
    background: var(--warning-dim);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-brand {
    background: var(--brand-dim);
    color: var(--brand-main);
    border: 1px solid var(--brand-border);
}

.views-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 32px 40px;
}

.view {
    display: none;
    flex-direction: column;
    gap: 24px;
}

.view.active {
    display: flex;
    animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   CARDS & GRIDS
   ========================================================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(16px);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.card-accent {
    border-top: 2px solid var(--brand-main);
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.kpi-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--brand-dim);
    border: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-main);
    flex-shrink: 0;
}

.kpi-icon-wrap img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.kpi-content {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 1100px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    color: var(--brand-main);
}

/* =========================================================================
   CHARTS & VISUALS
   ========================================================================= */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fill-brand { background: var(--brand-main); }
.fill-success { background: var(--success); }
.fill-warning { background: var(--warning); }
.fill-info { background: var(--info); }

/* =========================================================================
   TABLES & LISTS
   ========================================================================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card-solid);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.data-table th:hover {
    color: var(--text-primary);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.88rem;
    white-space: nowrap;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.brawler-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brawler-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #1a1c24;
    border: 1px solid var(--border-light);
}

.brawler-cell-info {
    display: flex;
    flex-direction: column;
}

.brawler-name {
    font-weight: 700;
    color: var(--text-primary);
}

.brawler-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* =========================================================================
   BRAWLER CARDS GRID
   ========================================================================= */
.brawlers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.brawler-card {
    background: rgba(13, 15, 22, 0.75);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(12px);
}

.brawler-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}

.brawler-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brawler-card-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: #14161f;
    border: 2px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.brawler-card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.brawler-stats-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    background: rgba(0, 0, 0, 0.25);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.stat-item-val {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* =========================================================================
   FILTER CONTROLS
   ========================================================================= */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    background: rgba(12, 14, 20, 0.85);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 12px 18px;
    backdrop-filter: blur(16px);
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-muted);
}

.input-field {
    padding: 8px 12px 8px 36px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s ease;
}

.input-field:focus {
    border-color: var(--brand-main);
    box-shadow: 0 0 0 2px var(--brand-dim);
    outline: none;
}

.input-field::placeholder {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.select-field {
    padding: 8px 30px 8px 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.84rem;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e95a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 13px;
    transition: all 0.2s ease;
}

.select-field:focus {
    border-color: var(--brand-main);
    outline: none;
}

.select-field option {
    background: #101218;
    color: #fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--brand-main);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--brand-dim);
}

.btn-primary:hover {
    background: var(--brand-hover);
    box-shadow: 0 6px 18px var(--brand-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================================================
   PAGINATION
   ========================================================================= */
.pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

/* =========================================================================
   COMMUNITY & PATREON VIEW
   ========================================================================= */
.community-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .community-hero {
        grid-template-columns: 1fr;
    }
}

.community-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.discord-card {
    border-top: 3px solid #5865f2;
}

.patreon-card {
    border-top: 3px solid #ff424d;
}

.community-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.community-header img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.community-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--text-primary);
}

.community-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
}

.perks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
}

.perk-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.perk-item svg {
    color: var(--success);
    flex-shrink: 0;
}

/* =========================================================================
   MODAL / DRILLDOWN
   ========================================================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-content {
    background: #0b0c12;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
}

.modal-content-lg {
    max-width: 920px;
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(14, 16, 24, 0.5);
}

.modal-brawler-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-light);
    object-fit: cover;
    background: #14161f;
    flex-shrink: 0;
}

.modal-filter-ribbon {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
    padding: 4px;
    border-radius: var(--radius-xs);
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.modal-kpi-card {
    padding: 10px 14px;
}

.modal-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 768px) {
    .modal-split-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}
