/* === RESET & BASE STYLES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Variables */
    --primary-purple: #37003c;
    --primary-green: #00ff87;
    --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --header-gradient: linear-gradient(135deg, #37003c 0%, #00ff87 100%);

    /* Position Colors */
    --goalkeeper-color: #FF6B35;
    --defender-color: #004E98;
    --midfielder-color: #3A86FF;
    --forward-color: #06FFA5;

    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Spacing */
    --border-radius: 8px;
    --border-radius-large: 15px;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 15px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 20px rgba(0, 0, 0, 0.2);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: var(--font-family);
    background: var(--background-gradient);
    min-height: 100vh;
    padding: 10px;
    position: relative;
    overflow-x: auto;
    overflow-y: auto;
}

/* === WATERMARKS === */
body::before {
    content: "@elcaiseri";
    position: absolute;
    top: auto;
    left: auto;
    transform: none;
    font-size: 1.9rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    background: rgba(55, 0, 60, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
    display: none;
}

body::after {
    content: "@elcaiseri";
    position: fixed;
    bottom: 10px;
    right: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    z-index: 1000;
    pointer-events: none;
    background: rgba(55, 0, 60, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

/* === MAIN CONTAINER === */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-medium);
    overflow: visible;
    position: relative;
    z-index: 2;
}

/* === HEADER === */
.header {
    background: var(--header-gradient);
    color: white;
    padding: 15px 20px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header .gameweek {
    font-size: 1rem;
    opacity: 0.9;
}

.hidden-preview {
    display: none;
    visibility: hidden;
}

/* === GAMEWEEK SELECTOR === */
.gameweek-selector {
    margin: 10px 20px;
    text-align: center;
}

.gameweek-selector select {
    padding: 8px 12px;
    border: 2px solid var(--primary-purple);
    border-radius: var(--border-radius);
    background: white;
    color: var(--primary-purple);
    font-size: 1rem;
    cursor: pointer;
    min-width: 150px;
    transition: var(--transition-normal);
}

.gameweek-selector select:hover {
    border-color: var(--primary-green);
}

.gameweek-selector select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.2);
}

