:root {
    --primary-color: #e91e63;
    --primary-hover: #d81b60;
    --primary-light: #fce4ec;
    --secondary-color: #333333;
    --accent-color: #ffc107;
    --success-color: #00a651;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --background: #f8f9fa;
    --surface: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius: 8px;
    --transition: all 0.3s ease;
}

/* Dark mode variables */
body.dark-mode {
    --primary-color: #f06292;
    --primary-hover: #e91e63;
    --primary-light: #880e4f;
    --secondary-color: #e0e0e0;
    --accent-color: #ffb300;
    --success-color: #00c853;
    --danger-color: #ff5252;
    --warning-color: #ffab00;
    --background: #121212;
    --surface: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-toggle {
    padding: 0.5rem;
    min-width: auto;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-weight: 300;
    margin: 0;
    font-style: normal;
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0;
}

.participant-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.participant-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 0.75rem;
}

.participant-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Add Participant Section */
.add-participant {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* Import/Export Section */
.import-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff9c4 100%);
    border-radius: var(--radius);
    border: 1px solid rgba(233, 30, 99, 0.2);
}

.file-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

#participantInput {
    flex: 1;
    min-width: 250px;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

#participantInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(233, 30, 99, 0.15);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    padding: 1rem 1.75rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled::before {
    display: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c82333 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-select {
    background: linear-gradient(135deg, var(--success-color) 0%, #008c42 100%);
    color: white;
    font-size: 1.25rem;
    padding: 1.25rem 2.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    position: relative;
}

.btn-select:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-select::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    border: 2px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-select:hover::after {
    opacity: 1;
}

.btn-icon {
    font-size: 1.25rem;
}

/* Stats */
.participant-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat {
    background: linear-gradient(135deg, var(--surface) 0%, #f8f9fa 100%);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

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

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selection Area */
.selection-area {
    text-align: center;
    margin: 2.5rem 0;
}

.selected-participant {
    margin-top: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, #fce4ec 0%, #fff9c4 100%);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.selected-participant::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color), var(--primary-color));
    border-radius: var(--radius);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

.selected-participant.has-selection {
    animation: pulse 0.6s ease-in-out;
}

.selected-participant.has-selection::before {
    opacity: 0.1;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Score Card */
.score-card {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #fff9c4 0%, #fff3e0 100%);
    border: 2px solid var(--accent-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.score-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-color);
}

.score-card h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.score-item {
    margin-bottom: 1.5rem;
}

.score-item label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.score-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-input {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    transition: var(--transition);
}

.score-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.score-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.score-input:hover::-webkit-slider-thumb {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

.score-input:hover::-moz-range-thumb {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

.score-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.score-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.total-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    background: var(--primary-light);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    min-width: 60px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.score-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Participants List */
.participants-list h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 0.5rem;
}

.participants-list h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

.list-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.participant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.participant-item {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.participant-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.participant-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.participant-item:hover::before {
    transform: scaleY(1);
}

.participant-item.excluded {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border-color: var(--danger-color);
    opacity: 0.8;
}

.participant-item.excluded::before {
    background: var(--danger-color);
}

.participant-name {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    font-size: 1rem;
}

.participant-item.excluded .participant-name {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.participant-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.btn-toggle {
    background: linear-gradient(135deg, var(--success-color) 0%, #008c42 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-toggle.exclude {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c82333 100%);
}

.btn-remove {
    background: var(--secondary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-remove:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* History Section */
.history-section {
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 2px solid var(--border-color);
}

.history-section h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 0.5rem;
}

.history-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent-color);
    border-radius: 1px;
}

.history-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.history-item {
    background: linear-gradient(135deg, #fff9c4 0%, #fff3e0 100%);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-color);
}

.history-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.history-info {
    flex: 1;
}

.history-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.history-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-scores {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.score-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.score-badge.total {
    background: var(--accent-color);
    color: white;
    font-weight: 700;
}

.history-count {
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.empty-history {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    grid-column: 1 / -1;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px dashed var(--border-color);
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .participant-section {
        padding: 1.5rem;
    }
    
    .add-participant {
        flex-direction: column;
    }
    
    #participantInput {
        min-width: 100%;
    }
    
    .participant-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .list-controls {
        flex-direction: column;
    }
    
    .list-controls .btn {
        width: 100%;
        justify-content: center;
    }
    
    .participant-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .participant-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}
