/* ============================================
   DESIGN SYSTEM — Sorteador de Sala de Aula
   ============================================ */

:root {
    /* Color Palette */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #1a1a2e;
    --surface: #1e2a45;
    --surface-hover: #253352;

    --accent-primary: #6c63ff;
    --accent-primary-glow: rgba(108, 99, 255, 0.3);
    --accent-secondary: #00d2ff;
    --accent-gradient: linear-gradient(135deg, #6c63ff 0%, #00d2ff 100%);
    --accent-gradient-hover: linear-gradient(135deg, #7b73ff 0%, #33ddff 100%);

    --text-primary: #e8e8f0;
    --text-secondary: #8b8ba3;
    --text-muted: #5a5a73;

    --border: rgba(108, 99, 255, 0.15);
    --border-hover: rgba(108, 99, 255, 0.35);

    --danger: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;

    /* Draw Colors */
    --draw-1: #6c63ff;
    --draw-2: #ff6b6b;
    --draw-3: #feca57;
    --draw-4: #48dbfb;
    --draw-5: #ff9ff3;
    --draw-6: #54a0ff;
    --draw-7: #5f27cd;
    --draw-8: #01a3a4;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Fonts */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    font-family: var(--font);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   TOP BAR
   ============================================ */

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.top-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
}

.top-bar-brand i {
    font-size: 1.4rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--surface-hover);
}

.history-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--accent-primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app-container {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

.config-panel {
    width: 380px;
    min-width: 380px;
    padding: 20px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(100vh - 56px);
}

.result-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 56px);
}

.panel-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   MODE TOGGLE
   ============================================ */

.mode-toggle-wrapper {
    display: flex;
    justify-content: center;
}

.mode-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    width: 100%;
}

.mode-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mode-btn.active {
    background: var(--accent-gradient);
    color: white;
}

.mode-btn:not(.active):hover {
    color: var(--text-primary);
    background: var(--surface);
}

/* ============================================
   CONFIG BLOCKS
   ============================================ */

.draw-config-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    transition: border-color 0.2s ease;
}

.draw-config-block:hover {
    border-color: var(--border-hover);
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.config-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.config-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-input {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    transition: border-color 0.2s ease;
    width: 100%;
    outline: none;
}

.field-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.btn-icon-sm {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-sm:hover {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.1);
}

.btn-icon-sm:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon-sm:disabled:hover {
    color: var(--text-muted);
    background: transparent;
}

#draw-configs-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-add {
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-add:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-primary-glow);
}

/* ============================================
   NAMES MODE
   ============================================ */

.names-config {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.names-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.names-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.names-textarea::placeholder {
    color: var(--text-muted);
}

.names-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.names-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   GLOBAL OPTIONS (Toggle Switches)
   ============================================ */

.global-options {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 22px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(18px);
    background: white;
}

/* ============================================
   PRESETS
   ============================================ */

.presets-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.presets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.presets-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.presets-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preset-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-item:hover {
    border-color: var(--accent-primary);
    background: rgba(108, 99, 255, 0.08);
}

.preset-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
}

.preset-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.preset-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    transition: color 0.2s;
}

.preset-delete:hover {
    color: var(--danger);
}

.presets-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 6px;
}

/* ============================================
   DRAW BUTTON
   ============================================ */

.btn-draw {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

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

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

.btn-draw:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px var(--accent-primary-glow);
}

.btn-draw:active {
    transform: translateY(0);
}

/* ============================================
   RESULT AREA
   ============================================ */

.result-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 200px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
}

.empty-state.small {
    padding: 30px 20px;
}

.empty-state.small i {
    font-size: 1.5rem;
}

.draw-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    animation: card-in 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

.draw-result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--accent-gradient));
}

.draw-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.draw-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.draw-title .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.btn-redo {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-redo:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.numbers-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    min-height: 65px;
    padding: 10px 0;
}

.drawn-number {
    width: 60px;
    height: 60px;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 800;
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    user-select: none;
}

.drawn-number.revealed {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.drawn-number.hidden {
    background: var(--surface) !important;
    border: 2px dashed var(--border-hover);
    cursor: pointer;
    font-size: 1.5rem;
}

.drawn-number.hidden:hover {
    transform: scale(1.15);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-primary-glow);
}

/* Name result cards */
.drawn-name {
    padding: 10px 20px;
    background: var(--surface);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.2s ease;
    text-align: center;
    border-left: 4px solid var(--accent-primary);
}

