@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Cores Inspiradas na Business Education (Imagem Fornecida) */
    --be-deep-dark-blue: #181F30; /* Fundo principal da imagem */
    --be-accent-orange: #F37021;  /* Laranja dos títulos na imagem */
    --be-text-white: #FFFFFF;
    --be-text-light-gray: #D0D3E0; /* Cinza claro para textos secundários e bordas suaves */
    --be-interface-blue: #3955F6; /* Azul vibrante mencionado anteriormente, para interações */
    --be-interface-blue-darker: #2c46d5; /* Para hover/active do azul de interface */

    /* Mapeamento para o tema do sorteio */
    --primary-color: var(--be-interface-blue);
    --secondary-color: var(--be-accent-orange);
    --accent-color: var(--be-accent-orange);
    
    --background-color: var(--be-deep-dark-blue);
    --card-background-color: #202940; /* Um tom ligeiramente mais claro que o fundo do body */
    --card-border-color: rgba(208, 211, 224, 0.1); /* Borda sutil com --be-text-light-gray */

    --text-color: var(--be-text-white);
    --text-light: var(--be-text-light-gray);

    --slot-machine-bg: var(--be-interface-blue); /* Container dos rolos */
    --slot-reel-bg: rgba(0, 0, 0, 0.25); /* Fundo de cada rolo individual */
    --slot-header-text: var(--be-accent-orange); /* Laranja para os títulos ESCOLA, FUNÇÃO, NOME */
    --slot-item-text: var(--be-text-white);
    --slot-item-highlight-text: var(--be-accent-orange);
    --slot-item-highlight-bg: rgba(243, 112, 33, 0.15); /* Fundo do item destacado no rolo */

    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --danger-color: #e74c3c;

    --border-radius: 12px; /* Raio de borda padrão um pouco menor */
    --border-radius-large: 16px; /* Para elementos maiores */
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
    --secondary-color-rgb: 243, 112, 33; /* RGB para --be-accent-orange */
    --slot-item-font-size: 22px; /* Ajustar conforme necessário */
    --slot-item-line-height: 100px; /* Deve corresponder à altura do .slot-column .slot-machine */
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button {
    font-family: 'Poppins', sans-serif;
}

.container {
    width: 100%;
    max-width: 900px; /* Reduzido um pouco para um layout mais compacto */
}

.sorteio-card {
    background: var(--card-background-color);
    border-radius: var(--border-radius-large);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.4);
    padding: 35px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--card-border-color);
}

.sorteio-header {
    text-align: center;
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--card-border-color);
}

.sorteio-header h1 {
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--be-text-white);
    /* text-shadow: 0 2px 4px rgba(0,0,0,0.3); */
}

.sorteio-header h1 span {
    color: var(--be-accent-orange);
}

.sorteio-header p {
    font-size: 16px;
    color: var(--text-light);
}

/* Máquina de Sorteio */
.sorteio-machine {
    width: 100%;
    background: linear-gradient(135deg, #232b3e 60%, #181F30 100%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(24,31,48,0.45), 0 1.5px 0 var(--be-accent-orange);
    border: 2.5px solid var(--be-accent-orange);
    padding: 32px 32px 28px 32px;
    margin-bottom: 0;
    position: relative;
}

.sorteio-machine::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    z-index: 1;
}

.sorteio-counter {
    text-align: center;
    font-size: 15px;
    color: var(--text-light);
    margin-top: 8px;
    width: 100%;
}

.sorteio-counter span {
    font-weight: 600;
    color: var(--primary-color);
}

/* Área da Máquina de Sorteio com Alavanca */
.sorteio-machine-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: 35px;
}

.multi-column-display {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 32px;
    background: none;
    padding: 0;
    height: auto;
}

.slot-column {
    flex: 1;
    min-width: 180px;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slot-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--be-accent-orange);
    margin-bottom: 12px;
    letter-spacing: 1.2px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.slot-machine {
    width: 100%;
    height: 110px !important;
    min-height: 110px !important;
    max-height: 110px !important;
    background: rgba(255,255,255,0.07);
    border-radius: 14px;
    border: 2px solid var(--be-accent-orange);
    box-shadow: 0 2px 12px rgba(24,31,48,0.18);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-window {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-window::before, .slot-window::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 32px;
    z-index: 2;
    pointer-events: none;
    border-radius: 14px;
}

.slot-window::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(24,31,48,0.95) 0%, rgba(24,31,48,0.0) 100%);
}

.slot-window::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(24,31,48,0.95) 0%, rgba(24,31,48,0.0) 100%);
}

.slot-wrapper {
    position: absolute;
    left: 0; right: 0;
    text-align: center;
    transition: transform 0.1s cubic-bezier(.4,1.6,.6,1);
}

.slot-item {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 12px;
    font-size: 2.1rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 10px;
    background: none;
    border: none;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(24,31,48,0.25);
    transition: color 0.2s, background 0.2s, box-shadow 0.2s, border 0.2s;
}

