/* static/css/style.css */
:root {
    --primary-blue: #37003c;
    --secondary-blue: #00ff87;
    --accent-blue: #00c2ff;
    --background-light: #f5f5f5;
    --card-white: #ffffff;
    --text-dark: #333333;
    --border-light: #e0e0e0;
    --success-green: #4caf50;
    --warning-orange: #ff9800;
    --error-red: #f44336;
}

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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background-color: var(--primary-blue);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid var(--secondary-blue);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
}

.nav-logo {
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
}

.nav-logo::before {
    content: "⚽";
    margin-right: 0.5rem;
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hero {
    background: linear-gradient(rgba(55, 0, 60, 0.8), rgba(55, 0, 60, 0.8)),
                url('https://images.unsplash.com/photo-1560272564-c83b66b1ad12?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 5rem 1.5rem;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 2.5rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background-color: #2a002f;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: var(--secondary-blue);
    color: var(--primary-blue);
    border: none;
    font-weight: 600;
}

.btn-secondary:hover {
    background-color: #00e678;
    transform: translateY(-2px);
}

.features {
    padding: 5rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.features h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: var(--primary-blue);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature {
    background-color: var(--card-white);
    padding: 2.5rem 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s ease;
    border-top: 4px solid var(--secondary-blue);
}

.feature:hover {
    transform: translateY(-5px);
}

.feature h3 {
    margin-bottom: 1.2rem;
    color: var(--primary-blue);
    font-size: 1.5rem;
}

.feature p {
    color: #666;
}

.auth-container {
    max-width: 500px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.auth-form {
    background-color: var(--card-white);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-blue);
    font-size: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #444;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 0, 60, 0.1);
}

.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    font-weight: 500;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 16px;
    font-weight: bold;
    position: relative;
    animation: shake 0.5s ease-in-out;
}

.alert-error .close-error {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    background: none;
    border: none;
    color: #c62828;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.dashboard {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.dashboard h2 {
    margin-bottom: 2rem;
    color: var(--primary-blue);
    font-size: 2.2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.dashboard-card {
    background-color: var(--card-white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-top: 4px solid var(--secondary-blue);
}

.dashboard-card h3 {
    margin-bottom: 1.2rem;
    color: var(--primary-blue);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
}

.dashboard-card h3::before {
    content: "•";
    color: var(--secondary-blue);
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

#countdown-timer {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-blue);
    padding: 1rem;
    background-color: #f1f8f4;
    border-radius: 8px;
    text-align: center;
    animation: pulse 2s infinite;
}

.players-list {
    background-color: var(--card-white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.players-list h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
    font-size: 1.6rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    background-color: var(--primary-blue);
    color: white;
    font-weight: 600;
}

tr:hover {
    background-color: #f8f9fa;
}

.team-management {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.team-management h2 {
    margin-bottom: 2rem;
    color: var(--primary-blue);
    font-size: 2.2rem;
}

.team-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.team-section {
    display: none;
}

.team-section.active {
    display: block;
}

.formation-selector {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--card-white);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.formation-selector label {
    margin-right: 1rem;
    font-weight: 600;
    color: #444;
}

.formation-selector select {
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
}

.player-selection {
    margin-bottom: 2.5rem;
}

.position-group {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background-color: var(--card-white);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.position-group h4 {
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
    font-size: 1.3rem;
    border-bottom: 2px solid var(--secondary-blue);
    padding-bottom: 0.7rem;
}

.player-checkbox {
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background-color 0.3s;
}

.player-checkbox:hover {
    background-color: #e9f7ef;
}

.player-checkbox input[type="checkbox"] {
    margin-right: 1rem;
    transform: scale(1.3);
    cursor: pointer;
}

.player-checkbox label {
    font-weight: 500;
    cursor: pointer;
    flex-grow: 1;
}

/* Team visualization */
.team-visualization {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Football Field (Half) */
.football-field {
    background: linear-gradient(to bottom, #4caf50, #2e7d32);
    border: 3px solid white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    min-height: 300px;
    position: relative;
    overflow: hidden;
    transform: scaleX(-1); /* Flip horizontally for correct orientation */
}

.football-field::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        /* Goal area */
        linear-gradient(90deg, transparent 15%, rgba(255, 255, 255, 0.3) 15%, rgba(255, 255, 255, 0.3) 85%, transparent 85%),
        /* Penalty area */
        linear-gradient(90deg, transparent 5%, rgba(255, 255, 255, 0.3) 5%, rgba(255, 255, 255, 0.3) 95%, transparent 95%),
        /* Center circle */
        radial-gradient(circle at 50% 100%, transparent 20%, rgba(255, 255, 255, 0.3) 20%, rgba(255, 255, 255, 0.3) 21%, transparent 21%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    opacity: 0.5;
}

.field-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
    z-index: 1;
    transform: scaleX(-1); /* Counter-flip the container to make content readable */
}

.position-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.position-slot {
    width: 80px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    padding: 5px;
}

/* Position-specific colors */
.position-slot[data-position="GK"] {
    background-color: #ffcccc;
    border-left: 4px solid #ff0000;
}

.position-slot[data-position="DEF"] {
    background-color: #ccffcc;
    border-left: 4px solid #00cc00;
}

.position-slot[data-position="MID"] {
    background-color: #ccccff;
    border-left: 4px solid #0000cc;
}

.position-slot[data-position="FWD"] {
    background-color: #ffffcc;
    border-left: 4px solid #cccc00;
}

.selected-player {
    font-size: 0.7rem;
    font-weight: bold;
    text-align: center;
    color: var(--primary-blue);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    padding: 2px;
}

/* Bench visualization */
.bench-visualization {
    background-color: #f0f0f0;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.bench-visualization h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
    text-align: center;
}

.bench-slots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bench-slot {
    width: 120px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    font-size: 0.8rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid #ccc;
}

/* Bench position colors */
.bench-slot.bench-gk {
    background-color: #ffcccc;
    border-left: 4px solid #ff0000;
}

.bench-slot.bench-def {
    background-color: #ccffcc;
    border-left: 4px solid #00cc00;
}

.bench-slot.bench-mid {
    background-color: #ccccff;
    border-left: 4px solid #0000cc;
}

.bench-slot.bench-fwd {
    background-color: #ffffcc;
    border-left: 4px solid #cccc00;
}

/* Substitutions */
.substitution-interface {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.substitution-column {
    flex: 1;
}

.substitution-column h4 {
    margin-bottom: 1rem;
    color: var(--primary-blue);
    text-align: center;
}

.substitution-column select {
    width: 100%;
    height: 200px;
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background-color: white;
}

.substitution-arrow {
    font-size: 2rem;
    color: var(--primary-blue);
}

/* Transfers */
.transfer-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.players-section {
    margin-top: 2rem;
    text-align: center;
}

#toggle-players-btn {
    margin-bottom: 1rem;
}

.leagues {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.leagues h2 {
    margin-bottom: 2rem;
    color: var(--primary-blue);
    font-size: 2.2rem;
}

.league-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.create-league, .join-league {
    background-color: var(--card-white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.create-league h3, .join-league h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
    font-size: 1.4rem;
}

.my-leagues {
    background-color: var(--card-white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.my-leagues h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
    font-size: 1.6rem;
}

footer {
    background-color: var(--primary-blue);
    color: white;
    text-align: center;
    padding: 2.5rem 1.5rem;
    margin-top: auto;
}

footer p {
    opacity: 0.8;
}

/* Animation for countdown timer */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Formation-specific field layouts */
.formation-4-4-2 .fwd-row {
    justify-content: space-around;
}

.formation-4-4-2 .mid-row {
    justify-content: space-around;
}

.formation-4-4-2 .def-row {
    justify-content: space-around;
}

.formation-4-3-3 .fwd-row {
    justify-content: space-around;
}

.formation-4-3-3 .mid-row {
    justify-content: space-around;
}

.formation-4-3-3 .def-row {
    justify-content: space-around;
}

.formation-3-5-2 .fwd-row {
    justify-content: space-around;
}

.formation-3-5-2 .mid-row {
    justify-content: space-around;
}

.formation-3-5-2 .def-row {
    justify-content: space-around;
}

.formation-4-5-1 .fwd-row {
    justify-content: center;
}

.formation-4-5-1 .mid-row {
    justify-content: space-around;
}

.formation-4-5-1 .def-row {
    justify-content: space-around;
}

/* Responsive design */
@media (max-width: 1200px) {
    .football-field {
        width: 95% !important;
        min-height: 400px;
    }
    .bench-cards-container {
        width: 95% !important;
    }

    .position-slot,
    .pick-team-slot,
    .transfer-slot {
        min-width: 100px;
        min-height: 80px;
        padding: 8px;
    }
}

@media (max-width: 768px) {
    /* Global mobile improvements */
    body {
        font-size: 14px;
    }

    /* Budget Display - Better mobile layout */
    .budget-display {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .budget-display h4 {
        font-size: 0.95em;
        padding: 8px;
        background: white;
        border-radius: 6px;
        border-left: 4px solid #007bff;
    }

    /* Team Actions - Full width buttons */
    .team-actions {
        flex-direction: column;
        gap: 8px;
    }

    .team-actions .btn {
        width: 100%;
        padding: 12px;
        font-size: 1em;
        font-weight: 600;
    }

    /* PROFESSIONAL MOBILE SQUAD LAYOUT */
    .football-field,
    .pick-team-field,
    .points-field,
    .transfer-field {
        width: 100% !important;
        min-height: 450px;
        padding: 15px 10px;
        overflow-x: visible;
    }

    /* Position rows - Better spacing */
    .position-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin-bottom: 15px;
    }

    /* IMPROVED: Professional player cards on mobile */
    .position-slot,
    .pick-team-slot,
    .transfer-slot,
    .points-slot {
        min-width: 90px !important;
        max-width: 100px;
        min-height: 100px;
        padding: 8px 6px;
        font-size: 0.75em;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        transition: all 0.2s ease;
    }

    /* Touch feedback */
    .pick-team-slot:active,
    .bench-card:active {
        transform: scale(0.95);
    }

    /* Player text - Full names visible */
    .player-name-pick,
    .player-name-points,
    .player-name-transfer {
        font-size: 0.78em;
        line-height: 1.3;
        font-weight: 700;
        word-wrap: break-word;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        max-width: 100%;
        text-align: center;
        margin-bottom: 6px;
    }

    .player-team-pick,
    .player-team-points,
    .player-team-transfer {
        font-size: 0.7em;
        margin-bottom: 4px;
        font-weight: 600;
    }

    .player-fixture-pick,
    .player-points-badge,
    .player-price-transfer {
        font-size: 0.7em;
        padding: 3px 6px;
        margin-top: 4px;
        border-radius: 8px;
    }

    .captain-badge {
        font-size: 0.65em;
        padding: 3px 6px;
        margin-top: 4px;
    }

    /* PROFESSIONAL BENCH LAYOUT */
    .bench-cards-container {
        width: 100% !important;
        padding: 15px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bench-cards-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 10px;
        min-width: min-content;
        padding-bottom: 5px;
    }

    .bench-card {
        min-width: 90px !important;
        max-width: 100px;
        min-height: 100px;
        padding: 8px 6px;
        font-size: 0.75em;
        flex-shrink: 0;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    /* Scrollbar styling for bench */
    .bench-cards-container::-webkit-scrollbar {
        height: 6px;
    }

    .bench-cards-container::-webkit-scrollbar-thumb {
        background: #007bff;
        border-radius: 3px;
    }

    /* Points summary - Stack cards */
    .points-summary-cards {
        flex-direction: column;
        gap: 10px;
    }

    .points-summary-card {
        padding: 15px;
    }

    /* Player modal - Full screen on mobile */
    .player-card-content {
        width: 95%;
        max-height: 90vh;
        margin: 5% auto;
    }

    /* Info grids - Single column */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .fixtures-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .transfer-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Game week header - Stack vertically */
    .game-week-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 15px;
    }

    /* Special buttons - Move to top */
    .triple-captain-container,
    .wildcard-transfer-container {
        position: static;
        margin-bottom: 15px;
        display: flex;
        justify-content: center;
    }

    .btn-special {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    /* Position counters - Stack vertically */
    .position-counters {
        flex-direction: column;
        gap: 8px;
    }

    .counter-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px;
        background: white;
        border-radius: 6px;
    }

    /* Formation and captain selectors */
    .formation-selector,
    .captain-selector {
        padding: 12px;
        margin-bottom: 15px;
    }

    .formation-selector select,
    .captain-selector select {
        font-size: 0.95em;
        padding: 10px;
    }

    /* Instructions - Compact */
    .substitution-instructions {
        padding: 10px;
        font-size: 0.9em;
    }

    .substitution-instructions ul {
        padding-left: 18px;
    }

    .substitution-instructions li {
        margin-bottom: 6px;
        line-height: 1.4;
    }

    /* Transfer field - Better layout */
    .transfer-field .position-row {
        gap: 8px;
        margin-bottom: 12px;
    }

    /* Navbar - Scrollable menu */
    .nav-menu {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
    }

    .nav-menu::-webkit-scrollbar {
        height: 3px;
    }

    /* Buttons - Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.95em;
    }

    /* Available players table - Responsive */
    .available-players-table {
        font-size: 0.85em;
    }

    .available-players-table th,
    .available-players-table td {
        padding: 8px 6px;
    }
}

/* Extra small screens - Enhanced for better mobile experience */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    /* Tighter spacing for small phones */
    .football-field,
    .pick-team-field,
    .points-field,
    .transfer-field {
        padding: 12px 8px;
        min-height: 400px;
    }

    .position-row {
        gap: 6px;
        margin-bottom: 12px;
    }

    /* Smaller but still readable cards */
    .position-slot,
    .pick-team-slot,
    .transfer-slot,
    .points-slot {
        min-width: 75px !important;
        max-width: 85px;
        min-height: 95px;
        padding: 6px 4px;
        font-size: 0.7em;
    }

    .bench-card {
        min-width: 75px !important;
        max-width: 85px;
        min-height: 95px;
        padding: 6px 4px;
    }

    .bench-cards-row {
        gap: 8px;
    }

    /* Text adjustments */
    .player-name-pick,
    .player-name-points,
    .player-name-transfer {
        font-size: 0.75em;
        line-height: 1.2;
        margin-bottom: 4px;
    }

    .player-team-pick,
    .player-team-points,
    .player-team-transfer {
        font-size: 0.68em;
    }

    .player-fixture-pick,
    .player-points-badge,
    .player-price-transfer {
        font-size: 0.68em;
        padding: 2px 5px;
    }

    .captain-badge {
        font-size: 0.62em;
        padding: 2px 5px;
    }

    /* Budget display - Compact */
    .budget-display h4 {
        font-size: 0.9em;
        padding: 6px;
    }

    /* Modal adjustments */
    .player-card-content {
        width: 98%;
        max-height: 95vh;
    }

    .player-card-header h3 {
        font-size: 1.1em;
    }

    .player-card-body {
        padding: 15px;
    }

    /* Smaller buttons */
    .btn {
        padding: 9px 14px;
        font-size: 0.9em;
    }

    .btn-special {
        padding: 9px 16px;
        font-size: 0.85em;
    }

    /* Position counters */
    .position-counters {
        padding: 10px;
    }

    .counter-item {
        padding: 6px;
        font-size: 0.9em;
    }

    /* Game week header */
    .game-week-header {
        padding: 12px;
    }

    .gw-badge-large {
        font-size: 0.95em;
        padding: 5px 10px;
    }

    .gw-name {
        font-size: 0.95em;
    }

    .deadline-time {
        font-size: 0.85em;
        padding: 5px 10px;
    }
}

/* Very small screens - Extreme optimization */
@media (max-width: 360px) {
    .position-slot,
    .pick-team-slot,
    .transfer-slot,
    .points-slot,
    .bench-card {
        min-width: 68px !important;
        max-width: 75px;
        min-height: 90px;
        padding: 5px 3px;
        font-size: 0.65em;
    }

    .player-name-pick,
    .player-name-points,
    .player-name-transfer {
        font-size: 0.7em;
        line-height: 1.15;
    }

    .position-row {
        gap: 4px;
        margin-bottom: 10px;
    }

    .bench-cards-row {
        gap: 6px;
    }

    .football-field,
    .pick-team-field,
    .points-field,
    .transfer-field {
        min-height: 380px;
        padding: 10px 6px;
    }

    .btn {
        font-size: 0.85em;
        padding: 8px 12px;
    }

    .budget-display h4 {
        font-size: 0.85em;
    }
}

/* Landscape mode for mobile devices */
@media (max-height: 600px) and (orientation: landscape) {
    .football-field,
    .pick-team-field,
    .points-field,
    .transfer-field {
        min-height: 350px;
    }

    .position-row {
        margin-bottom: 10px;
    }

    .position-slot,
    .pick-team-slot {
        min-height: 85px;
    }

    .player-card-content {
        max-height: 95vh;
        margin: 2.5% auto;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .pick-team-slot,
    .bench-card {
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.2);
    }

    /* Fix for iOS Safari 100vh issue */
    .player-card-modal {
        height: -webkit-fill-available;
    }
}

/* Enhanced touch experience */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    .pick-team-slot,
    .bench-card,
    .transfer-slot {
        min-height: 110px;
    }

    /* Better visual feedback */
    .pick-team-slot:active,
    .bench-card:active {
        opacity: 0.8;
    }

    /* Prevent text selection during drag/touch */
    .pick-team-slot,
    .bench-card {
        -webkit-user-select: none;
        user-select: none;
    }
}