.drawn-name.hidden {
    background: var(--surface);
    border-left-color: var(--text-muted);
    cursor: pointer;
    color: var(--text-muted);
}

.drawn-name.hidden:hover {
    transform: scale(1.03);
    border-left-color: var(--accent-primary);
}

.shuffling-number {
    width: 100px;
    height: 100px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 900;
    animation: shuffle-pulse 0.15s ease-in-out infinite alternate;
}

.shuffling-name {
    padding: 12px 24px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    display: inline-block;
    animation: shuffle-pulse 0.15s ease-in-out infinite alternate;
}

/* ============================================
   HISTORY PANEL
   ============================================ */

.history-panel {
    position: fixed;
    top: 56px;
    right: -400px;
    width: 380px;
    height: calc(100vh - 56px);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 90;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel.open {
    right: 0;
}

.history-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-header div {
    display: flex;
    gap: 4px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    animation: card-in 0.3s ease-out;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-title {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.history-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.history-item-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.history-name {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-input);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-primary);
}

/* ============================================
   PRESENTATION MODE
   ============================================ */

.presentation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a15 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.presentation-content {
    text-align: center;
    padding: 40px;
    width: 100%;
    max-width: 90vw;
}

.presentation-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.presentation-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    min-height: 150px;
    align-items: center;
    margin-bottom: 40px;
}

.presentation-numbers .drawn-number {
    width: 120px;
    height: 120px;
    font-size: 3rem;
}

.presentation-numbers .drawn-number.hidden {
    font-size: 3.5rem;
}

.presentation-numbers .shuffling-number {
    width: 140px;
    height: 140px;
    font-size: 4rem;
}

.presentation-numbers .drawn-name {
    font-size: 2.5rem;
    padding: 20px 40px;
}

.presentation-numbers .shuffling-name {
    font-size: 3rem;
    padding: 20px 40px;
}

.presentation-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn-draw-pres {
    padding: 16px 48px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-family: var(--font);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-draw-pres:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--accent-primary-glow);
}

.btn-exit-pres {
    padding: 16px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-exit-pres:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes pop-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes card-in {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shuffle-pulse {
    0% {
        transform: scale(1) rotate(-2deg);
    }

    100% {
        transform: scale(1.05) rotate(2deg);
    }
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-primary-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--accent-primary-glow), 0 0 60px rgba(108, 99, 255, 0.15);
    }
}

/* ============================================
   ALERT
   ============================================ */

.app-alert {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: #ff6b6b;
    font-size: 0.9rem;
    font-weight: 500;
    animation: card-in 0.3s ease-out;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 800px) {
    .app-container {
        flex-direction: column;
    }

    .config-panel {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: unset;
    }

    .result-panel {
        max-height: unset;
    }

    .history-panel {
        width: 100%;
        right: -100%;
    }

    .presentation-numbers .drawn-number {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .presentation-numbers .shuffling-number {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Prompt/modal for preset name */
.preset-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease;
}

.preset-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 340px;
    animation: card-in 0.3s ease-out;
}

.preset-modal h4 {
    font-size: 1rem;
    margin-bottom: 14px;
}

.preset-modal input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    margin-bottom: 14px;
    outline: none;
}

.preset-modal input:focus {
    border-color: var(--accent-primary);
}

.preset-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.preset-modal-actions button {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.preset-modal-actions .btn-cancel {
    background: transparent;
    color: var(--text-secondary);
}

.preset-modal-actions .btn-save {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ============================================
   CONFETTI CANVAS
   ============================================ */

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2000;
}

/* ============================================
   GROUPS MODE
   ============================================ */

.groups-config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

select.field-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b8ba3' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

.group-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    animation: card-in 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

.group-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 1rem;
}

.group-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.group-members {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.group-member {
    padding: 8px 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-member .member-index {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 18px;
    text-align: center;
}

.groups-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

/* ============================================
   CLASSES (TURMAS) SECTION
   ============================================ */

.classes-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
}

.classes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.classes-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.class-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.class-item:hover {
    border-color: var(--accent-primary);
    background: rgba(108, 99, 255, 0.08);
}

.class-item-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.class-item-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.class-item-actions {
    display: flex;
    gap: 2px;
}

.classes-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 4px;
}

/* Presentation groups */
.presentation-numbers .group-card {
    min-width: 250px;
}

