body {
    background: #2a2a2a; /* Gris muy oscuro */
    font-family: Arial, sans-serif;
    margin: 0; /* Eliminar margen para mejor control en móviles */
    /*padding: 20px; /* Añadir padding al body en su lugar */
    color: #eee; /* Color de texto general para contraste */
}

h1.main-title {
    text-align: center;
    color: #dd630c; /* Naranja */
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

h2 {
    text-align: center;
    color: #dd630c;
    margin-bottom: 25px;
    font-size: 2em;
}

.wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 6% auto 0;
}
.single-card {
    position: relative;
    width: 380px;
    height: 450px; /* Aumentado la altura de la tarjeta */
    margin: 15px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease;
    overflow: hidden;
    background: #414852;
    border-radius: 15px;
    transition: all 0.8s ease-in-out;
}
.single-card:hover {
    transform: translateY(-10px);
}
.img-area {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}
.img-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.img-area:hover img {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    transform: scale(1.2);
    background-color: rgba(0, 174, 255, 0.7);
}
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    
    opacity: 1;
    transition: opacity 0.3s ease;
}

.title-link {
    cursor: pointer;
}

.add-to-cart,
.view-details {
    background-color: #dd630c; /* Se mantiene naranja */
    color: white;
    padding: 10px 20px; /* Ajuste para que se vea mejor */
    margin: 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}
.add-to-cart:hover,
.view-details:hover {
    background-color: #c2520b; /* Naranja más oscuro al pasar el ratón */
}
.info {
    padding: 15px; /* Aumentado padding */
    text-align: center;
    color: white;
}
.info h3 {
    font-size: 1.5em; /* Reducido tamaño de fuente */
    margin-bottom: 10px;
    color: #dd630c;
}
.price {
    font-size: 1.2em; /* Reducido tamaño de fuente */
    color: #eee;
    margin-bottom: 10px;
}
.duration,
.winner {
    font-size: 0.9em;
    color: #ccc;
    margin-bottom: 5px;
}
.remaining-tickets {
    font-weight: bold;
    color: #eee;
}
.button-container {
    text-align: center;
    margin-top: 20px;
}

/* Paso 1 Styles */
.bg-dark-gray {
    background-color: #2a2a2a;
}

.main-title {
    color: #dd630c;
    text-align: center;
    margin-bottom: 30px;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.min-h-screen-minus-header {
    min-height: calc(100vh - 80px); /* Ajusta si tu header tiene otra altura */
    display: flex;
    flex-direction: column; /* Alinea los elementos verticalmente */
    align-items: center;
    justify-content: center;
}

.message {
    background-color: #4CAF50;
    color: white;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    width: 90%; /* Asegura que el mensaje no se desborde */
    max-width: 400px;
}

.no-cartones-msg, .no-selection-msg {
    color: #eee;
    font-size: 1.2em;
    text-align: center;
    margin-top: 20px;
    padding: 0 10px; /* Añadir padding para que el texto no toque los bordes */
}

.cartones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); /* Botones más pequeños, min ancho 60px */
    gap: 8px; /* Espacio entre botones más pequeño */
    max-width: 900px; /* Ancho máximo de la grilla */
    width: 95%; /* Ocupa casi todo el ancho disponible */
    margin: 20px auto;
    padding: 10px;
    background-color: #3a3a3a; /* Fondo de la grilla */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.btnVerCarton {
    background-color: #414852; /* Color de fondo del botón */
    color: white;
    padding: 8px 5px; /* Padding ajustado para números de dos dígitos */
    border: 1px solid #5a5a5a;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em; /* Fuente más pequeña */
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 55px; /* Asegura un ancho mínimo para los botones */
    min-height: 55px; /* Asegura una altura mínima para los botones */
    display: flex; /* Para centrar el texto verticalmente */
    align-items: center; /* Para centrar el texto verticalmente */
    justify-content: center; /* Para centrar el texto horizontalmente */
    line-height: 1; /* Ayuda a centrar el texto */
    box-sizing: border-box; /* Incluye padding y borde en el tamaño total */
}

.btnVerCarton:hover:not([data-selected="true"]) {
    background-color: #5a6470;
    transform: translateY(-2px);
}

.btnVerCarton[data-selected="true"] {
    background-color: #dd630c; /* Naranja para seleccionados */
    border-color: #c2520b;
    cursor: pointer; /* sigue siendo clickeable para deseleccionar */
    opacity: 0.9;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}

