:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-bg: #1f2937;
    --dark-card: #374151;
    --dark-text: #f9fafb;
    --light-bg: #f9fafb;
    --light-card: #ffffff;
    --light-text: #1f2937;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
    
    /* Random picker specific colors */
    --accent-color: #ff5722;
    --accent-hover: #e64a19;
    --accent-light: #ffab91;
    --input-bg: #f9f9f9;
    --history-bg: #fafafa;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--light-bg) 0%, #e0f2fe 100%);
    color: var(--light-text);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.dark-mode {
    background: linear-gradient(135deg, var(--dark-bg) 0%, #1e3a8a 100%);
    color: var(--dark-text);
    --input-bg: #2a2a2a;
    --history-bg: #2a2a2a;
}

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

/* Header Styles */
header {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.dark-mode header {
    background-color: rgba(31, 41, 55, 0.9);
}

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

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

.logo-container a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo {
    height: 40px;
    margin-right: 15px;
}

.site-title {
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-actions {
    display: flex;
    gap: 15px;
}

#theme-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--light-text);
    background-color: #e2e8f0;
}

.dark-mode #theme-btn {
    color: var(--dark-text);
    background-color: #4b5563;
}

#theme-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: rotate(30deg);
}

/* Page Title */
.page-title {
    text-align: center;
    margin: 30px 0;
}

.page-title h1 {
    font-size: 36px;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--accent-color), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
}

.page-title h1::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    border-radius: 2px;
}

.page-title p {
    font-size: 18px;
    color: #64748b;
    margin-top: 15px;
}

.dark-mode .page-title p {
    color: #9ca3af;
}

/* Main Container */
.random-picker-container {
    background-color: var(--light-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    margin: 20px 0;
    transition: var(--transition);
}

.dark-mode .random-picker-container {
    background-color: var(--dark-card);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Input Section */
.input-section {
    background-color: var(--input-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

.dark-mode .input-section {
    border-color: #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.input-section:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.dark-mode .input-section:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.input-section h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-description {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.6;
}

.dark-mode .input-description {
    color: #9ca3af;
}

.form-label {
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 8px;
    display: block;
}

.dark-mode .form-label {
    color: var(--dark-text);
}

/* Textarea */
#studentListInput {
    width: 100%;
    min-height: 220px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
    line-height: 1.5;
    font-family: inherit;
    background-color: white;
    color: var(--light-text);
}

.dark-mode #studentListInput {
    border-color: #444;
    background-color: #333;
    color: var(--dark-text);
}

#studentListInput:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1);
}

.dark-mode #studentListInput:focus {
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.2);
}

.selection-mode {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selection-mode-select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: #fff;
    color: var(--light-text);
    transition: all 0.3s ease;
    appearance: none;
}

.selection-mode-select:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1);
}

.dark-mode .selection-mode-select {
    border-color: #444;
    background-color: #333;
    color: var(--dark-text);
}

.dark-mode .selection-mode-select:focus {
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.2);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 1rem;
    min-width: 180px;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 6px rgba(255, 87, 34, 0.25);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(255, 87, 34, 0.3);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #333;
}

.dark-mode .btn-secondary {
    background-color: #444;
    color: #eee;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
    transform: translateY(-3px);
}

.dark-mode .btn-secondary:hover {
    background-color: #555;
}

.btn-sound {
    background-color: #e2f0fd;
    color: var(--primary-color);
}

.dark-mode .btn-sound {
    background-color: #2c3e50;
    color: #93c5fd;
}

.btn-sound:hover {
    background-color: #cce3fc;
    transform: translateY(-3px);
}

.dark-mode .btn-sound:hover {
    background-color: #3c526a;
}

.btn-sound.muted {
    background-color: #f8f8f8;
    color: #9ca3af;
}

.dark-mode .btn-sound.muted {
    background-color: #333;
    color: #6b7280;
}

.btn i {
    font-size: 1.1rem;
}

/* Results Section */
.results-section {
    display: flex;
    flex-direction: column;
    background-color: var(--light-card);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid #eaeaea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.dark-mode .results-section {
    background-color: var(--dark-card);
    border-color: #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.results-section:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.dark-mode .results-section:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.results-section h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-list-container {
    flex: 1;
    background-color: var(--history-bg);
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    overflow: hidden;
    margin-bottom: 20px;
}

.dark-mode .results-list-container {
    border-color: #444;
}

#selectionHistory {
    max-height: 220px;
    overflow-y: auto;
    list-style-type: none;
    padding: 15px;
}

