:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --slot-bg: #f9fafb;
    --slot-border: #d1d5db;
    --success-color: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-bottom: 80px;
    /* Space for floating button */
}

/* Header */
.app-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    height: 40px;
    width: auto;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.team-select {
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid white;
    background-color: transparent;
    color: white;
    font-weight: 500;
    cursor: pointer;
}

.team-select option {
    background-color: white;
    color: var(--text-main);
}

/* Main Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Player Pool */
.player-pool-section {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.player-pool-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 60px;
    /* Drop zone */
}

/* Player Card */
.player-card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: grab;
    user-select: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.1s;
    touch-action: none;
    /* Helpful for mobile drag */
}

.player-card:active {
    cursor: grabbing;
    transform: scale(1.02);
}

.player-name {
    font-weight: 600;
}

.player-points {
    background-color: var(--bg-color);
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Action Button */
.action-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    margin-left: 0.5rem;
}

.action-btn:hover {
    background-color: var(--bg-color);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.slot-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slot-option-btn {
    padding: 0.75rem;
    text-align: left;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.slot-option-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Lineup Section */
.lineup-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.lineup-logo {
    height: 50px;
    width: auto;
}

.lineup-header h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--primary-color);
}

.lineup-input {
    border: none;
    border-bottom: 2px solid var(--border-color);
    background: transparent;
    font-size: 1.25rem;
    font-family: inherit;
    color: var(--text-main);
    padding: 0.25rem 0.5rem;
    width: 200px;
    font-weight: 500;
    text-align: center;
}

.lineup-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.matches-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.match-header {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.match-slot-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.player-slot-container label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.player-slot {
    background-color: var(--slot-bg);
    border: 2px dashed var(--slot-border);
    border-radius: 0.375rem;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-slot .player-card {
    width: 100%;
    margin: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}

.match-total {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.match-total strong {
    font-size: 1rem;
    color: var(--primary-color);
}

/* Grand Total */
.grand-total-card {
    margin-top: 2rem;
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.grand-total-card h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.grand-total-card strong {
    font-size: 2.5rem;
    font-weight: 700;
}

/* Floating Actions */
.floating-actions {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 50;
}

.btn-primary {
    background-color: var(--success-color);
    color: white;
    border: none;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #059669;
}

/* Desktop Responsive */
@media (min-width: 768px) {
    .app-header {
        flex-direction: row;
        justify-content: space-between;
    }

    .app-container {
        flex-direction: row;
        align-items: flex-start;
    }

    .player-pool-section {
        flex: 1;
        position: sticky;
        top: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .player-list {
        flex-direction: column;
    }

    .lineup-section {
        flex: 2;
    }

    .matches-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .match-slot-group {
        flex-direction: row;
    }

    .player-slot-container {
        flex: 1;
    }

    .grand-total-card {
        margin-top: 1rem;
    }
}