/* Contenedor principal */
#calendario-adviento-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Arial', sans-serif;
    overflow-x: hidden;
}

/* Pantalla de login */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.login-box {
    background: linear-gradient(135deg, #071b3e 0%, #0180f1 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    color: white;
    max-width: 550px;
    width: 100%;
}

.login-box h2 {
    margin-bottom: 20px;
    font-size: 28px;
    color: white;
}

.login-box p {
    margin-bottom: 15px;
    font-size: 16px;
}

#codigo-input {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    font-size: 16px;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 15px;
    box-sizing: border-box;
    color: white;
}

#btn-verificar {
    width: 100%;
    padding: 15px;
    background: #0180f1;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#btn-verificar:hover {
    background: #0180f1;
}

#mensaje-error {
    margin-top: 15px;
    color: #fee;
    font-weight: bold;
}

/* Pantalla del calendario */
#calendario-screen {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: hidden;
}

#calendario-screen h2 {
    text-align: center;
    color: #1e7e34;
    font-size: clamp(24px, 5vw, 36px);
    margin-bottom: 20px;
}

/* Estrella decorativa */
.estrella-decorativa {
    text-align: center;
    margin-bottom: 20px;
    animation: estrellaBrillo 2s ease-in-out infinite;
}

.estrella-decorativa img {
    max-width: clamp(80px, 15vw, 150px);
    height: auto;
}

@keyframes estrellaBrillo {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

/* Grid de cartas - Forma de árbol centrado HORIZONTAL */
#calendario-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 100%;
    margin: 0 auto;
    perspective: 1000px;
    align-items: center;
    padding: 0 10px;
}

/* Filas del árbol - HORIZONTALES */
.fila-arbol {
    display: flex;
    flex-direction: row;
    gap: 15px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Carta individual - Tamaño base responsive (se sobrescribe con inline styles) */
.carta {
    /* Las dimensiones se definen inline desde PHP */
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    max-width: 100%;
}

.carta-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.carta.volteada .carta-inner {
    transform: rotateY(180deg);
}

.carta-front,
.carta-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Cara frontal */
.carta-front {
    background: linear-gradient(135deg, #1e7e34 0%, #2d5a3d 100%);
    color: white;
}

/* Cara frontal con imagen personalizada */
.carta-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

/* Cara frontal sin imagen (default con árbol) */
.carta-front:not(:has(img)) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.arbol-navidad {
    font-size: clamp(30px, 8vw, 70px);
    margin-bottom: 5px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

.numero {
    font-size: clamp(20px, 5vw, 36px);
    font-weight: bold;
    background: rgba(255,255,255,0.2);
    width: clamp(35px, 7vw, 55px);
    height: clamp(35px, 7vw, 55px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Cara trasera con imagen */
.carta-back {
    background: #fff;
    transform: rotateY(180deg);
    overflow: hidden;
    position: relative;
}

.carta-back > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

/* Overlay de WhatsApp */
.whatsapp-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
}

.whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #25D366;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
    animation: whatsappPulse 2s infinite;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

@keyframes whatsappPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.7);
    }
}

/* Si no hay imagen, mostrar contenido por defecto */
.contenido {
    text-align: center;
    color: white;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.contenido p {
    font-size: clamp(16px, 3vw, 24px);
    font-weight: bold;
    margin-bottom: 10px;
}

.contenido span {
    font-size: clamp(35px, 8vw, 60px);
    display: block;
}

/* Animación de hover */
.carta:not(.volteada):hover .carta-inner {
    transform: scale(1.05);
}

.carta:not(.volteada):hover {
    z-index: 10;
}

/* Responsive - Tablets y pantallas medianas */
@media (max-width: 900px) {
    .carta {
        max-width: 140px !important;
        max-height: 140px !important;
        width: 140px !important;
        height: 140px !important;
    }

    .carta[style*="280px"] {
        max-width: 220px !important;
        width: 220px !important;
        height: 140px !important;
    }

    .fila-arbol {
        gap: 8px;
    }

    #calendario-grid {
        gap: 8px;
    }

    .estrella-decorativa img {
        max-width: 80px;
    }
}

/* Responsive - Móviles */
@media (max-width: 768px) {
    #calendario-adviento-container {
        padding: 10px 5px;
    }

    .carta {
        max-width: 80px !important;
        max-height: 80px !important;
        width: 80px !important;
        height: 80px !important;
    }

    .carta[style*="280px"] {
        max-width: 130px !important;
        width: 130px !important;
        height: 80px !important;
    }

    .fila-arbol {
        gap: 6px;
    }

    #calendario-grid {
        gap: 6px;
        padding: 0 5px;
    }

    #calendario-screen h2 {
        font-size: 20px;
        margin-bottom: 12px;
        padding: 0 5px;
    }

    .estrella-decorativa {
        margin-bottom: 12px;
    }

    .estrella-decorativa img {
        max-width: 60px;
    }

    .arbol-navidad {
        font-size: 32px;
    }

    .numero {
        font-size: 20px;
        width: 35px;
        height: 35px;
    }
}

