/* RoA2 Stats Specific Styling - Gaming aesthetic with mobile optimization */

:root {
    --bg-glass: rgba(31, 35, 45, 0.6);
}

.stats-container {
    background-color: #161922;
    border-radius: 8px;
    padding: 2rem;
    margin-top: 2rem;
}

.stats-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.select-custom {
    background: #1f232d;
    color: #fff;
    border: 1px solid var(--border);
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    min-width: 200px;
    font-weight: 600;
    transition: var(--transition);
}

.select-custom:hover {
    border-color: var(--accent);
}

/* Metric Cards - Glassmorphic */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.metric-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.metric-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3), 0 0 20px var(--accent-glow);
}

.metric-card h4 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.metric-card p {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 800;
    color: #FFD700; /* Gold accent for stats */
    margin: 0;
}

/* Checker Section - Glassmorphic */
.checker-section {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 3rem;
    margin-bottom: 4rem;
    transition: var(--transition);
    position: relative;
}

.checker-section:hover {
    border-color: var(--accent);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}

.checker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.checker-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #fff;
}

.input-group {
    display: flex;
    margin: 1rem 0;
    gap: 0;
}

.input-field {
    flex: 1;
    background: #0a0b10;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.9rem 1.2rem;
    color: #fff;
    outline: none;
    font-size: 1rem;
    min-width: 0;
}

.input-field:focus {
    border-color: var(--accent);
}

.btn-stats {
    border-radius: 6px !important;
    padding: 0 1.5rem !important;
    white-space: nowrap;
}

/* Recent Searches History */
.recent-searches {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.recent-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.recent-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.recent-chip-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    transition: var(--transition);
}

.recent-chip-wrapper:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.recent-chip {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 0 4px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.recent-chip:hover {
    color: #fff;
}

.recent-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0 8px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.recent-delete:hover {
    color: #ff4444;
}

/* Charts - Glassmorphic */
.chart-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    min-height: 550px;
    position: relative;
    width: 100%;
    transition: var(--transition);
    overflow: hidden;
}

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

.chart-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.btn-chart-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-chart-action:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* --- VISUAL RANK CARD --- */
.rank-card {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: rgba(10, 11, 16, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 3rem;
    border: 3px solid var(--rank-color, var(--accent));
    color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8), 0 0 30px var(--rank-glow);
    transition: var(--transition);
}

.rank-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 50% 0%, var(--rank-glow) 0%, transparent 80%);
    opacity: 0.5;
    pointer-events: none;
}

.rank-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#cardGameName {
    color: var(--rank-color);
}

.rank-card-body {
    text-align: center;
    margin-bottom: 3rem;
}

.rank-card-body h2 {
    font-size: clamp(3.5rem, 12vw, 5.5rem);
    margin: 0;
    font-weight: 900;
    line-height: 0.9;
    color: var(--rank-color, #fff);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    filter: drop-shadow(0 0 10px var(--rank-glow));
}

.rank-card-steamid {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.rank-card-main-stat {
    font-size: 2rem;
    font-weight: 800;
    color: #f0f0f0;
}

.elo-label {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: 0.5rem;
}

.rank-card-percentile {
    display: inline-block;
    margin-top: 1.5rem;
    background: var(--rank-color);
    color: #0a0b10;
    padding: 8px 24px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.rank-card-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    background: rgba(255,255,255,0.04);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 2rem;
}

.rank-sub-stat {
    text-align: center;
}

.sub-stat-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    margin-bottom: 0.5rem;
}

.sub-stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
}

.rank-card-footer {
    text-align: center;
}

.rank-card-url {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    opacity: 0.6;
}

/* Enhanced Download Button - Aligned with site standard */
.btn-download-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0.8rem 2rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: none;
    background: var(--accent);
    color: #fff;
}

.btn-download-card:hover {
    background: #6b7cb3;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-download-card svg {
    width: 18px;
    height: 18px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 16, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 900;
    backdrop-filter: blur(10px);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 215, 0, 0.1);
    border-top: 5px solid #FFD700;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

.roa2-disclaimer {
    margin-top: 4rem;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    text-align: center;
}

#share-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.4s ease;
    opacity: 0;
    pointer-events: none;
}

#share-toast.visible {
    opacity: 1;
    bottom: 120px;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 768px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .checker-section { padding: 2rem 1.25rem; }
    .checker-grid { grid-template-columns: 1fr; gap: 2rem; }
    .rank-card { padding: 2rem 1.5rem; }
    .rank-card-stats-grid { padding: 1rem; gap: 0.5rem; }
    .sub-stat-value { font-size: 1rem; }
    .rank-card-body h2 { font-size: 3rem; }
    
    .chart-card {
        padding: 1.5rem;
        min-height: 400px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .stats-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .select-custom {
        width: 100%;
        min-width: 0;
    }
    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    .input-field {
        border-radius: 6px !important;
        width: 100%;
    }
    .btn-stats {
        border-radius: 6px !important;
        width: 100%;
        padding: 0.9rem !important;
    }
    
    .btn-download-card {
        width: 100%;
        padding: 0.8rem 1rem;
    }

    .rank-card-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .rank-card-body h2 {
        font-size: 2.5rem;
    }
}
