/* Styles généraux pour toutes les pages */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #36a93e;
}
.password-container {
    position: relative;
    display: flex;
    align-items: center;
}
.password-container input {
    width: 100%;
}
.toggle-password {
    position: absolute;
    right: 10px;
    cursor: pointer;
    user-select: none;
}
.container {
    max-width: 90%;
    margin: 0 auto;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

/* Styles pour les galeries et les cartes SVG */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.svg-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s;
    position: relative; /* Clé pour le positionnement des boutons */
}

.svg-card:hover {
    transform: translateY(-5px);
}

.svg-card a {
    text-decoration: none;
    color: inherit;
}

.svg-container {
    position: relative;
    width: 100%;
    height: 200px; /* Conservez la hauteur fixe pour les miniatures */
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #dae9f6; /* Bleu très clair */
    
    /* Nouvelles règles pour l'image de fond */
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain; /* C'est la règle clé pour le redimensionnement */
}

.svg-container svg {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #ddd;
    display: block;
}

.info {
    padding: 15px;
    border-top: 1px solid #eee;
}

.info h3 {
    margin: 0 0 5px;
    color: #0056b3;
    font-size: 1.2em;
}

.info p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

/* Styles de la pagination et des contrôles */
.pagination {
    text-align: center;
    margin-top: 20px;
}

.pagination a, .pagination a:hover, .pagination button {
    text-decoration: none;
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    border-radius: 5px;
}

.pagination a:hover {
    background-color: #ddd;
}

.pagination span {
    padding: 8px 16px;
    margin: 0 5px;
    color: #555;
}

/* Styles pour les contrôles de la galerie */
.controls {
    display: flex;
    justify-content: center; /* Conserve votre alignement central */
    align-items: flex-start; /* Aligne les éléments en haut */
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap; /* Permet le retour à la ligne sur les petits écrans */
}

.controls-block {
    display: flex;
    align-items: center; /* Aligne les éléments verticalement */
    gap: 10px;
}

/* Styles pour le formulaire de recherche */
.search-form {
    display: flex;
    align-items: center; /* Aligne les éléments du formulaire verticalement */
    gap: 10px;
}

.search-form input[type="text"] {
    width: 150px; /* Réduction de la largeur pour un meilleur affichage */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.search-form button {
    padding: 8px 16px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

/* Styles pour les boutons */
.help-icon {
    cursor: pointer;
    font-size: 1.5em;
    color: #007bff;
    margin-left: 5px;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-icon:hover {
    color: #0056b3;
    background-color: #e9ecef;
}

/* Styles pour la modal d'aide à la recherche */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.4);
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 85%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.add-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1em;
    transition: background-color 0.2s;
}

.add-button:hover {
    background-color: #0056b3;
}

/* Styles pour les messages */
.message.success {
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    background-color: #d4edda;
    color: #155724;
}

.message.error {
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    background-color: #f8d7da;
    color: #721c24;
}

/* Styles pour le bouton de mise sous tension (Connexion/Déconnexion) */
.auth-status {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 10px;
    padding-bottom: 20px;
    gap: 10px;
    z-index: 100;
}

.auth-status span {
    font-weight: bold;
    color: #555;
}

.auth-status .header-btn {
    text-decoration: none;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.auth-status .header-btn:hover {
    background-color: #0056b3;
}

.power-button {
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.power-button:hover {
    transform: scale(1.1);
}

.power-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #fff;
    box-sizing: border-box;
}

.power-button.disconnected {
    background-color: #dc3545; /* Rouge pour Déconnecté */
}

.power-button.disconnected::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    width: 2px;
    height: 12px;
    background-color: #fff;
    transform: translateX(-50%);
}

.power-button.connected {
    background-color: #28a745; /* Vert pour Connecté */
}

/* Styles pour les boutons d'action sur les miniatures (index.php) */
.action-buttons {
    position: absolute;
    top: 188px;
    right: 5px;
    display: flex;
    gap: 5px;
    z-index: 2;
}
.action-buttons a {
    font-size: 1.2em;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    text-decoration: none;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s, transform 0.2s;
}
.download-button {
    background-color: #28a745;
}
.download-button:hover {
    background-color: #218838;
    transform: translateY(-2px);
}
.edit-button {
    background-color: #ffc107;
    color: #212529;
    font-size: 1.2em;
}
.edit-button:hover {
    background-color: #e0a800;
    transform: translateY(-2px);
}
.delete-button {
    background-color: #dc3545;
}
.delete-button:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

/* Styles pour les tables d'information (page de détail) */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.info-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}
.info-table tr:nth-child(even) {
    background-color: #f2f2f2;
}
.info-table td:first-child {
    font-weight: bold;
    width: 30%;
    background-color: #e9ecef;
}

