/* Réinitialisation et box-sizing global */
html {
    overflow-x: hidden; /* Empêche la barre de défilement horizontale sur html */
}

body {
    font-family: 'Arial', sans-serif; /* Police par défaut, à remplacer si identifiée sur Public IA */
    margin: 0;
    padding: 0;
    background-color: #f4f6f8; /* Gris clair neutre */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: #333;
    box-sizing: border-box;
    overflow-x: hidden; /* Empêche la barre de défilement horizontale sur body */
}

*,
*::before,
*::after {
    box-sizing: inherit; /* Hérite du box-sizing du parent, body ici */
}

.header {
    background-color: #0A222E; /* Bleu foncé de Public IA */
    color: white;
    padding: 20px 15px; /* Padding ajusté pour un meilleur espacement */
    width: 100%;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 0;
}

.header h1 {
    margin: 0;
    font-size: 1.5em; /* Utilisation de em pour la scalabilité */
    font-weight: bold;
    line-height: 1.2;
}

.header .logo-ia {
    color: #F28C28; /* Orange de Public IA */
}

.container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 20px;
    width: calc(100% - 40px); /* Assure que le conteneur ne dépasse pas avec les marges */
    max-width: 500px; /* Limite la largeur sur les grands écrans */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container h2 {
    color: #0A222E; /* Bleu foncé */
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.25em; /* Utilisation de em */
    line-height: 1.3;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-weight: bold;
    font-size: 0.9em;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
    border-color: #F28C28; /* Orange pour l'accent au focus */
    outline: none;
}

.submit-btn {
    background-color: #F28C28; /* Orange de Public IA */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    width: 100%;
}

.submit-btn:hover {
    background-color: #d97920; /* Orange plus foncé au survol */
}

.hidden-separator {
    display: none;
}

.footer {
    margin-top: auto; /* Pousse le pied de page en bas */
    padding: 20px 15px;
    text-align: center;
    color: #777;
    font-size: 0.8em;
    width: 100%;
    background-color: #e9ecef;
}

/* Formes décoratives (optionnel) */
body::before {
    content: '';
    position: fixed;
    top: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
    background-color: rgba(242, 140, 40, 0.05);
    border-radius: 50%;
    z-index: -1;
    filter: blur(50px);
    pointer-events: none; /* Empêche l'interaction */
}

body::after {
    content: '';
    position: fixed;
    bottom: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
    background-color: rgba(10, 34, 46, 0.05);
    border-radius: 45% 55% 60% 40% / 50% 40% 60% 50%;
    z-index: -1;
    filter: blur(60px);
    transform: rotate(30deg);
    pointer-events: none; /* Empêche l'interaction */
}

.message {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9em;
    word-wrap: break-word; /* Permet au texte de passer à la ligne */
    overflow-wrap: break-word; /* Assure la compatibilité avec tous les navigateurs */
    max-width: 100%; /* Empêche le débordement horizontal */
    box-sizing: border-box; /* Inclut le padding dans la largeur */
    display: block; /* Transforme en élément bloc */
    text-align: left; /* Aligne le texte à gauche pour une meilleure lisibilité */
}

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

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

/* Media Queries pour le responsive design */

/* Pour les tablettes et petits desktops */
@media (min-width: 600px) {
    .header h1 {
        font-size: 1.75em;
    }
    .container {
        padding: 30px 40px;
        margin: 40px auto; /* Centrer avec marges auto */
    }
    .container h2 {
        font-size: 1.5em;
    }
    .submit-btn {
        width: auto; /* Retour à la largeur auto pour le bouton */
        font-size: 1.1em;
    }
    .footer {
        font-size: 0.9em;
    }
}

/* Pour masquer les formes décoratives sur les très petits écrans si besoin */
@media (max-width: 480px) {
    body::before,
    body::after {
        display: none; /* Masquer pour simplicité et performance */
    }
    .header h1 {
        font-size: 1.3em;
    }
    .container h2 {
        font-size: 1.1em;
    }
    .form-group input[type="text"],
    .form-group input[type="email"] {
        font-size: 0.95em;
        padding: 10px;
    }
     .submit-btn {
        font-size: 0.95em;
        padding: 10px 15px;
    }
    .message {
        font-size: 0.85em;
    }
}

/* Styles pour le tableau responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.files-table th,
.files-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.files-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #0A222E;
}

.files-table tr:hover {
    background-color: #f8f9fa;
}

/* Troncature des noms de fichiers longs */
.files-table td:first-child {
    max-width: 25vw;
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Styles pour les cartes sur mobile */
.files-cards {
    display: none;
    gap: 15px;
    margin: 20px 0;
}

.file-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.file-card-header {
    margin-bottom: 10px;
}

.file-card-title {
    font-weight: bold;
    color: #0A222E;
    margin: 0 0 5px 0;
    word-break: break-all;
}

.file-card-info {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.file-card-info div {
    margin-bottom: 5px;
}

.file-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Styles pour les boutons d'action */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-right: 8px;
    text-decoration: none;
    display: inline-block;
    width: 120px; Largeur fixe pour les deux boutons
    text-align: center;
}

.download-btn {
    background-color: #F28C28;
    color: white;
}

.download-btn:hover {
    background-color: #d97920;
}

.qr-btn {
    background-color: #0A222E;
    color: white;
}

.qr-btn:hover {
    background-color: #053145;
}

/* Styles pour le 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);
    overflow-y: auto;
}

.modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fefefe;
    margin: 2% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
    max-height: 96vh;
    overflow-y: auto;
}

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

.close:hover {
    color: #0A222E;
}

/* Styles pour les options du QR code */
.qr-options {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: bold;
}

.option-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
}

/* Message de chargement du QR code */
.qr-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Style pour le nom du fichier dans la modal */
.qr-file-name {
    text-align: center;
    padding: 10px;
    margin: 10px 0;
    background-color: #f8f9fa;
    border-radius: 4px;
    color: #0A222E;
    font-weight: bold;
    word-break: break-all;
}

/* Media queries pour le responsive */
@media (max-width: 768px) {
    .table-responsive {
        display: none;
    }

    .files-cards {
        display: grid;
        grid-template-columns: 1fr;
    }

    .container {
        max-width: 100%;
        margin: 10px;
        padding: 15px;
    }

    .action-btn {
        flex: 1;
        text-align: center;
    }
}

/* Ajustement de la largeur du conteneur sur desktop */
@media (min-width: 769px) {
    .container {
        max-width: 900px;
        margin: 40px auto;
    }
}

/* Styles pour la barre de recherche */
.search-container {
    margin: 20px 0;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1em;
    transition: all 0.3s ease;
    background-color: white;
}

.search-input:focus {
    outline: none;
    border-color: #F28C28;
    box-shadow: 0 0 0 3px rgba(242, 140, 40, 0.1);
}

.search-input::placeholder {
    color: #adb5bd;
}

/* Styles pour la barre de navigation */
.navbar {
    background-color: #0A222E;
    padding: 10px 0;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-top: 1px solid #F28C28;
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: #F28C28;
    color: white;
}

