/* Variáveis de cores - Adicionando modo dark */
:root {
  --primary-color: #03008A;
  --secondary-color: #4f54c0;
  --accent-color: #03008acc;
  --white-color: #fff;
  --text-color: #333;
  --light-text-color: #777;
  --bg-color: #f5f7ff;
  --card-bg: #ffffff;
  --border-radius: 12px;
  --box-shadow: 0 8px 20px rgba(3, 0, 138, 0.1);
  --transition: all 0.3s ease;
}

/* Modo dark */
[data-theme="dark"] {
  --primary-color: #6366f1;
  --secondary-color: #818cf8;
  --accent-color: #6366f1cc;
  --white-color: #fff;
  --text-color: #e5e7eb;
  --light-text-color: #9ca3af;
  --bg-color: #111827;
  --card-bg: #1f2937;
  --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Modal Styles Responsivo */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    visibility: hidden;
    padding: 20px; /* Adiciona padding para telas pequenas */
    box-sizing: border-box; /* Garante que o padding não aumente o tamanho total */
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 30px 20px; /* Reduz padding em telas pequenas */
    border-radius: var(--border-radius);
    width: 100%; /* Ocupa toda a largura disponível */
    max-width: 450px; /* Mantém o máximo */
    min-width: 280px; /* Define um mínimo para evitar que fique muito pequeno */
    text-align: center;
    position: relative;
    box-shadow: var(--box-shadow);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
    border-top: 5px solid var(--primary-color);
    overflow: hidden;
    margin: 0 10px; /* Adiciona margem lateral */
}

.modal-content.show {
    transform: translateY(0);
    opacity: 1;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: var(--light-text-color);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--primary-color);
}

.prize-value {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 20px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.prize-highlight {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2em;
}

.modal-button {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
}

/* Confetti animation */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    opacity: 0;
    top: -10px;
}

.confetti.active {
    animation: confetti-fall 5s ease-in-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(500px) rotate(360deg);
        opacity: 0;
    }
}

.confetti:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    background-color: var(--primary-color);
}
.confetti:nth-child(2) {
    left: 30%;
    animation-delay: 0.5s;
    background-color: var(--secondary-color);
}
.confetti:nth-child(3) {
    left: 50%;
    animation-delay: 1s;
    background-color: var(--primary-color);
}
.confetti:nth-child(4) {
    left: 70%;
    animation-delay: 1.5s;
    background-color: var(--secondary-color);
}
.confetti:nth-child(5) {
    left: 90%;
    animation-delay: 2s;
    background-color: var(--primary-color);
}

/* Error Modal Styles */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.error-modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: var(--box-shadow);
    border-top: 5px solid #ff4444;
}

.error-icon {
    font-size: 50px;
    color: #ff4444;
    margin-bottom: 15px;
}

.error-icon i {
    animation: pulse 0.5s ease infinite alternate;
}

.error-modal h3 {
    color: #ff4444;
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.error-modal p {
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.5;
}

.error-details {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: left;
}

.ticket-options-list {
    list-style-type: none;
    padding-left: 0;
}

.ticket-options-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ticket-options-list li i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

.error-modal-button {
    background: linear-gradient(to right, #ff4444, #ff8888);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(255, 68, 68, 0.3);
}

.error-modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 68, 68, 0.4);
}

/* Ajustes para telas pequenas */
@media (max-width: 480px) {
    .modal-content {
        padding: 25px 15px; /* Padding menor em telas muito pequenas */
    }
    
    .prize-value {
        font-size: 2.5rem; /* Tamanho menor para o valor do prêmio */
        margin: 15px 0; /* Margem reduzida */
    }
    
    .modal-button {
        padding: 12px 30px; /* Botão um pouco menor */
        font-size: 14px; /* Fonte menor */
        margin-top: 20px; /* Margem reduzida */
    }
    
    .close-modal {
        top: 10px;
        right: 10px;
        font-size: 20px; /* Ícone de fechar menor */
    }
    
    h2#resultTitle {
        font-size: 1.5rem; /* Título menor */
    }
    
    p#resultMessage {
        font-size: 0.9rem; /* Texto menor */
    }
}

/* Ajustes para telas muito pequenas (menos de 350px) */
@media (max-width: 350px) {
    .modal-content {
        padding: 20px 10px;
    }
    
    .prize-value {
        font-size: 2rem;
    }
    
    .modal-button {
        padding: 10px 25px;
        font-size: 13px;
    }
}

/* Ajustes para orientação paisagem em dispositivos móveis */
@media (max-height: 500px) and (orientation: landscape) {
    .modal {
        align-items: flex-start; /* Alinha no topo */
        padding-top: 20px; /* Adiciona espaço no topo */
        overflow-y: auto; /* Permite rolagem se necessário */
    }
    
    .modal-content {
        margin: 20px 0; /* Margem vertical */
        max-height: 90vh; /* Limita a altura */
        overflow-y: auto; /* Permite rolagem interna se necessário */
    }
}

/* Error Modal Responsivo */
@media (max-width: 480px) {
    .error-modal-content {
        padding: 20px 15px;
    }
    
    .error-icon {
        font-size: 40px;
        margin-bottom: 10px;
    }
    
    .error-modal h3 {
        font-size: 1.2rem;
    }
    
    .error-modal p {
        font-size: 0.9rem;
    }
    
    .error-modal-button {
        padding: 10px 25px;
        font-size: 14px;
    }
}