:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --seat-empty: #e5e7eb;
    --seat-occupied: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 24px;
    gap: 0.75rem;
}

button {
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

button:active {
    transform: scale(0.98);
}

.primary {
    background: var(--primary);
    color: white;
}

.primary:hover {
    background: var(--primary-hover);
}

.secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.secondary:hover {
    background: #f3f4f6;
}

.danger {
    background: #fee2e2;
    color: #ef4444;
}

.danger:hover {
    background: #fecaca;
}

.stats {
    display: flex;
    justify-content: space-between;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Classroom Area */
main {
    display: flex;
    gap: 2rem;
    width: 100%;
}

/* Classroom Area */
.classroom {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.screen-area {
    display: flex;
    justify-content: center;
}

.screen {
    width: 60%;
    background: #e5e7eb;
    color: #9ca3af;
    text-align: center;
    padding: 0.5rem;
    border-radius: 0 0 12px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
}

.seat {
    aspect-ratio: 4/3;
    background: var(--seat-empty);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    user-select: none;
}

.seat.occupied {
    background: var(--seat-occupied);
    color: var(--text-main);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: grab;
}

.seat.occupied:active {
    cursor: grabbing;
}

.seat.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.seat-number {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.65rem;
    color: #9ca3af;
}

@media (max-width: 1024px) {
    main {
        flex-direction: column;
    }

    .controls {
        width: 100%;
        flex-direction: row;
    }

    .panel {
        flex: 1;
    }

    textarea {
        height: 100px;
    }
}

/* Accent Button */
.accent {
    background: var(--secondary);
    color: white;
}

.accent:hover {
    background: #db2777;
}

/* Highlight Animation */
@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
        transform: scale(1);
    }
}

.seat.highlight {
    background: #fef3c7;
    border-color: #f59e0b;
    z-index: 10;
}

.seat.winner {
    background: #fbbf24;
    color: black;
    animation: pulse-gold 1s infinite;
    z-index: 20;
    font-weight: 700;
    border: 2px solid #b45309;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    background: white;
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.overlay.hidden .overlay-content {
    transform: scale(0.9);
}

.picked-name {
    font-size: 3rem;
    font-weight: 800;
    margin: 1.5rem 0;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#btn-close-overlay {
    background: var(--text-main);
    color: white;
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

#btn-close-overlay:hover {
    background: black;
}

.classroom header {
    text-align: center;
}

.app-container>header {
    text-align: center;
    margin-bottom: 2rem;
}

/* --- Cleaning Duty Scheduler Styles --- */

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.task-card {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.2s;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.task-card.dragging {
    opacity: 0.5;
    border: 2px dashed var(--primary);
    background: #f3f4f6;
}

.task-card.drag-over-task {
    border-top: 3px solid var(--primary);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.task-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.student-count-badge {
    background: #e0e7ff;
    color: var(--primary);
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}

.btn-delete-task {
    background: transparent;
    color: #9ca3af;
    font-size: 1.25rem;
    padding: 0.25rem;
    line-height: 1;
}

.btn-delete-task:hover {
    color: #ef4444;
    background: #fee2e2;
}

.task-slots {
    min-height: 60px;
    background: #f9fafb;
    border-radius: 12px;
    padding: 0.5rem;
    border: 2px dashed #e5e7eb;
    transition: all 0.2s;
}

.task-slots.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.student-list {
    min-height: 150px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 0.5rem;
    border: 2px dashed #e5e7eb;
    transition: all 0.2s;
}

.student-list.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.student-item {
    padding: 0.2rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 0.2rem;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.student-item:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.student-item.dragging {
    opacity: 0.5;
    background: #f9fafb;
    cursor: grabbing;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .app-container {
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: none;
        padding: 0;
        backdrop-filter: none;
        background: white;
    }

    header,
    .controls,
    .overlay,
    .screen-area,
    .btn-delete-task {
        display: none !important;
    }

    main {
        display: block;
    }

    .classroom {
        width: 100%;
    }

    .tasks-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 1rem;
    }

    .task-card {
        break-inside: avoid;
        border: 1px solid #000;
        box-shadow: none;
        margin-bottom: 1rem;
    }

    .task-slots {
        border: none;
        background: white;
    }

    .student-item {
        border: 1px solid #eee;
    }
}