:root {
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #7c3aed;
    --accent-color: #f43f5e;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --transition: all 0.2s ease-in-out;
    --content-width: min(1200px, calc(100vw - 2rem));
    --section-padding: clamp(1rem, 3vw, 2rem);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--section-padding);
    width: 100%;
}

header {
    max-width: var(--content-width);
    margin: 0 auto 2rem auto;
    padding: var(--section-padding);
    background: var(--primary-gradient);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

header h1 {
    color: white;
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.sport-selector {
    margin-bottom: 1rem;
}

.sport-selector select {
    padding: 0.5rem 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    background-color: white;
    cursor: pointer;
    transition: var(--transition);
}

.sport-selector select:hover {
    border-color: var(--secondary-color);
}

.section {
    display: none;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.team-setup, .player-input, .substitution-panel, .game-header {
    background: var(--card-bg);
    padding: var(--section-padding);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
}

.team-setup h2, .player-input h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: 1rem;
    background: var(--background-color);
    padding: var(--section-padding);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    width: 100%;
}

.input-group input {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input, select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-color);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-group button {
    width: 100%;
    margin-top: 0.5rem;
}

.setup-container, .game-container {
    max-width: var(--content-width);
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 3vw, 2rem);
}

button {
    background: var(--primary-gradient);
    color: white;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

#start-game {
    background: var(--success-color);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    width: 100%;
    margin-top: 1rem;
    transition: var(--transition);
}

#start-game:hover {
    background-color: #0d9488;
    transform: translateY(-1px);
}

#start-game.paused {
    background: var(--warning-color);
}

#start-game.paused:hover {
    background-color: #d97706;
}

.player-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: clamp(1rem, 3vw, 2rem);
    margin-top: 2rem;
    width: 100%;
}

.list-container {
    background: var(--card-bg);
    padding: var(--section-padding);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
}

.list-container h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 150px;
}

.player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
}

.player-card:hover {
    transform: translateX(5px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    flex: 1;
}

.player-info > span:first-child {
    font-weight: 500;
    min-width: clamp(80px, 15vw, 100px);
    margin-right: -0.25rem;
}

.player-time {
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.9;
    min-width: 60px;
    text-align: right;
}

.position-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
    margin-right: 1rem;
}

.position-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: help;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.1);
}

.position-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.2);
}

.player-position {
    display: none;
}

.game-header {
    background: var(--card-bg);
    padding: var(--section-padding);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-timer {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--background-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-color);
}

.pause-button {
    display: none;
}

.substitution-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: 2rem;
    width: 100%;
}

.substitution-history {
    background: var(--background-color);
    padding: var(--section-padding);
    border-radius: var(--border-radius);
    margin-top: 2rem;
    width: 100%;
}

.substitution-history h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

#sub-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.history-item span:last-child {
    color: var(--text-color);
    font-weight: 500;
}

.history-time {
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

.player-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.player-list.drag-over {
    background: rgba(52, 152, 219, 0.1);
    border-radius: var(--border-radius);
}

@media (max-width: 850px) {
    :root {
        --content-width: calc(100vw - 2rem);
    }

    .container, header, .setup-container, .game-container {
        padding: 1rem;
    }

    .input-group, .substitution-controls {
        grid-template-columns: 1fr;
    }

    .player-lists {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .game-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    header h1 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    .game-timer {
        font-size: clamp(1.25rem, 4vw, 1.5rem);
    }

    .player-info > span:first-child {
        min-width: clamp(80px, 15vw, 100px);
    }

    .position-badges {
        gap: 0.25rem;
    }

    .position-badge {
        padding: 0.25rem 0.5rem;
        font-size: clamp(0.75rem, 2vw, 0.875rem);
    }
}

@media (max-width: 480px) {
    :root {
        --content-width: 100vw;
    }

    .container, header, .setup-container, .game-container {
        padding: 0.75rem;
        border-radius: 0;
    }

    .team-setup, .player-input, .substitution-panel, .game-header, .list-container {
        padding: 0.75rem;
        border-radius: 0;
    }

    .input-group {
        padding: 0.75rem;
        border-radius: 0;
    }

    .substitution-history {
        padding: 0.75rem;
        border-radius: 0;
    }

    .player-card {
        padding: 0.75rem;
        border-radius: 0;
    }

    .history-item {
        padding: 0.75rem;
        border-radius: 0;
    }

    .position-badges {
        margin-right: 0.5rem;
    }

    .player-time {
        min-width: 50px;
    }
}

#add-player {
    background: var(--primary-gradient);
    color: white;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
}

#add-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

#add-player:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

#add-player:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.substitution-panel {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
}

.substitution-panel h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

@media (min-width: 1200px) {
    .input-group {
        grid-template-columns: repeat(3, 1fr);
    }

    .player-lists {
        grid-template-columns: repeat(2, 1fr);
    }

    .substitution-controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.player-timer {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-color);
    min-width: 60px;
    text-align: right;
}

.remove-player {
    background: none;
    border: none;
    color: #ff4444;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.player-card:hover .remove-player {
    opacity: 1;
    visibility: visible;
}

.remove-player:hover {
    background-color: rgba(255, 68, 68, 0.1);
} 