/* ================================================================
   FICHIER COMMUN - Styles réutilisables pour tous les clients
   ================================================================ */

/* Layout général */
body {
    font-family: Arial, sans-serif;
    padding: 20px;
    max-width: 400px;
    margin: auto;
}

input, button {
    padding: 10px;
    margin: 10px 0;
    width: 100%;
    font-size: 1em;
}

button {
    cursor: pointer;
}

/* Bouton refresh */
#refreshContainer {
    text-align: center;
    margin-top: 15px;
}

#refreshBtn {
    width: auto !important;
    padding: 8px 15px !important;
    margin-top: 10px !important;
    background-color: #4CAF50 !important;
    color: white !important;
    border: none !important;
    border-radius: 5px !important;
    font-size: 0.9em !important;
    text-align: center !important;
    display: inline-block !important;
}

#refreshBtn:hover {
    background-color: #45a049 !important;
}

/* Autocomplétion */
.autocomplete {
    position: relative;
    display: inline-block;
    width: 100%;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
}

.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
}

.autocomplete-items div:hover {
    background-color: #e9e9e9;
}

.autocomplete-active {
    background-color: #4CAF50 !important;
    color: #ffffff;
}

/* Lien d'aide */
.help-link {
    cursor: pointer;
    transition: color 0.3s;
}

.help-link:hover {
    color: #4CAF50;
}

/* Modal d'aide */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100%;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(6, 32, 50, 0.55);
    overflow-y: auto;
}

body.modal-open {
    overflow: hidden;
}

.modal.open {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 30px 28px 26px;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 60px rgba(6, 32, 50, 0.2);
    border: 1px solid rgba(11, 95, 199, 0.08);
    position: relative;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* En-tête de la modal */
.modal-content h3 {
    margin: 0 0 10px;
    color: #0b5fc7;
    font-size: 1.3em;
}

.modal-content > p {
    padding: 0;
    margin: 16px 0;
    color: #5a6475;
    font-size: 0.95em;
    line-height: 1.5;
}

.close {
    position: absolute;
    right: 18px;
    top: 18px;
    color: #5a6475;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.3s;
}

.close:hover, .close:focus {
    transform: rotate(90deg);
}

.contact-info {
    margin: 24px 0 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.contact-item {
    padding: 16px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(6, 32, 50, 0.1);
    border: 1px solid rgba(11, 95, 199, 0.08);
}

.contact-item strong {
    display: block;
    color: #0b3764;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.contact-item a {
    color: #0b5fc7;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05em;
    display: inline-block;
}

/* Responsive pour mobile */
@media (max-width: 600px) {
    .modal {
        padding: 20px;
    }
    
    .modal-content {
        width: calc(100% - 24px);
        padding: 24px 20px;
    }
    
    .close {
        right: 14px;
        top: 14px;
    }
    
    .contact-info {
        gap: 12px;
    }
    
    .contact-item {
        padding: 14px;
    }
}

@media (max-width: 400px) {
    .modal-content {
        width: calc(100% - 16px);
    }
}

/* Loader */
#loadingContainer {
    text-align: center;
    margin: 20px 0;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Bandeau de Noël */
.christmas-banner {
    background: linear-gradient(135deg, #c41e3a 0%, #165b33 100%);
    color: white;
    padding: 12px 50px 12px 20px;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: slideDown 0.5s ease-out;
}

.christmas-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1em;
    font-weight: 500;
    flex-wrap: wrap; /* 🎄 Permet le retour à la ligne sur petits écrans */
    text-align: center;
}

/* 🎄 Responsive pour petits écrans */
@media (max-width: 600px) {
    .christmas-banner {
        padding: 8px 15px;
    }
    
    .christmas-banner-content {
        font-size: 0.9em;
        gap: 5px;
    }
}

/* 🎄 Ajustement du padding du body pour faire de la place à la bannière */
body.has-banner {
    padding-top: 60px;
}

/* 🎄 Ajustement du bouton retour pour qu'il ne soit pas caché par la bannière */
body.has-banner .back-btn {
    top: 70px;
    z-index: 10000; /* S'assure que le bouton est au-dessus de la bannière */
}

/* 🎄 Ajustement responsive pour petits écrans - espacement augmenté */
@media (max-width: 600px) {
    body.has-banner {
        padding-top: 70px; /* Augmenté de 65px à 70px */
    }
    
    body.has-banner .back-btn {
        top: 80px; /* Augmenté de 75px à 80px pour plus de marge */
    }
}

/* 🎄 Ajustement pour très petits écrans (téléphones en mode portrait) */
@media (max-width: 400px) {
    .christmas-banner {
        padding: 6px 10px; /* Bannière plus compacte */
    }
    
    body.has-banner {
        padding-top: 75px;
    }
    
    body.has-banner .back-btn {
        top: 85px; /* Encore plus d'espace sur petits écrans */
    }
}

/* Footer avec informations Mattea */
.footer-info {
    margin-top: 12px;
    padding: 0;
    text-align: center;
    color: #6b7280;
    font-size: 0.9em;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.footer-info p {
    margin: 8px 0;
    line-height: 1.6;
}

.footer-info strong {
    color: #0b5fc7;
    font-weight: 600;
}

.footer-info a {
    color: #0b5fc7;
    text-decoration: none;
    font-weight: 500;
}

.footer-info a:hover {
    text-decoration: underline;
}

.footer-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #0b5fc7, #ff8a23);
    margin: 15px auto;
    border-radius: 2px;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.page-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: #667eea;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loader-logo {
    width: 120px;
    height: auto;
    max-width: 150px;
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
    object-fit: contain;
    display: block;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(102, 126, 234, 0.2);
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader-text {
    font-size: 1.2em;
    font-weight: 600;
    margin-top: 15px;
    color: #667eea;
    animation: fadeInOut 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}