.history-item {
    background-color: white;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    color: var(--light-text);
    border-left: 3px solid var(--primary-color);
    animation: slideIn 0.3s ease-out forwards;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark-mode .history-item {
    background-color: #333;
    color: var(--dark-text);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item-number {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 24px;
}

.dark-mode .history-item-number {
    color: #93c5fd;
}

.history-item-time {
    font-size: 0.8rem;
    color: #9ca3af;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stats Container */
.stats-container {
    display: flex;
    justify-content: space-between;
    background-color: #f8fafc;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
}

.dark-mode .stats-container {
    background-color: #2d3748;
    border-color: #4a5568;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.stat-item:not(:last-child) {
    border-right: 1px solid #e2e8f0;
}

.dark-mode .stat-item:not(:last-child) {
    border-right-color: #4a5568;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 5px;
}

.dark-mode .stat-label {
    color: #a0aec0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.dark-mode .stat-value {
    color: #93c5fd;
}

/* Instructions */
.instructions {
    background-color: #fff9f5;
    border-left: 4px solid var(--accent-color);
    padding: 20px;
    margin-top: 30px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.dark-mode .instructions {
    background-color: #3a2a22;
    border-color: var(--accent-color);
}

.instructions h4 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions ol {
    margin-left: 25px;
    color: #555;
    line-height: 1.7;
}

.dark-mode .instructions ol {
    color: #bbb;
}

.instructions li {
    margin-bottom: 8px;
}

.instructions li:last-child {
    margin-bottom: 0;
}

/* Wheel Overlay */
.wheel-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.wheel-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.2),
                0 0 0 20px rgba(255, 255, 255, 0.1);
    transition: transform 5s cubic-bezier(0.1, 0.05, 0.05, 1);
}

.wheel-segment {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 50%;
    transform-origin: 0% 100%;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    color: #fff;
    font-weight: bold;
    font-size: 0.9rem;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.wheel-segment-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center bottom;
    pointer-events: none;
    text-align: center;
}

.wheel-segment-label {
    display: inline-block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 70%;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    transform-origin: center center;
}

.wheel-pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 40px;
    background: #fff;
    clip-path: polygon(50% 0, 0% 100%, 100% 100%);
    z-index: 10;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

/* Winner Overlay */
.winner-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.winner-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.winner-container {
    position: relative;
    max-width: 500px;
    width: 90%;
    padding: 30px;
    background: white;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    overflow: hidden;
}

.dark-mode .winner-container {
    background: var(--dark-card);
}

.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    opacity: 0.8;
    animation: confettiDrop 5s linear infinite;
}

@keyframes confettiDrop {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(500px) rotate(360deg);
        opacity: 0;
    }
}

.winner-content {
    position: relative;
    z-index: 1;
}

.winner-label {
    font-size: 1.2rem;
    color: #64748b;
    margin-bottom: 15px;
}

.dark-mode .winner-label {
    color: #9ca3af;
}

.winner-name {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-color);
    padding: 15px 20px;
    margin-bottom: 15px;
    background: #fff9f5;
    border: 2px solid #ffece2;
    border-radius: 10px;
    animation: pulse 2s infinite;
}

.dark-mode .winner-name {
    background: #3a2a22;
    border-color: #543b2a;
}

.winner-emoji {
    font-size: 3rem;
    animation: jump 1s infinite alternate;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 87, 34, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 87, 34, 0);
    }
}

@keyframes jump {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-10px);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Footer styles */
.footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.dark-mode .footer {
    background-color: rgba(31, 41, 55, 0.8);
    border-top-color: #4b5563;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-links {
    line-height: 1.6;
    color: #64748b;
    font-size: 0.9rem;
}

.dark-mode .footer-links {
    color: #9ca3af;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .random-picker-container {
        padding: 20px;
    }
    
    .wheel-container {
        width: 350px;
        height: 350px;
    }
}

@media (max-width: 768px) {
    .page-title h1 {
        font-size: 28px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .wheel-container {
        width: 300px;
        height: 300px;
    }
    
    .winner-name {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .page-title h1 {
        font-size: 24px;
    }
    
    .page-title p {
        font-size: 16px;
    }
    
    .input-section,
    .results-section {
        padding: 15px;
    }
    
    .wheel-container {
        width: 250px;
        height: 250px;
    }
    
    .winner-container {
        padding: 20px;
    }
    
    .winner-name {
        font-size: 1.8rem;
        padding: 10px;
    }
    
    .winner-emoji {
        font-size: 2.5rem;
    }
}