/* === PITCH/FIELD === */
.pitch {
    background: linear-gradient(90deg, #228B22 0%, #32CD32 50%, #228B22 100%);
    background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 15px 15px;
    padding: 20px 15px;
    position: relative;
}

/* === FORMATION LINES === */
.formation-line {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
}

/* === PLAYER CARDS === */
.player-card {
    background: white;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    box-shadow: var(--shadow-medium);
    transition: var(--transition-normal);
    cursor: pointer;
    min-width: 80px;
    max-width: 150px;
    position: relative;
    border: 2px solid transparent;
    flex: 1 1 auto;
    box-sizing: border-box;
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.player-card:active {
    transform: translateY(0);
}

.player-card.captain {
    border-color: #FFD700;
    background: linear-gradient(145deg, #fff 0%, #FFF8DC 100%);
}

.player-card.vice {
    border-color: #C0C0C0;
    background: linear-gradient(145deg, #fff 0%, #F5F5F5 100%);
}

/* Player Card Content */
.player-name {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--primary-purple);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-name {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fixture {
    font-size: 0.65rem;
    color: #888;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expected-points {
    background: var(--primary-purple);
    color: white;
    padding: 3px 6px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
    display: inline-block;
}

/* === ROLE BADGES === */
.role-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.7rem;
    box-shadow: var(--shadow-light);
}

.role-badge.captain {
    background: #FFD700;
    color: var(--primary-purple);
}

.role-badge.vice {
    background: #C0C0C0;
    color: var(--primary-purple);
}

/* === POSITION LABELS === */
.position-label {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 20px;
    display: block;
    width: fit-content;
    margin: 0 auto 15px auto;
    position: relative;
}

.position-label.midfielder::after {
    content: "@elcaiseri";
    position: absolute;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(55, 0, 60, 0.8);
    padding: 3px 6px;
    border-radius: 3px;
    backdrop-filter: blur(2px);
    white-space: nowrap;
}

/* Position-specific colors */
.goalkeeper {
    background: var(--goalkeeper-color);
}

.defender {
    background: var(--defender-color);
}

.midfielder {
    background: var(--midfielder-color);
}

.forward {
    background: var(--forward-color);
}

/* === HOME/AWAY INDICATORS === */
.home-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 3px;
}

.home-indicator.home {
    background: var(--primary-green);
}

.home-indicator.away {
    background: #ff4757;
}

/* === STATISTICS SECTION === */
.stats-section {
    padding: 15px 20px;
    background: #f8f9fa;
}

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

.stat-card {
    background: white;
    padding: 12px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-light);
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-purple);
}

.stat-label {
    color: #666;
    margin-top: 3px;
    font-size: 0.8rem;
}

/* === CREDITS === */
.credits {
    text-align: center;
    padding: 10px;
    color: #666;
    font-size: 0.75rem;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    position: relative;
}

.credits::after {
    content: "Created by @elcaiseri";
    display: block;
    margin-top: 5px;
    font-weight: bold;
    color: var(--primary-purple);
}

/* === LOADING & ERROR STATES === */
.loading {
    text-align: center;
    padding: 30px;
    font-size: 1rem;
    color: #666;
}

.error {
    text-align: center;
    padding: 30px;
    font-size: 1rem;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: var(--border-radius);
    margin: 20px;
}

/* === DISCLAIMER SECTION === */
.disclaimer {
    text-align: center;
    margin: 10px auto;
    padding: 12px 16px;
    color: #b00;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    max-width: 800px;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: all var(--transition-normal);
}

.disclaimer:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.disclaimer strong {
    color: #8b0000;
    font-weight: 600;
}

/* === RESPONSIVE DESIGN === */

/* Tablet optimizations */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    body::after {
        font-size: 0.7rem;
        padding: 4px 6px;
    }

    .container {
        border-radius: 10px;
    }

    .header {
        padding: 10px 15px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header .gameweek {
        font-size: 0.9rem;
    }

    .pitch {
        padding: 15px 10px;
    }

    .formation-line {
        gap: 4px;
        margin: 10px 0;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .player-card {
        min-width: 70px;
        max-width: 120px;
        width: auto;
        padding: 5px;
        flex: 1 1 auto;
    }

    .player-name {
        font-size: 0.75rem;
    }

    .team-name {
        font-size: 0.65rem;
    }

    .fixture {
        font-size: 0.6rem;
    }

    .expected-points {
        font-size: 0.7rem;
        padding: 2px 5px;
    }

    .position-label {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .position-label.midfielder::after {
        right: -70px;
        font-size: 0.6rem;
        padding: 2px 5px;
    }

    .stats-section {
        padding: 10px 15px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 8px;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .role-badge {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        top: -6px;
        right: -6px;
    }

    .gameweek-selector {
        margin: 5px 10px;
    }

    .gameweek-selector select {
        font-size: 0.9rem;
        min-width: 120px;
    }

    /* Disclaimer responsive - tablet */
    .disclaimer {
        margin: 10px auto;
        padding: 8px 12px;
        font-size: 0.9rem;
        line-height: 1.4;
        max-width: 95%;
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body::after {
        font-size: 0.6rem;
        padding: 3px 5px;
    }

    .formation-line {
        gap: 3px;
        margin: 8px 0;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .player-card {
        min-width: 60px;
        max-width: 85px;
        width: auto;
        padding: 3px;
        border-radius: 8px;
        flex: 1 1 auto;
    }

    .player-name {
        font-size: 0.65rem;
        line-height: 1.2;
        margin-bottom: 2px;
    }

    .team-name {
        font-size: 0.55rem;
        line-height: 1.1;
    }

    .fixture {
        font-size: 0.5rem;
        line-height: 1.1;
    }

    .position-label {
        font-size: 0.8rem;
        margin-bottom: 6px;
        padding: 3px 10px;
    }

    .expected-points {
        font-size: 0.65rem;
    }

    .stats-grid {
        gap: 6px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .position-label.midfielder::after {
        right: -45px;
        font-size: 0.45rem;
        padding: 1px 3px;
        border-radius: 2px;
    }

    /* Disclaimer responsive - mobile */
    .disclaimer {
        margin: 10px 5px;
        padding: 8px 10px;
        font-size: 0.85rem;
        line-height: 1.4;
        max-width: calc(100% - 10px);
        border-radius: 6px;
    }
}

/* Extra small mobile devices (≤360px) */
@media (max-width: 360px) {
    .formation-line {
        gap: 2px;
        margin: 6px 0;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .player-card {
        min-width: 55px;
        max-width: 75px;
        width: auto;
        padding: 2px;
        border-radius: 6px;
        flex: 1 1 auto;
    }

    .player-name {
        font-size: 0.6rem;
        line-height: 1.1;
    }

    .team-name {
        font-size: 0.5rem;
    }

    .fixture {
        font-size: 0.45rem;
    }

    .position-label {
        font-size: 0.75rem;
        padding: 2px 8px;
        margin-bottom: 4px;
    }

    .position-label.midfielder::after {
        right: -35px;
        font-size: 0.4rem;
        padding: 1px 2px;
    }
}

/* === PRINT STYLES === */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .player-card:hover {
        transform: none;
        box-shadow: var(--shadow-medium);
    }

    .gameweek-selector {
        display: none;
    }

    body::before {
        color: rgba(0, 0, 0, 0.03) !important;
    }

    body::after {
        color: rgba(55, 0, 60, 0.9) !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border: 1px solid rgba(55, 0, 60, 0.3);
    }

    .credits::after {
        color: var(--primary-purple) !important;
        font-weight: bold !important;
    }
}

/* === UTILITY CLASSES === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === FOCUS ACCESSIBILITY === */
.player-card:focus,
.gameweek-selector select:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* === SCROLL BEHAVIOR === */
html {
    scroll-behavior: smooth;
}

/* Remove single-page constraint to enable scrolling */
.single-page {
    max-height: none;
    overflow: visible;
}

.gameweek-selector select {
    padding: 12px 16px;
    border: 2px solid var(--primary-purple);
    border-radius: var(--border-radius);
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--primary-purple);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 180px;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-light);
    appearance: none;
    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='%2337003c' 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 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.gameweek-selector select:hover {
    border-color: var(--primary-green);
    background: linear-gradient(145deg, #ffffff 0%, #f0fff4 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.gameweek-selector select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.2), var(--shadow-medium);
    background: white;
}

.gameweek-selector select:active {
    transform: translateY(0);
    box-shadow: var(--shadow-light);
}

/* === COLLABORATION SECTION === */
.collaboration-section {
    text-align: center;
    margin: 0px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius-large);
    color: white;
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.collaboration-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.collaboration-title {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: bold;
    position: relative;
    z-index: 1;
}

.collaboration-description {
    margin: 0 0 20px 0;
    font-size: 0.9em;
    opacity: 0.9;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

.collaboration-button {
    display: inline-block;
    background: white;
    color: var(--primary-purple);
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-medium);
    position: relative;
    z-index: 1;
    border: 2px solid transparent;
}

.collaboration-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
    background: var(--primary-green);
    color: var(--primary-purple);
    border-color: white;
}

.collaboration-button:active {
    transform: translateY(-1px);
}

.collaboration-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3), var(--shadow-heavy);
}

/* Responsive styles for collaboration section */
@media (max-width: 768px) {
    .collaboration-section {
        margin: 15px 10px;
        padding: 15px;
    }

    .collaboration-title {
        font-size: 1.1em;
    }

    .collaboration-description {
        font-size: 0.85em;
        margin-bottom: 15px;
    }

    .collaboration-button {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .collaboration-section {
        margin: 10px 5px;
        padding: 12px;
    }

    .collaboration-title {
        font-size: 1em;
        margin-bottom: 8px;
    }

    .collaboration-description {
        font-size: 0.8em;
        margin-bottom: 12px;
    }

    .collaboration-button {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}
