/* RedLine Souls - Production-Ready Responsive CSS */
/* Clean, modern, mobile-first approach */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-dark: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --primary-red: #ff3333;
    --primary-glow: rgba(255, 51, 51, 0.4);
    --text-main: #ffffff;
    --text-muted: #8888aa;
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

input,
textarea,
select {
    background-color: transparent;
    color: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="text"],
input[type="search"],
input[type="email"] {
    background-color: transparent !important;
}

/* Override browser autofill styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1a1a24 inset !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: #1a1a24 !important;
    background: #1a1a24 !important;
    color: #ffffff !important;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 51, 51, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(50, 50, 100, 0.05) 0%, transparent 40%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ===========================
   NAVIGATION
   =========================== */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    backdrop-filter: blur(20px);
    background: rgba(10, 10, 15, 0.8);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -1px;
}

.nav-brand span {
    color: var(--primary-red);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: white;
    background: var(--primary-red);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* ===========================
   HERO SECTION
   =========================== */
.hero {
    text-align: center;
    padding: clamp(60px, 10vw, 100px) 0;
    position: relative;
}

.hero h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 800;
    letter-spacing: -2px;
    background: linear-gradient(to right, #fff, #aaa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.hero h1 span {
    color: var(--primary-red);
    -webkit-text-fill-color: var(--primary-red);
    text-shadow: 0 0 30px var(--primary-glow);
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.hero-status {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 50px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 10px #4caf50;
}

.status-indicator.online {
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 5px #4caf50, 0 0 10px #4caf50;
    }

    50% {
        box-shadow: 0 0 10px #4caf50, 0 0 20px #4caf50, 0 0 30px #4caf50;
    }
}

.status-indicator.offline {
    background: #f44336;
    box-shadow: 0 0 10px #f44336;
    animation: none;
}

.player-count-hero {
    font-size: 1.2rem;
    font-weight: 600;
}

.player-count-hero span:first-child {
    font-size: 2rem;
    color: var(--primary-red);
}

.player-count-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cta-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    padding: 0 20px;
}

.btn-cta {
    display: inline-block;
    background: var(--primary-red);
    color: white;
    padding: 15px 40px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px var(--primary-glow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 200px;
    text-align: center;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px var(--primary-glow);
    background: #ff4444;
}

.btn-secondary {
    background: #5865F2;
    box-shadow: 0 0 20px rgba(88, 101, 242, 0.4);
    border-color: #5865F2;
}

.btn-secondary:hover {
    background: #6875f5;
    box-shadow: 0 0 40px rgba(88, 101, 242, 0.6);
}

/* ===========================
   PAGE LAYOUT
   =========================== */
.page-content {
    padding-bottom: 60px;
}

.page-header {
    text-align: center;
    padding: 80px 20px 40px;
}

.page-header h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 800;
    margin-bottom: 10px;
}

