/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: url('../images/calendar/1920x1080px_calendario avvento tato.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    color: #333;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Mobile portrait - utiliser une image adaptée */
@media (max-width: 767.98px) and (orientation: portrait) {
    body {
        background-image: url('../images/calendar/1080px_calendario avvento tato.png');
        background-size: cover;
        background-position: center top;
        background-repeat: no-repeat;
        background-attachment: scroll;
    }
}

/* Responsive Background Images */
/* Tablets (769px - 1199px) */
@media (min-width: 769px) and (max-width: 1199px) {
    body {
        background-image: url('../images/calendar/1920x1080px_calendario avvento tato.png');
        background-size: cover;
        background-position: center;
    }
    
    .header-logo {
        max-width: 90%;
        max-height: 180px; /* Augmenté de 150px */
    }
    
    .header-text {
        max-width: 90%;
        max-height: 150px;
    }
}

/* Desktop Standard (1200px - 1919px) */
@media (min-width: 1200px) and (max-width: 1919px) {
    body {
        background-image: url('../images/calendar/1920x1080px_calendario avvento tato.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    .header-logo {
        max-width: 85%;
        max-height: 220px; /* Augmenté de 180px */
    }
    
    .header-text {
        max-width: 85%;
        max-height: 180px;
    }
}

/* Desktop Large 1920x1080 (1920px - 2559px) */
@media (min-width: 1920px) and (max-width: 2559px) {
    body {
        background-image: url('../images/calendar/1920x1080px_calendario avvento tato.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    .header-logo {
        max-width: 80%;
        max-height: 280px; /* Augmenté de 220px */
    }
    
    .header-text {
        max-width: 80%;
        max-height: 220px;
    }
}

/* Desktop Large/Ultrawide (≥ 2560px) */
@media (min-width: 2560px) {
    body {
        background-image: url('../images/calendar/3440x1440px calendario avvento tato.png');
        background-size: cover;
        background-position: center;
    }
    
    .header-logo {
        max-width: 80%;
        max-height: 280px; /* Augmenté de 220px */
    }
    
    .header-text {
        max-width: 80%;
        max-height: 220px;
    }
}

/* Header Styles */
.header {
    background: transparent;
    backdrop-filter: none;
    padding: 20px 0;
    margin: 0;
    box-shadow: none;
    position: relative;
    z-index: 1001;
    height: auto;
    min-height: 350px; /* Ajusté pour accommoder logo + texte */
    display: flex;
    flex-direction: column; /* Empile les éléments verticalement */
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Empêche le header de se rétrécir */
    order: 1; /* Header en premier */
}

/* Header Logo */
.header-logo {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 250px; /* Augmenté de 200px à 250px */
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

/* Header Text Container */
.header-text-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
}

/* Header Text */
.header-text {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.header-text:hover {
    transform: scale(1.05);
}

/* Footer Styles */
.footer-info {
    background: transparent;
    padding: 20px 0;
    margin: 0;
    position: relative;
    z-index: 1;
    flex-shrink: 0; /* Empêche le footer de se rétrécir */
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    order: 3; /* Footer en dernier */
}

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

.footer-info .alert-warning {
    background-color: #fff3cd !important;
    border-color: #ffecb5 !important;
    color: #664d03 !important;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.footer-info .alert-warning h6 {
    color: #664d03 !important;
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: bold;
}

.footer-info .alert-warning ul {
    color: #664d03 !important;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
}

.footer-info .alert-warning li {
    margin-bottom: 8px;
    padding-left: 10px;
}

.btn-participa-calendario {
    background-image: url('../images/titles/bottone1.png');
    background-size: 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    color: #ffffff !important;
    font-weight: 600;
    text-transform: uppercase;
    padding: 15px 30px;
    border-radius: 0;
    text-decoration: none !important;
    text-underline-offset: 0 !important;
    text-decoration-line: none !important;
    text-decoration-style: none !important;
    text-decoration-color: transparent !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    line-height: 1.4;
    letter-spacing: 0.5px;
    cursor: pointer !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
    min-height: 60px;
    min-width: 300px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-participa-calendario * {
    cursor: pointer !important;
    pointer-events: none;
}

.btn-participa-calendario:hover,
.btn-participa-calendario:focus,
.btn-participa-calendario:active,
.btn-participa-calendario:visited {
    background-image: url('../images/titles/bottone1.png');
    background-size: 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    color: #ffffff !important;
    text-decoration: none !important;
    text-underline-offset: 0 !important;
    text-decoration-line: none !important;
    text-decoration-style: none !important;
    text-decoration-color: transparent !important;
    transform: translateY(-2px);
    opacity: 0.95;
    cursor: pointer !important;
}

/* Responsive pour petits écrans (< 355px) */
@media (max-width: 354px) {
    .btn-participa-calendario {
        font-size: 0.75rem;
        padding: 8px 12px;
        min-width: auto;
        width: 100%;
        max-width: 100%;
        min-height: 45px;
        letter-spacing: 0.2px;
        line-height: 1.2;
    }
    
    .btn-participa-calendario:hover,
    .btn-participa-calendario:focus,
    .btn-participa-calendario:active,
    .btn-participa-calendario:visited {
        transform: translateY(-1px);
    }
}

/* Responsive pour très petits écrans (< 320px) */
@media (max-width: 319px) {
    .btn-participa-calendario {
        font-size: 0.7rem;
        padding: 8px 10px;
        min-height: 40px;
        letter-spacing: 0.1px;
    }
}

/* Main Content */
.main-content {
    flex: 1; /* Prend tout l'espace disponible entre header et footer */
    background: transparent;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0; /* Espacement réduit */
    margin: 0;
    overflow: hidden; /* Empêche le débordement */
    order: 2; /* Main content au milieu */
    min-height: 0; /* Permet au flex de fonctionner correctement */
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    body {
        min-height: 100vh;
        overflow-y: auto;
        display: flex; /* Garder flexbox pour le footer collé en bas */
        flex-direction: column;
    }
    
    .header {
        padding: 15px 0;
        min-height: 200px; /* Augmenté pour accommoder le logo agrandi */
        flex-shrink: 0; /* Empêcher le header de rétrécir */
    }
    
    .header-logo {
        max-width: 95%;
        max-height: 150px; /* Augmenté de 100px */
        min-height: 90px; /* Augmenté de 70px */
    }
    
    .header-text {
        max-width: 95%;
        max-height: 150px;
        min-height: 70px;
    }
    
    .main-content {
        padding: 15px 0;
        align-items: flex-start;
        overflow-y: auto; /* Permet le scroll si nécessaire */
        flex: 1 0 auto; /* Permettre au contenu de grandir */
    }
    
    .footer-info {
        padding: 15px 0;
        flex-shrink: 0; /* Empêcher le footer de rétrécir */
        margin-top: auto; /* Coller le footer en bas */
    }
    
    .footer-info .container {
        padding: 0 15px;
    }
    
    .footer-info .alert-warning {
        padding: 15px;
    }
    
    .footer-info .alert-warning h6 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .footer-info .alert-warning ul {
        font-size: 0.85rem;
    }
}

/* Très petits écrans (max-width: 480px) */
@media (max-width: 480px) {
    .header {
        padding: 15px 0;
        min-height: 170px; /* Augmenté pour accommoder le logo agrandi */
    }
    
    .header-logo {
        max-width: 90%;
        max-height: 120px; /* Augmenté de 100px */
        min-height: 85px; /* Augmenté de 70px */
    }
    
    .header-text {
        max-width: 90%;
        max-height: 125px;
        min-height: 70px;
    }
}

/* Écrans extra petits (max-width: 360px) */
@media (max-width: 360px) {
    .header {
        padding: 10px 0;
        min-height: 150px; /* Augmenté pour accommoder le logo agrandi */
    }
    
    .header-logo {
        max-width: 85%;
        max-height: 110px; /* Augmenté de 90px */
        min-height: 75px; /* Augmenté de 60px */
    }
    
    .header-text {
        max-width: 85%;
        max-height: 120px;
        min-height: 100px;
    }
}


/* Loading Animation */
.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: transparent; /* Transparent pour voir le header */
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #e74c3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success Animation */
.success-animation {
    animation: success 0.6s ease-in-out;
}

@keyframes success {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Responsive Header and Footer */
@media (max-width: 1024px) {
    .header {
        padding: 0.8rem 0;
    }
    
    .logo-main {
        max-height: 70px;
        margin-bottom: 0.8rem;
    }
    
    .title-main {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .footer {
        padding: 0.8rem 0;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.5rem 0;
    }
    
    .logo-main {
        max-height: 60px;
        margin-bottom: 0.5rem;
    }
    
    .title-main {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .footer {
        padding: 0.5rem 0;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.3rem 0;
    }
    
    .logo-main {
        max-height: 50px;
        margin-bottom: 0.3rem;
    }
    
    .title-main {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .footer {
        padding: 0.3rem 0;
    }
}

@media (max-width: 360px) {
    .header {
        padding: 0.2rem 0;
    }
    
    .logo-main {
        max-height: 40px;
        margin-bottom: 0.2rem;
    }
    
    .title-main {
        font-size: 1.2rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
    
    .footer {
        padding: 0.2rem 0;
    }
}

@media (max-width: 576px) {
    .header {
        padding: 1rem 0;
    }
    
    .footer {
        padding: 1rem 0;
    }
    
    .main-content {
        padding: 2rem 0;
    }
    
    .title-main {
        font-size: 1.5rem;
    }
}

/* Section Participation Concours - Positionnée en bas à gauche */
.contest-participation-section {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 300px;
    padding: 15px;
    background: linear-gradient(135deg, #8B0000, #DC143C);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
    z-index: 1000;
}

.contest-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.contest-header {
    text-align: center;
    margin-bottom: 20px;
}

.contest-title {
    color: #8B0000;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 5px;
}

.contest-subtitle {
    color: #DC143C;
    font-weight: 600;
    font-size: 1.1em;
    margin: 0;
}

.code-display-box {
    margin-bottom: 20px;
}

.code-label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.code-container {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 5px;
    transition: border-color 0.3s ease;
}

.code-container:focus-within {
    border-color: #DC143C;
    box-shadow: 0 0 0 0.2rem rgba(220, 20, 60, 0.25);
}

.code-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 15px;
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    font-weight: bold;
    color: #8B0000;
    outline: none;
}

.copy-btn {
    background: #DC143C;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    cursor: pointer !important;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.copy-btn:hover {
    background: #8B0000;
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

/* Modal Footer Styles - Simplified without contest section */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    gap: 10px;
}

.modal-footer-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Responsive pour le modal footer */
@media (max-width: 768px) {
    .modal-footer {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-footer-buttons {
        justify-content: center;
    }
}
