/* ==========================================================================
   Stats Summary Grid & Secondary Details Drawer
   ========================================================================== */


/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Stats Grid - Streamlined 3-Card Primary */
.stats-grid-primary {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 0.75rem;
}

@media (max-width: 640px) {
    .stats-grid-primary {
        grid-template-columns: 1fr;
    }
}

.stats-details-wrapper {
    margin-bottom: 1.5rem;
}

.stats-toggle-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.btn-stats-details {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-elevated);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-stats-details:hover {
    color: var(--text-primary);
    border-color: var(--accent-purple);
    background: var(--bg-surface-hover);
}

.btn-stats-details.active {
    color: var(--accent-amethyst);
    border-color: var(--accent-purple);
    background: rgba(147, 51, 234, 0.15);
}

.drawer-chevron {
    font-size: 0.65rem;
    display: inline-block;
    transition: transform var(--transition-fast);
}

.btn-stats-details.active .drawer-chevron {
    transform: rotate(180deg);
}

.stats-details-drawer {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: fadeIn 0.2s ease;
}

.stats-details-drawer.hidden {
    display: none;
}

.stats-secondary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 640px) {
    .stats-secondary-grid {
        grid-template-columns: 1fr;
    }
}

.stat-box-secondary {
    background: var(--bg-surface-elevated);
    padding: 0.85rem 1.1rem;
}

.stat-value-secondary {
    font-size: 1.4rem;
}

.stat-box {
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem 1rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    position: relative;
    cursor: default;
    user-select: none;
    transition: border-color var(--transition-fast);
}

/* Primary Telemetry Left Indicator Stripes */
.stat-box-telemetry::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--border-highlight);
}

.stat-box-levels::before {
    background: var(--accent-xp);
    box-shadow: 0 0 10px var(--accent-xp-glow);
}

.stat-box-combines::before {
    background: var(--accent-lapis);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.stat-box-safety::before {
    background: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}

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

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.text-xp {
    color: var(--accent-xp);
    text-shadow: 0 0 10px var(--accent-xp-glow);
}

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

.badge-safe {
    color: var(--accent-xp);
}

.badge-danger {
    color: var(--accent-red);
}


[data-theme="light"] .stat-box {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .text-xp {
    text-shadow: none;
}


[data-theme="light"] .btn-stats-details {
    background: #ffffff;
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}

[data-theme="light"] .btn-stats-details:hover {
    color: var(--text-primary);
    background: #f8fafc;
}

[data-theme="light"] .btn-stats-details.active {
    background: rgba(126, 34, 206, 0.08);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

[data-theme="light"] .stats-details-drawer {
    background: #f8fafc;
    border-color: var(--border-subtle);
}

[data-theme="light"] .stat-box-secondary {
    background: #ffffff;
}