/* Styles pour la page d'inscription et de connexion */
.login-container, .register-container {
    background-color: #fff;
    padding: 30px; /* Réduction du padding pour les petits écrans */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 80%; /* Utilisation d'un pourcentage pour la largeur */
    max-width: 400px; /* Largeur maximale pour les grands écrans */
    text-align: center;
    margin: 50px auto;
}

.login-link, .register-link {
    display: block;
    margin-top: 15px;
    color: #007bff;
    text-decoration: none;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group.full-width {
    grid-column: 1 / -1; /* Permet à l'élément de s'étendre sur toutes les colonnes */
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

/* Règle générale pour les champs de texte et de sélection */
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Règle spécifique pour la zone de texte */
.form-group textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical; /* Permet uniquement le redimensionnement vertical */
}

/* Styles pour la vue invité */
.info.guest-blur {
    filter: blur(5px);
    pointer-events: none;
}

.svg-card:hover .info.guest-blur {
    filter: blur(0);
}

/* Nouvelles règles pour enlever le flou au survol de la souris */
.svg-card:hover .svg-container {
    filter: blur(0);
}

.login-message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0); /* Moins opaque pour voir le dessin */
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
    cursor: pointer;
    z-index: 10;
}

.login-message-overlay:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* --- DETAIL & EDIT & ADD PAGE SPECIFIC STYLES --- */
.detail-content, .main-content-grid {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}
.detail-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.main-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.detail-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative; /* Clé pour le positionnement des boutons */
}
.detail-header h1 {
    margin: 0;
}
.detail-svg-container, .svg-preview-container, .svg-display {
    width: 100%;
    height: 400px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #dae9f6; /* Bleu très clair */
    /* Lignes ajoutées pour le redimensionnement de l'image de fond */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.back-button, .back-link {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1em;
    transition: background-color 0.2s;
}
.back-button:hover, .back-link:hover {
    background-color: #5a6268;
}

/* Form Styling (add.php, edit.php, etc.) */
.form-card {
    max-width: 800px; /* Adjust this value to your preferred width */
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 20px auto; /* Centre le conteneur horizontalement */
}
.form-card form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.form-card label {
    font-weight: bold;
    color: #333;
}

/* Assurez-vous que cette règle est présente et correcte */
.form-card input[type="text"],
.form-card input[type="file"],
.form-card select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box; /* Assure que le padding n'augmente pas la largeur */
}

/* Ajoutez cette nouvelle règle spécifiquement pour la zone de texte */
.form-card textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box; /* Assure que le padding n'augmente pas la largeur */
    min-height: 100px; /* Laissez cette ligne pour une hauteur minimale */
    resize: vertical; /* Permet uniquement le redimensionnement vertical */
}

.form-card textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
}
.form-card button[type="submit"] {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.2s;
    align-self: flex-start;
}
.form-card button[type="submit"]:hover {
    background-color: #0056b3;
}
.form-card .cancel-button {
    background-color: #6c757d;
    margin-left: 10px;
}
.form-card .cancel-button:hover {
    background-color: #5a6268;
}
.form-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 20px;
}
.password-strength-meter {
    height: 7px;
    background: #ddd;
    border-radius: 5px;
    margin-top: 5px;
}
.password-strength-meter-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s, background-color 0.3s;
    width: 0;
}
.password-requirements p {
    font-size: 0.9em;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 5px;
}
.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.password-requirements li {
    color: #ff0000;
    font-size: 0.85em;
    padding: 2px 0;
    transition: color 0.3s;
}
.password-requirements li.valid {
    color: #008000;
}
.drop-zone {
    padding: 20;
    border: 2px dashed #009578;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}
.drop-zone:hover {
    border-color: #007a61;
}
.drop-zone__prompt {
    color: #aaa;
    font-size: 1.2em;
    pointer-events: none;
}
.drop-zone__input {
    display: none;
}

/* Styles pour le bouton de connexion */
.submit-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 20px;
}