/* Estilos para el botón de finalizar */
.btn-finalizar {
    display: inline-block;
    padding: 15px 30px;
    background-color: #007bff; /* Azul vibrante */
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.3em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    text-align: center;
    width: 90%; /* Asegura que se adapte */
    max-width: 400px; /* Limita el ancho */
}

.btn-finalizar:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* Modal styles (Paso 1) */
#modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex; /* Usar flexbox para centrar */
    justify-content: center; /* Centrar horizontalmente */
    align-items: center; /* Centrar verticalmente */
    padding: 10px; /* Padding para evitar que el modal toque los bordes de la pantalla pequeña */
    box-sizing: border-box; /* Incluye padding en el tamaño total */
}

#modal-content {
    background-color: #414852; /* Fondo del modal */
    padding: 30px;
    border-radius: 10px;
    width: 90%; /* Ocupa un buen porcentaje del ancho de la pantalla */
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
    text-align: center;
    margin: 0; /* Asegurar que no haya margen que interfiera con flexbox centering */
    box-sizing: border-box;
}

#modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

#modal-close:hover,
#modal-close:focus {
    color: #dd630c;
    text-decoration: none;
    cursor: pointer;
}

#modal-title {
    color: #dd630c;
    margin-bottom: 20px;
    font-size: 2em;
}

.carton-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px auto;
    font-size: 1.1em;
    color: #eee;
}

.carton-table th, .carton-table td {
    border: 1px solid #5a5a5a;
    padding: 10px;
    text-align: center;
}

.carton-table th {
    background-color: #5a5a5a; /* Fondo de los encabezados de la tabla */
    color: #dd630c; /* Naranja para las letras BINGO */
    font-weight: bold;
}
.carton-table td {
    background-color: #3a3a3a;
}
/* No resaltado para la columna I */
.carton-table td:nth-child(2) { /* Esto es para la columna 'I' */
    background-color: #3a3a3a; /* Asegurar que no tenga un fondo diferente */
}

.carton-table td.free-space {
    background-color: #2a2a2a; /* Centro 'Libre' más oscuro */
    font-weight: bold;
    color: #dd630c; /* Color del texto 'Libre' */
}

#form-seleccionar {
    display: flex; /* Usar flexbox para los botones del formulario */
    flex-wrap: wrap; /* Permite que los elementos se envuelvan si no hay espacio */
    justify-content: center; /* Centrar los botones */
    align-items: center;
    gap: 10px; /* Espacio entre los botones */
    margin-top: 20px; /* Margen superior para separarlo de la tabla */
}

#selectCartonBtn, #modal-close-btn { /* Estilos compartidos */
    padding: 12px;
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    font-size: 1.1em; /* Ligeramente más pequeño para botones del modal */
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex-grow: 1; /* Permite que los botones crezcan para llenar el espacio */
    min-width: 120px; /* Ancho mínimo para cada botón del modal */
    box-sizing: border-box;
}

#selectCartonBtn {
    background-color: #dd630c; /* Naranja para el botón de seleccionar */
}
#selectCartonBtn:hover {
    background-color: #c2520b;
}

#modal-close-btn { /* Estilos específicos para el nuevo botón cerrar */
    background-color: #5a5a5a; /* Gris más oscuro */
}
#modal-close-btn:hover {
    background-color: #4a4a4a;
}


/* --- Styles for paso2.php --- */

.modal-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-alert-content {
    background-color: #414852;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    color: #eee;
}

.modal-alert-content p {
    font-size: 1.2em;
    margin-bottom: 20px;
    line-height: 1.4;
}

.modal-alert-content p strong {
    color: #dd630c; /* Naranja para el texto resaltado */
}

.btn-primary {
    background-color: #dd630c;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #c2520b;
}

.payment-section {
    background-color: #3a3a3a;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    margin: 30px auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    color: #eee;
}

.payment-details-box {
    background-color: #414852;
    border: 2px solid #dd630c; /* Borde naranja para resaltarlo */
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: left;
}

.payment-details-box h3 {
    color: #dd630c;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.payment-details-box p {
    margin-bottom: 8px;
    font-size: 1.1em;
}

.payment-details-box p strong {
    color: #eee;
}

.highlight-text {
    font-size: 1.3em;
    font-weight: bold;
    color: #66cc66; /* Un verde suave para el monto a pagar */
    margin-top: 15px;
}

.important-message {
    background-color: #ffcc00; /* Fondo amarillo para advertencia */
    color: #333; /* Texto oscuro para contraste */
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    font-weight: bold;
    font-size: 1em;
    line-height: 1.4;
}

.important-message strong {
    color: #dd630c; /* Naranja para resaltar aún más */
}

