/* =============================================
   CSS para Sistema de Rifas
   =============================================*/

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 0;
    color: #333;
}

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

/* =============================================
   Mensaje de resultado
   =============================================*/
.mensaje-resultado {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    position: relative;
    animation: slideDown 0.3s ease;
}

.mensaje-resultado.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.mensaje-resultado.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============================================
   Header de la rifa
   =============================================*/
.rifa-header {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.rifa-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.rifa-header .descripcion {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 15px;
    line-height: 1.6;
}

.rifa-header .fechas {
    font-size: 1rem;
    color: #34495e;
}

/* Header con información de usuario */
.rifa-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.rifa-info {
    flex: 1;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-size: 0.9rem;
}

.user-welcome {
    color: #495057;
    font-weight: 500;
}

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

.btn-admin {
    background: #6c757d;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-admin:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.btn-logout-frontend {
    background: #dc3545;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-logout-frontend:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* =============================================
   Sección de premios
   =============================================*/
.premios-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.premios-section h2 {
    text-align: center;
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 30px;
}

/* Grilla de premios - 1x4 o 2x4 */
.premios-grid.few-prizes {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.premios-grid.many-prizes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.premio-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-width: 220px;
    max-width: 280px;
}

.premio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.premio-card img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    object-position: center;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    padding: 5px;
}

.premio-info {
    padding: 15px;
}

.premio-info h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 600;
}

.premio-info p {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.4;
}

/* =============================================
   Sección de números
   =============================================*/
.numeros-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.numeros-section h2 {
    text-align: center;
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 30px;
}

/* Tablero 10x10 */
.tablero-numeros {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
    max-width: 600px;
    margin: 0 auto 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.numero {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
}

/* Estados de números */
.numero.disponible {
    background: #28a745;
    color: white;
    box-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
}

.numero.disponible:hover {
    background: #218838;
    transform: scale(1.05);
}

.numero.reservado {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    opacity: 0.8;
}

.numero.seleccionado {
    background: #007bff !important;
    color: white;
    border: 2px solid #0056b3;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.4);
}

/* =============================================
   Preview de selección
   =============================================*/
.seleccion-preview {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.preview-box {
    text-align: center;
}

.preview-box h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.numeros-seleccionados {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #495057;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.calculo-precio {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #2c3e50;
}

.cantidad {
    font-weight: 600;
    color: #6c757d;
}

.monto-total {
    font-weight: bold;
    color: #e74c3c;
    font-size: 1.5rem;
}

.btn-reservar {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}

.btn-reservar:hover:not(:disabled) {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
}

.btn-reservar:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =============================================
   Modal
   =============================================*/
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8rem;
}

.resumen-reserva {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #3498db;
}

.resumen-reserva p {
    margin-bottom: 8px;
    font-size: 1rem;
}

.resumen-reserva strong {
    color: #2c3e50;
}

/* Formulario */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.btn-cancelar {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.btn-cancelar:hover {
    background: #7f8c8d;
}

.btn-confirmar {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(39, 174, 96, 0.3);
}

.btn-confirmar:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

/* =============================================
   Responsive Design
   =============================================*/
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    .rifa-header h1 {
        font-size: 2rem;
    }

    .rifa-header-content {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .rifa-info {
        text-align: center;
    }

    .user-info {
        align-items: center;
        width: 100%;
    }

    .user-actions {
        justify-content: center;
    }

    .tablero-numeros {
        grid-template-columns: repeat(10, 1fr);
        gap: 4px;
        padding: 10px;
        max-width: 100%;
    }

    .numero {
        width: 28px;
        height: 28px;
        font-size: 10px;
        border-radius: 4px;
    }

    .premio-card {
        min-width: 140px;
        max-width: 180px;
        width: 100%;
    }

    .premio-card img {
        height: 120px;
        object-fit: contain;
        padding: 8px;
    }

    .modal-content {
        margin: 2% auto;
        padding: 20px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-actions {
        flex-direction: column;
    }

    .premios-grid.few-prizes {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        justify-items: center;
    }

    .premios-grid.many-prizes {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .tablero-numeros {
        grid-template-columns: repeat(10, 1fr);
        gap: 2px;
        padding: 8px;
    }

    .numero {
        width: 24px;
        height: 24px;
        font-size: 9px;
        border-radius: 3px;
    }

    .calculo-precio {
        font-size: 1rem;
    }

    .monto-total {
        font-size: 1.2rem;
    }

    .rifa-header h1 {
        font-size: 1.8rem;
    }

    .rifa-header {
        padding: 20px 15px;
    }

    .numeros-section h2,
    .premios-section h2 {
        font-size: 1.5rem;
    }

    .premio-card {
        min-width: 120px;
        max-width: 160px;
    }

    .premio-card img {
        height: 100px;
    }

    .premio-info h3 {
        font-size: 0.95rem;
    }

    .premio-info p {
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .tablero-numeros {
        gap: 1px;
        padding: 6px;
    }

    .numero {
        width: 22px;
        height: 22px;
        font-size: 8px;
    }
}

/* Mejorar interacción en móvil */
@media (max-width: 768px) {
    .numero.disponible:active {
        transform: scale(1.15);
        z-index: 10;
        position: relative;
        box-shadow: 0 4px 8px rgba(40, 167, 69, 0.5);
    }

    .numero.seleccionado {
        transform: scale(1.05);
        z-index: 10;
        position: relative;
        font-weight: bold;
    }

    /* Mejorar área de toque en móvil */
    .numero {
        position: relative;
    }

    .numero::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        background: transparent;
    }

    /* Preview más compacto en móvil */
    .seleccion-preview {
        padding: 15px;
        margin-bottom: 20px;
    }

    .preview-box h3 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .numeros-seleccionados {
        padding: 10px;
        font-size: 0.95rem;
    }

    .btn-reservar {
        padding: 12px 25px;
        font-size: 1rem;
    }

    /* Ajustar mensajes de resultado */
    .mensaje-resultado {
        padding: 12px 15px;
        font-size: 1rem;
        margin: 15px 0;
    }
}