.submit-btn:hover {
    background-color: #0056b3;
}

/* Conteneur pour les liens en bas */
.links-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

/* Style pour le lien "Mot de passe oublié" */
.forgot-password-link, .register-link {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-password-link:hover, .register-link:hover {
    color: #007bff;
    text-decoration: underline;
}

/* Correction du style du conteneur de connexion pour qu'il soit bien aligné */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 50px auto;
}

/* Le formulaire doit prendre toute la largeur pour le bon alignement des champs */
.login-container form {
    width: 100%;
}
/* Styles pour le bouton de rafraîchissement */
.refresh-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1em;
    transition: background-color 0.2s;
}

.refresh-button:hover {
    background-color: #5a6268;
}

.suggestions-container {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.suggestions-list {
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    max-height: 150px;
    overflow-y: auto;
    width: 100%;
    z-index: 10;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #e9e9e9;
}

.auth-status {
    display: flex;
    justify-content: space-between; /* Aligne les éléments à gauche et à droite */
    align-items: center;
    padding-top: 10px;
    padding-bottom: 20px;
    gap: 10px;
    z-index: 100;
}

.auth-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.label-with-button {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}
.icon-button {
    background-color: #e9ecef;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 1.1em;
    line-height: 1;
    color: #495057;
    transition: background-color 0.2s;
}
.icon-button:hover {
    background-color: #d8dbe0;
}
.icon-button.is-visible {
    display: inline-block !important; /* !important pour s'assurer que la règle est appliquée */
}
.filename-label {
    display: block;
    text-align: center;
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 10px;
}
/* Styles pour la case à cocher sur les fiches SVG */
.checkbox-container {
    position: absolute;
    top: 2px;
    left: 6px;
    z-index: 10; /* S'assure que la case à cocher est au-dessus du contenu de la carte */
    display: block;
    width: 20px;
    height: 20px;
}

.card-checkbox {
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
/* Styles de base pour le statut de validation */
.validation-status {
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
    z-index: 5;
}

.status-valid {
    background-color: #28a745; /* Vert pour "Validé" */
}

.status-invalid {
    background-color: #dc3545; /* Rouge pour "Non validé" */
}

/* Styles de positionnement pour le statut "Non validé" */
.status-centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Styles de positionnement pour le statut "Validé" */
.status-inline {
    display: inline-block;
    margin-top: 5px;
}

.profile-grid {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.profile-grid .profile-card,
.profile-grid .form-card {
    flex: 1; /* Permet à chaque carte de prendre une part égale de l'espace */
    min-width: 0; /* Empêche le débordement sur les petits écrans */
}

/* Media query pour les petits écrans (tablettes et mobiles) */
@media (max-width: 768px) {
    /* Les cartes du profil s'empilent verticalement */
    .profile-grid {
        flex-direction: column;
    }

    /* Les deux parties de la première carte s'empilent aussi */
    .account-grid {
        flex-direction: column;
    }
    
    /* Réduction de la taille des titres pour les petits écrans */
    h1 {
        font-size: 1.5em;
    }
    
    .profile-card h2,
    .form-card h2 {
        font-size: 1.2em;
    }

    /* Styles pour l'affichage du nom de l'utilisateur dans le filtre de recherche */
    .user-filter-tag {
        display: flex;
        align-items: center;
        background-color: #e2eafc;
        border-radius: 20px;
        padding: 5px 10px;
        margin-right: 10px;
    }
    .user-filter-tag span {
        font-size: 0.9em;
        font-weight: normal;
    }
    .user-filter-tag strong {
        margin-left: 5px;
    }
    .clear-filter-btn {
        margin-left: 8px;
        color: #000;
        font-weight: bold;
        text-decoration: none;
        cursor: pointer;
        font-size: 0.9em;
    }
    .clear-filter-btn:hover {
        color: #dc3545;
    }
}