.slot-item.highlighted {
    color: var(--be-accent-orange);
    background: rgba(243,112,33,0.13);
    border: 2px solid var(--be-accent-orange);
    box-shadow: 0 0 18px 2px rgba(243,112,33,0.18);
    text-shadow: 0 0 12px rgba(243,112,33,0.25), 0 2px 8px rgba(24,31,48,0.18);
    transform: scale(1.08);
    z-index: 2;
}

.sorteio-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 18px;
    gap: 10px;
}

#start-btn {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    background: var(--be-accent-orange);
    border: none;
    border-radius: 16px;
    padding: 22px 60px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(.4,1.6,.6,1);
    box-shadow: 0 7px 0 #b35018, 0 10px 24px rgba(24,31,48,0.25);
    outline: none;
    margin-bottom: 0;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    position: relative;
    min-width: 260px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

#start-btn:hover:not(:disabled) {
    background: #ff7a3c;
    box-shadow: 0 4px 0 #b35018, 0 12px 32px rgba(24,31,48,0.32);
    transform: translateY(-2px) scale(1.03);
}

#start-btn:active:not(:disabled), #start-btn.active:not(:disabled) {
    background: #e55400;
    box-shadow: 0 2px 0 #b35018, 0 6px 12px rgba(24,31,48,0.18);
    transform: translateY(3px) scale(0.98);
}

#start-btn:disabled {
    background: #78809c;
    color: #c0c5d6;
    box-shadow: 0 5px 0 #525870;
    cursor: not-allowed;
    transform: translateY(0);
}

/* Outros botões de controle (Fetch, Reset) - tema escuro */
.fetch-btn, .reset-btn {
    background: var(--be-interface-blue); /* Azul de interface */
    color: var(--be-text-white);
    border-radius: 8px;
    padding: 10px 20px;
    box-shadow: 0 4px 0 var(--be-interface-blue-darker), 0 6px 10px rgba(0,0,0,0.2);
}

.fetch-btn:hover:not(:disabled), 
.reset-btn:hover:not(:disabled) {
    background: var(--be-interface-blue-darker);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 0 #253bb8, 0 7px 12px rgba(0,0,0,0.25);
}

.fetch-btn:active:not(:disabled), 
.reset-btn:active:not(:disabled) {
    background: var(--be-interface-blue-darker);
    transform: translateY(2px);
    box-shadow: 0 2px 0 #253bb8, 0 4px 8px rgba(0,0,0,0.2);
}

/* Ajustar .controls para que os botões Fetch e Reset fiquem lado a lado, abaixo do Start */
.control-group-secondary {
    display: flex;
    gap: 15px;
    width: auto; /* Ajusta à largura dos botões */
    /* max-width: 450px; */ /* Aumentar um pouco se necessário */
}
.control-group-secondary .control-btn {
    flex: 1;
}

/* Tabs */
.tabs-container {
    border-top: 1px solid var(--card-border-color);
    padding-top: 25px;
    margin-top: 25px;
}

.tabs {
    border-bottom: 1px solid var(--card-border-color);
    margin-bottom: 25px;
}

.tab-btn {
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--be-accent-orange);
}

.tab-btn.active {
    color: var(--be-accent-orange);
    border-bottom-color: var(--be-accent-orange);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Seção de Vencedores e Participantes */
.winners-section, .participants-section {
    margin-bottom: 20px;
}

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

.section-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--be-accent-orange); /* Laranja para títulos de seção */
}

.section-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--primary-color);
    color: var(--be-text-white);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 3px 0 var(--be-interface-blue-darker), 0 5px 8px rgba(0,0,0,0.2);
}

.action-btn i {
    margin-right: 8px;
}

.action-btn:hover:not(:disabled) {
    background: var(--be-interface-blue-darker);
    transform: translateY(-1px);
    box-shadow: 0 3px 0 #253bb8, 0 6px 10px rgba(0,0,0,0.25);
}

.action-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #253bb8, 0 3px 6px rgba(0,0,0,0.2);
}

.action-btn.secondary {
    background: #7f8c8d;
}

.action-btn.secondary:hover {
    background: #95a5a6;
}

.action-btn.danger {
    background: var(--danger-color); 
    box-shadow: 0 3px 0 #b83023, 0 5px 8px rgba(0,0,0,0.2);
}
.action-btn.danger:hover:not(:disabled) {
    background: #c0392b;
    box-shadow: 0 3px 0 #a03020, 0 6px 10px rgba(0,0,0,0.25);
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    font-size: 14px;
    transition: var(--transition);
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--card-border-color);
    color: var(--be-text-white);
}

