/* Style pour les photos récemment ajoutées */
.recent-additions {
    background-color: #ff0000;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    color: white;
}

.recent-additions h2 {
    margin: 0 0 1.5rem;
    color: white;
}

.recent-photos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 0 auto;
    max-width: 1200px;
    padding: 0 1rem;
}

.recent-photo {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    height: auto;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.recent-photo img {
    max-width: 120px;
    height: auto;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    object-fit: cover;
    border: 2px solid white;
}

.photo-info h3 {
    margin: 0;
    color: white;
    font-size: 1rem;
    font-weight: bold;
}

/* Barre de recherche et exportation */
.search-section {
    background: #000000;
    padding: 2px 0;
    margin: 2px 0;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-form {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
}

.search-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0.2rem;
    margin-bottom: 0.3rem;
}

.search-line {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input,
.search-input-container .search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 1rem;
    background: #222;
    color: white;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.search-input:focus,
.search-input-container .search-input:focus {
    border-color: #3498db;
    outline: none;
}

.search-button {
    padding: 0 20px;
    height: 40px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover {
    background: #2980b9;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.export-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 15px;
    height: 40px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    text-decoration: none;
}

.export-button:hover {
    background: #219653;
}

.export-button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.7;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .recent-photos {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .recent-photo {
        padding: 0.75rem;
        min-height: 180px;
    }

    .recent-photo img {
        max-width: 100px;
    }

    .photo-info h3 {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .recent-photos {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .recent-photo {
        padding: 0.5rem;
        min-height: 150px;
    }

    .recent-photo img {
        max-width: 80px;
    }

    .photo-info h3 {
        font-size: 0.8rem;
    }
}

/* style.css optimisé avec hauteur de photo augmentée */

body {
    font-family: Arial, sans-serif;
    padding: 1rem;
    margin: 0;
    box-sizing: border-box;
}

.search-line {
    display: flex;
    width: 100%;
}

.filters-form {
    width: 100%;
}

.filter-item {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.search-input-container {
    display: flex;
    flex: 1;
    gap: 0.5rem;
}

.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    flex: 1;
}

.search-button {
    padding: 0 1.5rem;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.export-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s;
    white-space: nowrap;
    height: 38px; /* Hauteur identique au champ de recherche */
}

.search-button:hover {
    background: #444;
}

.debug-info {
    background-color: #f8f9fa;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.no-image {
    text-align: center;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    color: #666;
}

.navigation-fiches {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: nowrap;
    padding: 0 1rem;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.nav-button {
    padding: 0.75rem 1rem;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 60px;
    max-width: 80px;
    width: 100%;
    text-align: center;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
}

.nav-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.nav-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


.fiche-detenu {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.fiche-detenu h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.fiche-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.photo-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.photo-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.photo-container img.loaded {
    opacity: 1;
}

.photo-container .placeholder {
    width: 100%;
    padding-top: 100%;
    background: #f0f0f0;
    border-radius: 8px;
    position: relative;
}

.photo-container .placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #ddd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.info-basiques {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

.info-basiques p {
    margin: 0.5rem 0;
}

.info-basiques strong {
    color: #333;
}

.commentaire {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.commentaire h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

.commentaire p {
    line-height: 1.6;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .fiche-content {
        grid-template-columns: 1fr;
    }
    
    .photo-container {
        text-align: center;
    }
    
    .commentaire {
        margin-top: 2rem;
    }
}

/* Force le box-sizing sur tous les éléments */
*, *:before, *:after {
    box-sizing: inherit;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem;
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
}

.card {
    perspective: 1000px;
    width: 100%; /* Utiliser 100% au lieu d'une largeur fixe */
    height: 500px; /* Augmentée de 350px à 500px pour accommoder la hauteur de photo */
    margin: 0 auto; /* Centrer les cartes */
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
}

.card-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 1.5s;
    transform-style: preserve-3d;
    padding: 0;
    box-sizing: border-box;
    transform-origin: center center;
}

.card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0;
    box-sizing: border-box;
    transform-style: preserve-3d;
    transform-origin: center center;
}

.card-front {
    background: white;
    transform: rotateY(0deg);
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-front .header, .card-back .header {
    background: #f5f5f5;
    border-top: 4px solid #333;
    padding: 10px;
    margin-bottom: 10px;
}

.card-front .header h2, .card-back .header h2 {
    margin: 0;
    text-transform: uppercase;
    font-size: 1em;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.photo {
    width: 90%; /* Utiliser une largeur relative */
    height: 360px; /* Augmentée de 212px à 360px comme demandé */
    margin: 0 auto 10px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-style: italic;
}

.footer {
    background: #f5f5f5;
    margin-top: auto;
}

.footer-bottom {
    background: #666;
    color: white;
    padding: 10px;
    margin-top: 0;
    text-align: center;
}

.description {
    width: 90%; /* Utiliser une largeur relative */
    height: 360px; /* Augmentée de 212px à 360px pour correspondre à la photo */
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto; /* Permettre le défilement si le texte est trop long */
    flex: 1;
}

.info-container {
    display: flex;
    justify-content: space-between;
    padding: 0;
    margin: 0;
    background: #f0f0f0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0;
    width: 48%;
    justify-content: center;
    padding: 5px 0 0 0;
    background: #000000;
    min-height: 30px;
}

.info-item:first-child {
    justify-content: flex-start;
    padding-left: 10px;
    margin-left: 0;
}

.info-item:last-child {
    justify-content: flex-end;
    padding-right: 10px;
    margin-right: 0;
}

.info-value {
    color: #ffffff;
    font-weight: 600;
    text-align: left;
    padding: 0;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Filtres */
.filters-form {
    flex: 1;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 1.1rem;
    background: #2d2d2d;
    color: #fff;
}

.search-button {
    padding: 1rem 1.5rem;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
}

.search-button:hover {
    background: #357abd;
}

.export-button {
    /* padding: 1rem 2.5rem; */
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.1rem;
    min-width: 120px;
    height: 40px;
}

.export-button:hover {
    background: #27ae60;
}

.filter-results {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: #6c757d;
}

/* Message d'erreur */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    margin: 15px 0;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Message "aucun résultat" */
.no-results {
    text-align: center;
    font-size: 1.2rem;
    color: #6c757d;
    margin: 2rem 0;
    width: 100%;
}

/* Styles pour le header et footer */
header, footer {
    text-align: center;
    padding: 1rem;
}

header h1 {
    color: #333;
    margin-bottom: 2rem;
}

footer p {
    color: #666;
    font-size: 0.9rem;
}

/* Media queries optimisées et organisées par taille d'écran (de grand à petit) */
@media (max-width: 1024px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 0.75rem;
    }
    
    .card {
        height: 450px; /* Ajusté pour l'écran plus petit */
    }
    
    .photo, .description {
        height: 320px; /* Ajusté pour l'écran plus petit */
    }
}

@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.5rem;
    }
    
    .card {
        height: 420px; /* Ajusté pour l'écran plus petit */
    }
    
    .photo, .description {
        height: 280px; /* Ajusté pour l'écran plus petit */
    }
     
    .search-line {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filters-form, .export-form {
        width: 100%;
    }
    
    .export-form {
        display: flex;
        justify-content: flex-end;
    }
    
    .search-input {
        max-width: none;
    }
    .navigation-fiches {
        padding: 0 0.5rem;
    }
    
    .nav-button {
        min-width: 60px;
        max-width: 80px;
        padding: 0.5rem 0.75rem;
    }
}

/* Breakpoint pour mobile - passage à une seule colonne */
@media (max-width: 576px) {
    .gallery {
        grid-template-columns: 1fr; /* Une seule colonne */
        max-width: 95%;
    }
    
    .card {
        max-width: 280px; /* Largeur maximale pour les cartes sur mobile */
        height: 400px; /* Ajusté pour mobile */
        margin: 0 auto;
    }
    
    .photo, .description {
        height: 260px; /* Ajusté pour mobile */
    }
    
    .card-front .header h2, .card-back .header h2 {
        font-size: 0.9em;
    }
    
    .info-value {
        font-size: 0.8rem;
    }
    
    .footer-bottom {
        font-size: 0.9rem;
        padding: 8px;
    }
    
    .search-button, .export-button {
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
    }
}