/* Modern Dark Theme with Glassmorphism */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    /* Sky Blue */
    --accent-glow: rgba(56, 189, 248, 0.3);
    --success: #4ade80;
    --danger: #f87171;
}

/* Light Mode Overrides */
.light-mode {
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(0, 0, 0, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.2);
}

.light-mode body {
    background-image: none !important;
    /* Remove dark texture */
    color: var(--text-primary);
}

/* Share Button */
.btn-share {
    background: #000;
    /* X Black */
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.2s;
}

.btn-share:hover {
    opacity: 0.8;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    background-image: url('background.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-blend-mode: overlay;
    color: var(--text-primary);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover,
nav a.active {
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card h2 {
    margin-top: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pos {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.badge-score {
    background: var(--accent-glow);
    color: var(--accent);
}

/* Pitch / Optimizer View */
/* Pitch / Optimizer View */
.pitch {
    /* Darker Emerald Gradient for better contrast */
    background: linear-gradient(180deg, #022c22 0%, #064e3b 100%);
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.pitch-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    /* Gap between players */
}

.captain-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%);
    /* Gold Gradient */
    border: 2px solid #fff;
    border-radius: 50%;
    color: #000;
    font-weight: 900;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
    cursor: default;
}

.player-card-pitch {
    position: relative;
    /* For absolute positioning of badges */
    background: rgba(0, 0, 0, 0.5);
    /* Darker background card */
    backdrop-filter: blur(4px);
    width: 100px;
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.player-card-pitch:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.player-card-pitch b {
    display: block;
    font-size: 0.85rem;
    color: #fff;
    /* Ensure white text */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.player-card-pitch .score {
    font-weight: 700;
    font-size: 1.1rem;
    color: #facc15;
    /* Yellow/Gold for high contrast */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.player-card-pitch .meta {
    font-size: 0.7rem;
    color: #cbd5e1;
    /* Light gray */
    margin-top: 2px;
}

/* Legacy Grid for generic lists if needed */
.pitch-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.player-card {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--card-border);
}

.role-Starter {
    border-color: var(--success);
}

.role-Bench {
    border-color: var(--card-border);
    opacity: 0.7;
}

/* Forms */
input,
select,
button {
    background: rgba(0, 0, 0, 0.5);
    /* Darker background */
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 6px;
    font-family: inherit;
    width: 100%;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

select option {
    background-color: #0f172a;
    color: #f8fafc;
}

button {
    background: var(--accent);
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

button:hover {
    opacity: 0.9;
}

/* Active Nav Style */
nav a.active {
    color: var(--accent) !important;
    border-bottom: 2px solid var(--accent);
    background: rgba(0, 255, 136, 0.05);
}

/* MOBILE PITCH OPTIMIZATION */
@media (max-width: 768px) {
    .pitch {
        padding: 4px !important;
        gap: 2px !important;
        border-width: 1px;
    }

    .pitch-row {
        gap: 2px !important;
        justify-content: center !important;
        /* Group together */
        margin-bottom: 2px;
    }

    .player-card-pitch {
        width: 70px !important;
        /* Widen slightly to fit text */
        padding: 2px !important;
        font-size: 0.7rem;
        margin: 0 1px !important;
    }

    .player-card-pitch b {
        font-size: 0.65rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.1;
        height: auto;
        display: block;
    }

    .player-card-pitch .score {
        font-size: 0.85rem;
        line-height: 1;
    }

    .player-card-pitch .meta {
        display: block !important;
        /* Restore visibility */
        font-size: 0.5rem;
        /* Tiny font */
        margin-top: 1px;
        white-space: normal;
        /* Allow wrapping */
        line-height: 0.9;
        color: #cbd5e1;
    }

    .captain-badge {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
        top: -4px;
        right: -4px;
    }
}