.search-box input:focus {
    outline: none;
    border-color: var(--be-accent-orange);
    box-shadow: 0 0 0 3px rgba(var(--secondary-color-rgb), 0.3);
    background: rgba(0,0,0,0.2);
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.participants-count {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.participants-count span {
    font-weight: 600;
    color: var(--primary-color);
}

.list-container {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 8px;
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--card-border-color);
}

.winners-list, .participants-list {
    list-style: none;
    padding: 10px;
}

.winners-list:empty::after, .participants-list:empty::after {
    content: 'Nenhum item para exibir';
    display: block;
    text-align: center;
    padding: 20px;
    color: #aaa;
    font-style: italic;
}

.winner-item, .participant-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    transition: var(--transition), border-color 0.2s ease;
    position: relative;
}

.winner-item:hover, .participant-item:hover {
    background: rgba(255,255,255,0.07);
    border-color: var(--be-accent-orange);
    transform: translateX(0px); /* Remover translação lateral no hover */
}

.winner-item i, .participant-item i {
    font-size: 24px;
    margin-right: 10px;
    color: var(--be-interface-blue);
}

.winner-content, .participant-content {
    flex: 1;
}

.winner-name-small, .participant-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
    word-break: break-word;
}

.winner-details-small, .participant-details {
    font-size: 14px;
    color: var(--text-light);
    word-break: break-word;
}

.participant-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: var(--transition);
}

.participant-item:hover .participant-actions {
    opacity: 1;
}

.action-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.action-icon:hover {
    background: var(--primary-color);
    color: white;
}

.action-icon.edit:hover {
    background: var(--info-color);
}

.action-icon.delete:hover {
    background: var(--danger-color);
}

/* Participante já sorteado */
.participant-item.selected {
    background-color: rgba(var(--secondary-color-rgb), 0.1);
    opacity: 0.8;
}

.participant-item.selected i {
    color: var(--be-accent-orange);
}

/* Modais */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 35, 0.85); /* Fundo do overlay mais escuro */
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: modalFadeIn 0.3s;
}

.modal-content {
    background: var(--card-background-color);
    width: 90%;
    max-width: 500px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: modalScaleIn 0.3s;
    border: 1px solid var(--card-border-color);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 20px;
    background: var(--be-interface-blue); /* Azul de interface para cabeçalho do modal */
    color: var(--be-text-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border-color);
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    color: var(--be-text-white);
    font-size: 28px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.8;
}

.close-modal:hover {
    opacity: 1;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--card-border-color);
}

/* Modal de vencedor */
.winner-modal-header {
    background: linear-gradient(45deg, var(--be-accent-orange), var(--primary-color));
}

.winner-modal-content {
    max-width: 500px;
}

.winner-info {
    padding: 30px;
    text-align: center;
}

.winner-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.winner-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(45deg, rgba(25, 36, 59, 0.1), rgba(236, 69, 0, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.winner-avatar i {
    font-size: 48px;
    color: var(--primary-color);
}

.winner-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
    word-break: break-word;
}

.winner-details {
    font-size: 16px;
    color: var(--text-light);
    word-break: break-word;
}

.winner-modal-footer {
    justify-content: space-between;
}

/* Formulário de adicionar participante */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-light);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--card-border-color);
    color: var(--be-text-white);
}

.form-group input:focus {
    outline: none;
    border-color: var(--be-accent-orange);
    box-shadow: 0 0 0 2px rgba(var(--secondary-color-rgb), 0.3);
    background: rgba(0,0,0,0.2);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 20, 35, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    visibility: visible;
    opacity: 1;
}

.loading-content {
    text-align: center;
}

.loading-content p {
    margin-top: 15px;
    font-weight: 500;
    color: var(--be-text-white);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(var(--primary-color-rgb, 57, 85, 246), 0.3); /* Usar RGB aqui */
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    padding: 15px 25px;
    margin-bottom: 10px;
    border-radius: 8px;
    color: var(--be-text-white);
    font-weight: 500;
    display: flex;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    transform: translateX(120%);
    animation: slideIn 0.3s forwards, fadeOut 0.5s 3.5s forwards;
    cursor: pointer;
}

.toast i {
    margin-right: 10px;
    font-size: 18px;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast.info {
    background: var(--info-color);
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

/* Confetti */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Estilo da rolagem personalizada */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

::-webkit-scrollbar-thumb {
    background: var(--be-interface-blue);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--be-interface-blue-darker);
}

/* Responsividade */
@media (max-width: 768px) {
    .multi-column-display {
        flex-direction: column; /* Empilha as colunas em telas menores */
        align-items: stretch; /* Faz as colunas ocuparem a largura total */
    }

    .slot-column {
        min-width: 0; /* Remove a largura mínima para empilhamento */
        margin-bottom: 15px;
    }

    .slot-column:last-child {
        margin-bottom: 0;
    }

    .sorteio-card {
        padding: 20px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .control-btn {
        width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sorteio-header h1 {
        font-size: 24px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .winner-name {
        font-size: 20px;
    }
    
    .toast {
        width: calc(100vw - 40px);
        font-size: 14px;
    }
} 