.page-header p {
    color: var(--text-muted);
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.section-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

/* ===========================
   FEATURES
   =========================== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 30px;
    padding: 60px 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.feature-card h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 700;
}

.feature-card p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===========================
   CARDS & STATUS
   =========================== */
.live-status {
    margin-top: 60px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
}

.card-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.card-header:has(.leaderboard-search) {
    flex-direction: row;
    align-items: center;
}

.card-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-list-container {
    max-height: 400px;
    overflow-y: auto;
}

.player-list-container::-webkit-scrollbar {
    width: 5px;
}

.player-list-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.player-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.no-players {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.player-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.player-name {
    font-weight: 600;
    color: #fff;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.stats-row>div {
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.stat-value {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 800;
    color: white;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===========================
   STATISTICS PAGE
   =========================== */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 25px;
    margin-bottom: 60px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
}

.stat-card-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.stat-card-value {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 800;
    color: var(--primary-red);
    margin-bottom: 10px;
    line-height: 1;
}

.stat-card-label {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-section {
    margin-top: 60px;
}

/* ===========================
   LEADERBOARD
   =========================== */
.leaderboard {
    margin-top: 40px;
}

.leaderboard-search {
    margin: 0;
    flex-shrink: 0;
}

.search-wrapper {
    position: relative;
    max-width: 450px;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 2;
    transition: all 0.3s ease;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
    margin: 0;
    padding: 0;
}

input.search-input,
#leaderboard-search,
.search-wrapper input,
.leaderboard-search input[type="text"] {
    width: 100%;
    padding: 16px 20px 16px 52px;
    background-color: #1a1a24 !important;
    background: #1a1a24 !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1.5px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px;
    color: #ffffff !important;
    font-size: 0.95rem;
    font-weight: 400;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    line-height: normal;
    height: auto;
    box-sizing: border-box;
    margin: 0;
    vertical-align: top;
}

input.search-input:hover,
#leaderboard-search:hover,
.search-wrapper input:hover,
.leaderboard-search input[type="text"]:hover {
    border-color: rgba(255, 51, 51, 0.15) !important;
    background-color: #1f1f2a !important;
    background: #1f1f2a !important;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 1px rgba(255, 51, 51, 0.08);
}

.search-input:hover+.search-icon,
.search-wrapper:hover .search-icon {
    color: rgba(255, 51, 51, 0.6);
}

input.search-input:focus,
#leaderboard-search:focus,
.search-wrapper input:focus,
.leaderboard-search input[type="text"]:focus {
    outline: none !important;
    border-color: rgba(255, 51, 51, 0.35) !important;
    background-color: #252530 !important;
    background: #252530 !important;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 3px rgba(255, 51, 51, 0.12),
        0 0 0 1px rgba(255, 51, 51, 0.2);
    transform: translateY(-1px);
}

.search-input:focus~.search-icon,
.search-wrapper:focus-within .search-icon {
    color: rgba(255, 51, 51, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.leaderboard-item.visible {
    animation: fadeInUp 0.4s ease-out;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(5px);
    border-color: rgba(255, 51, 51, 0.3);
}

.leaderboard-rank {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-red);
    min-width: 60px;
    text-align: center;
    line-height: 1.2;
}

.leaderboard-rank.rank-1 {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.leaderboard-rank.rank-2 {
    color: #C0C0C0;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.3);
}

.leaderboard-rank.rank-3 {
    color: #CD7F32;
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
}

.leaderboard-player {
    flex: 1;
    min-width: 0;
}

.leaderboard-player-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 6px;
    word-break: break-word;
}

.leaderboard-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.leaderboard-stats span {
    white-space: nowrap;
}

.stat-score {
    color: #ff3333 !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
}

.stat-sessions,
.stat-playtime,
.stat-crashes {
    opacity: 0.8;
}

/* ===========================
   CHARTS & VISUALIZATIONS
   =========================== */
.chart-section {
    margin-top: 60px;
}

.chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-main);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
    gap: 30px;
    margin-top: 60px;
    max-width: 100%;
}

@media (max-width: 968px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.charts-grid .card {
    padding: 25px;
    min-height: 450px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 350px;
    margin-top: auto;
    margin-bottom: auto;
}

.charts-grid canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Disable hover effects on touch devices to prevent sticky states/lag */
@media (hover: none) {
    .hover-lift:hover {
        transform: none;
        box-shadow: none;
    }
}

canvas {
    max-height: 500px;
    width: 100% !important;
    height: auto !important;
}

.chart-section .card {
    padding: 20px;
}

.chart-section canvas {
    max-height: 400px;
}

/* ===========================
   FOOTER
   =========================== */
.footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--glass-border);
    margin-top: 80px;
}

.footer p {
    color: var(--text-muted);
    margin-bottom: 5px;
}

.footer a {
    color: var(--primary-red);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #ff4444;
}

.footer-note {
    font-size: 0.85rem;
    opacity: 0.6;
}

/* ===========================
   RESPONSIVE - MOBILE FIRST
   =========================== */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 15px;
    }

    .nav-brand {
        font-size: 1.3rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 20px;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    .btn-cta {
        width: 100%;
        max-width: 400px;
        padding: 18px 30px;
        font-size: 1.1rem;
        min-width: unset;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .leaderboard-stats {
        flex-direction: column;
        gap: 8px;
    }

    .leaderboard-rank {
        min-width: 50px;
        font-size: 1.2rem;
    }

    .leaderboard-item {
        padding: 15px;
        gap: 15px;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .leaderboard-search {
        width: 100%;
        margin-top: 15px;
    }

    .search-input {
        max-width: 100%;
        padding: 14px 18px 14px 48px;
        font-size: 0.9rem;
    }

    .search-icon {
        left: 16px;
        width: 18px;
        height: 18px;
    }

    .search-input {
        max-width: 100%;
        padding: 14px 18px 14px 48px;
        font-size: 0.9rem;
    }

    .search-icon {
        left: 16px;
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .nav-link {
        font-size: 0.75rem;
        padding: 8px 6px;
    }

    .feature-icon {
        font-size: 2.5rem;
    }

    .leaderboard-rank {
        font-size: 1.2rem;
        min-width: 40px;
    }
}