.section-title, .form-title {
    color: #dd630c;
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
}

.payment-form .form-group {
    margin-bottom: 18px;
    text-align: left;
}

.payment-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #eee;
    font-size: 1.1em;
}

.payment-form input[type="text"],
.payment-form input[type="tel"],
.payment-form input[type="email"],
.payment-form input[type="file"] {
    width: calc(100% - 20px); /* Ajuste para padding */
    padding: 10px;
    border: 1px solid #5a5a5a;
    border-radius: 5px;
    background-color: #2a2a2a;
    color: #eee;
    font-size: 1em;
    box-sizing: border-box; /* Incluir padding en el width */
}

.payment-form input[type="file"] {
    padding: 8px; /* Ligeramente menos padding para el input de archivo */
}

.payment-instruction {
    background-color: #5a5a5a;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: left;
    font-size: 1em;
    line-height: 1.5;
}

.payment-instruction p strong {
    color: #dd630c; /* Naranja para los datos de pago móvil en la instrucción */
}

.btn-reservar {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 30px;
}

.btn-reservar:hover {
    background-color: #0056b3;
}

/* Media Queries para pantallas más pequeñas (Mantener y ajustar) */
@media (max-width: 768px) {
    h1.main-title {
        font-size: 2em;
        margin-bottom: 20px;
    }

    .cartones-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); /* Más columnas si el espacio lo permite */
        gap: 6px; /* Menor espacio entre botones */
        padding: 8px;
    }

    .btnVerCarton {
        padding: 6px 3px;
        font-size: 0.8em;
        min-width: 45px;
        min-height: 45px;
    }

    .btn-finalizar {
        font-size: 1.1em;
        padding: 12px 20px;
    }

    #modal-content, .modal-alert-content {
        padding: 20px;
    }

    #modal-title, .section-title, .form-title {
        font-size: 1.8em;
    }

    .carton-table th, .carton-table td {
        padding: 6px;
        font-size: 0.9em;
    }

    #selectCartonBtn, #modal-close-btn {
        font-size: 1em;
        padding: 10px;
        min-width: unset; /* Permitir que el flex-grow actúe libremente */
    }

    .payment-section {
        padding: 20px;
    }

    .payment-details-box h3 {
        font-size: 1.5em;
    }
    .payment-details-box p, .payment-form label, .payment-instruction p {
        font-size: 1em;
    }
    .highlight-text {
        font-size: 1.2em;
    }
    .important-message {
        font-size: 0.9em;
    }
    .btn-reservar {
        font-size: 1.1em;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    body {
        /*padding: 10px; /* Reducir padding general en pantallas muy pequeñas */
    }
    h1.main-title {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    .cartones-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); /* Aún más pequeños para móviles */
        gap: 5px;
        padding: 5px;
    }

    .btnVerCarton {
        padding: 4px 2px;
        font-size: 0.7em;
        min-width: 40px;
        min-height: 40px;
    }

    .btn-finalizar {
        font-size: 1em;
        padding: 10px 15px;
        width: 100%; /* Ocupa todo el ancho disponible */
        max-width: unset;
    }

    #modal-content, .modal-alert-content {
        padding: 15px;
        width: 95%; /* Modal más ancho en pantallas muy pequeñas */
    }

    #modal-title, .section-title, .form-title {
        font-size: 1.5em;
    }

    .carton-table th, .carton-table td {
        padding: 4px;
        font-size: 0.8em;
    }

    #modal-close {
        font-size: 24px;
        top: 5px;
        right: 10px;
    }

    #form-seleccionar {
        flex-direction: column; /* Apila los botones verticalmente en pantallas muy pequeñas */
        gap: 8px;
    }

    #selectCartonBtn, #modal-close-btn {
        width: 100%; /* Ocupan todo el ancho disponible */
        font-size: 1em;
        padding: 10px;
    }

    .payment-section {
        padding: 15px;
        margin: 20px auto;
    }
    .payment-details-box h3 {
        font-size: 1.3em;
    }
    .payment-details-box p, .payment-form label, .payment-instruction p {
        font-size: 0.9em;
    }
    .highlight-text {
        font-size: 1.1em;
    }
    .important-message {
        font-size: 0.8em;
        padding: 10px;
    }
    .btn-reservar {
        font-size: 1em;
        padding: 10px;
    }
    .payment-form input[type="text"],
    .payment-form input[type="tel"],
    .payment-form input[type="email"],
    .payment-form input[type="file"] {
        width: 100%; /* Asegura que ocupen todo el ancho */
        padding: 8px;
    }
}