.presentation-numbers .group-header {
    font-size: 1.4rem;
}

.presentation-numbers .group-member {
    font-size: 1.3rem;
    padding: 10px 18px;
}

/* ============================================
   QUESTIONS MODE
   ============================================ */

.questions-upload-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.questions-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.questions-upload-area i {
    font-size: 2rem;
    color: var(--accent-primary);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.questions-upload-area:hover {
    border-color: var(--accent-primary);
    background: rgba(108, 99, 255, 0.05);
    box-shadow: 0 0 20px var(--accent-primary-glow);
}

.questions-upload-area:hover i {
    opacity: 1;
}

.questions-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    transition: all 0.3s ease;
}

.questions-info.loaded {
    color: var(--success);
    background: rgba(46, 213, 115, 0.08);
    border: 1px solid rgba(46, 213, 115, 0.2);
}

.questions-format-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.questions-format-hint summary {
    cursor: pointer;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.questions-format-hint summary:hover {
    color: var(--accent-primary);
}

.questions-format-hint pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.72rem;
    line-height: 1.5;
    overflow-x: auto;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Question Result Card */
.question-result-card {
    overflow: visible;
}

.question-draw-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.student-reveal-area {
    display: flex;
    justify-content: center;
    min-height: 50px;
}

.student-name-reveal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: var(--surface);
    border-radius: var(--radius-md);
    border-left: 5px solid var(--accent-primary);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.student-name-reveal i {
    font-size: 1.6rem;
    color: var(--accent-primary);
}

.question-card-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    animation: card-in 0.4s ease-out 0.2s both;
}

.question-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(108, 99, 255, 0.15);
    color: var(--accent-primary);
    width: fit-content;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.6;
    color: var(--text-primary);
    padding: 8px 0;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.question-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.question-option:nth-child(1) {
    animation-delay: 0.1s;
}

.question-option:nth-child(2) {
    animation-delay: 0.15s;
}

.question-option:nth-child(3) {
    animation-delay: 0.2s;
}

.question-option:nth-child(4) {
    animation-delay: 0.25s;
}

.question-option:nth-child(5) {
    animation-delay: 0.3s;
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
}

.option-text {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.question-answer-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.btn-reveal-answer {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #f39c12 0%, #e74c3c 100%);
    color: white;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-reveal-answer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer-slide 2s infinite;
}

@keyframes shimmer-slide {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.btn-reveal-answer:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
}

.question-answer {
    padding: 14px 16px;
    background: rgba(46, 213, 115, 0.08);
    border: 1px solid rgba(46, 213, 115, 0.25);
    border-radius: var(--radius-md);
    animation: answer-reveal 0.5s ease-out;
}

.question-answer.hidden {
    display: none;
}

@keyframes answer-reveal {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.answer-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.answer-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Step-by-Step Reveal Cards */
.step-reveal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 20px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.step-name-hidden {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.12) 0%, rgba(0, 210, 255, 0.08) 100%);
    border: 2px dashed var(--accent-primary);
}

.step-question-hidden {
    background: linear-gradient(135deg, rgba(255, 159, 243, 0.12) 0%, rgba(255, 107, 107, 0.08) 100%);
    border: 2px dashed #ff9ff3;
}

.step-reveal-card:hover {
    transform: scale(1.03);
    box-shadow: 0 0 30px var(--accent-primary-glow);
}

.step-question-hidden:hover {
    box-shadow: 0 0 30px rgba(255, 159, 243, 0.3);
}

.step-reveal-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

.step-name-hidden .step-reveal-icon {
    color: var(--accent-primary);
}

.step-question-hidden .step-reveal-icon {
    color: #ff9ff3;
}

.step-reveal-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.step-reveal-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    animation: pulse-hint 1.5s ease-in-out infinite;
}

@keyframes pulse-hint {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.revealed-anim {
    animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Correct / Dimmed Options */
.question-option {
    transition: all 0.4s ease;
}

.question-option.option-correct {
    background: rgba(46, 213, 115, 0.15);
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(46, 213, 115, 0.25);
    transform: scale(1.03);
}

.question-option.option-correct .option-letter {
    background: var(--success);
}

.question-option.option-correct::after {
    content: ' ✓';
    font-weight: 900;
    color: var(--success);
    margin-left: auto;
    font-size: 1.2rem;
}

.question-option.option-dimmed {
    opacity: 0.35;
    transform: scale(0.97);
}