/* Responsive - Móviles pequeños */
@media (max-width: 480px) {
    #calendario-adviento-container {
        padding: 8px 3px;
    }

    .carta {
        max-width: 70px !important;
        max-height: 70px !important;
        width: 70px !important;
        height: 70px !important;
    }

    .carta[style*="280px"] {
        max-width: 115px !important;
        width: 115px !important;
        height: 70px !important;
    }

    .fila-arbol {
        gap: 5px;
    }

    #calendario-grid {
        gap: 5px;
        padding: 0 3px;
    }

    #calendario-screen h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .estrella-decorativa {
        margin-bottom: 8px;
    }

    .estrella-decorativa img {
        max-width: 50px;
    }

    .arbol-navidad {
        font-size: 28px;
    }

    .numero {
        font-size: 18px;
        width: 30px;
        height: 30px;
    }

    .contenido p {
        font-size: 12px;
    }

    .contenido span {
        font-size: 28px;
    }
}

/* Pantallas muy pequeñas */
@media (max-width: 360px) {
    #calendario-adviento-container {
        padding: 5px 2px;
    }

    .carta {
        max-width: 60px !important;
        max-height: 60px !important;
        width: 60px !important;
        height: 60px !important;
    }

    .carta[style*="280px"] {
        max-width: 100px !important;
        width: 100px !important;
        height: 60px !important;
    }

    .fila-arbol {
        gap: 4px;
    }

    #calendario-grid {
        gap: 4px;
    }

    #calendario-screen h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .estrella-decorativa img {
        max-width: 40px;
    }

    .arbol-navidad {
        font-size: 24px;
    }

    .numero {
        font-size: 16px;
        width: 26px;
        height: 26px;
    }

    .contenido p {
        font-size: 11px;
    }

    .contenido span {
        font-size: 24px;
    }
}

/* Estilos para el admin */
.card-ache {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#cantidad_codigos {
    padding: 5px 10px;
    margin: 0 10px;
}

#resultado-codigos {
    margin-top: 20px;
}

#resultado-codigos ul {
    list-style: none;
    padding: 0;
}

#resultado-codigos li {
    padding: 5px 0;
}

.imagen-item {
    border: 2px solid #ddd;
    padding-bottom: 15px;
}

.imagen-item h3 {
    background: linear-gradient(135deg, #1e7e34 0%, #2d5a3d 100%);
    color: white;
    padding: 10px;
    margin: -20px -20px 15px -20px;
    border-radius: 8px 8px 0 0;
}

.imagen-url {
    padding: 5px 10px;
}

/* Botón cerrar sesión */
.button-cerrar-sesion {
    display: inline-block;
    padding: 12px 24px;
    background: #071b3e;
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background 0.3s;
    margin-top: 10px;
}

.button-cerrar-sesion:hover {
    background: #071b3e;
    color: white !important;
    text-decoration: none;
}
