* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    padding-top: 100px;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 30px 40px;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fff;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 960px;
    margin: 0 auto;
}

.logo a {
    text-decoration: none;
    color: #333;
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 40px;
}

.nav-menu a {
    text-decoration: none;
    color: #666;
    font-size: 14px;
    font-style: italic;
    transition: color 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #333;
}

.burger-btn {
    display: none;
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 8px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 310px);
    gap: 15px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 40px;
    justify-content: center;
}

.project-card {
    position: relative;
    overflow: hidden;
    width: 310px;
    height: 310px;
    aspect-ratio: 1/1;
    background-color: #f5f5f5;
}

.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-card:hover img {
    transform: scale(1.05);
}

.project-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    padding: 20px;
    padding-right: 55px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.project-card:hover .project-overlay {
    transform: translateY(0);
}

.project-overlay h3 {
    color: white;
    font-size: 14px;
    font-weight: 400;
}

.project-detail {
    margin: 40px 0;
}

.project-header-container {
    max-width: 1040px;
    margin: 0 auto 60px;
    padding: 0 40px;
}

.project-title-section {
    margin-bottom: 40px;
}

.project-title-section h1 {
    font-size: 32px;
    font-weight: 300;
    color: #333;
    margin-bottom: 10px;
}

.project-title-section h2 {
    font-size: 20px;
    font-weight: 300;
    color: #666;
}

/* Bouton de modification sur la page détail */
.btn-edit-project {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-edit-project:hover {
    background-color: #333;
    color: white;
    border-color: #333;
}

.btn-edit-project svg {
    width: 16px;
    height: 16px;
}

/* Carte "+ Nouveau projet" */
.add-project-card {
    background: transparent;
}

.add-project-btn {
    width: 100%;
    height: 100%;
    background: #f9f9f9;
    border: 3px dashed #ccc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    font-size: 14px;
    color: #999;
    padding: 40px;
}

.add-project-btn:hover {
    background: #f0f0f0;
    border-color: #333;
    color: #333;
}

.add-project-btn svg {
    color: inherit;
    transition: transform 0.3s;
}

.add-project-btn:hover svg {
    transform: scale(1.1);
}

/* Bouton crayon sur les cartes */
.edit-name-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
    z-index: 5;
}

.edit-name-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.edit-name-btn svg {
    width: 16px;
    height: 16px;
    stroke: #333;
}

.project-info-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 60px;
}

.project-description p {
    font-size: 14px;
    line-height: 1.8;
    color: #555;
    text-align: justify;
    margin-bottom: 20px;
}

.project-tags {
    font-size: 13px;
    color: #666;
    font-style: italic;
    line-height: 1.6;
}

.project-sidebar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.project-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.detail-item {
    font-size: 13px;
    color: #666;
    text-align: right;
}

.detail-label {
    color: #999;
}

.detail-value {
    color: #333;
}

.project-gallery {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto 40px;
    padding: 0 40px;
}

/* Galerie simple (mobile ou fallback) */
.simple-gallery {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.simple-gallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* Sections de galerie avec layouts personnalisés */
.gallery-section {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}

.gallery-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Layout 1 : 1 image pleine largeur */
.gallery-section-1 {
    grid-template-columns: 1fr;
}

.gallery-section-1 img {
    height: auto;
    width: 100%;
}

/* Layout 1+1 : 2 images côte à côte */
.gallery-section-1\+1 {
    grid-template-columns: 1fr 1fr;
}

.gallery-section-1\+1 .section-image-wrapper {
    height: auto;
}

/* Layout 2+1 : 2 images empilées + 1 grande à droite */
.gallery-section-2\+1 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.gallery-section-2\+1 .section-image-wrapper:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    min-height: 200px;
}

.gallery-section-2\+1 .section-image-wrapper:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    min-height: 200px;
}

.gallery-section-2\+1 .section-image-wrapper:nth-child(3) {
    grid-column: 2;
    grid-row: 1 / 3;
    min-height: 410px;
}

/* Layout 1+2 : 1 grande à gauche + 2 empilées à droite */
.gallery-section-1\+2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.gallery-section-1\+2 .section-image-wrapper:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / 3;
    min-height: 410px;
}

.gallery-section-1\+2 .section-image-wrapper:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    min-height: 200px;
}

.gallery-section-1\+2 .section-image-wrapper:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    min-height: 200px;
}

/* Boutons d'action sur les sections (mode édition) */
.section-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.section-action-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.section-action-btn:hover {
    background: #333;
}

.section-action-btn:hover svg {
    stroke: white;
}

.section-action-btn.delete {
    border-color: #c33;
}

.section-action-btn.delete:hover {
    background: #c33;
}

/* Wrapper pour les images de section avec bouton d'édition */
.section-image-wrapper {
    position: relative;
    overflow: hidden;
}

.image-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.section-image-wrapper:hover .image-edit-overlay {
    opacity: 1;
}

.image-edit-btn {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.image-edit-btn:hover {
    background: #333;
    transform: scale(1.1);
}

.image-edit-btn:hover svg {
    stroke: white;
}

/* Modal de sélection de layout */
.layout-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 25px 0;
}

.layout-option {
    cursor: pointer;
    padding: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s;
}

.layout-option:hover {
    border-color: #333;
    background: #f9f9f9;
}

.layout-option p {
    margin-top: 15px;
    font-size: 13px;
    color: #666;
}

.layout-preview {
    display: grid;
    gap: 4px;
    height: 120px;
    background: #f5f5f5;
    border-radius: 4px;
    padding: 8px;
}

.preview-box {
    background: #ccc;
    border-radius: 2px;
}

/* Previews spécifiques */
.layout-preview-1 {
    grid-template-columns: 1fr;
}

.layout-preview-1-1 {
    grid-template-columns: 1fr 1fr;
}

.layout-preview-2-1 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.layout-preview-2-1 .preview-box:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

.layout-preview-2-1 .preview-box:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}

.layout-preview-2-1 .preview-box:nth-child(3) {
    grid-column: 2;
    grid-row: 1 / 3;
}

.layout-preview-1-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.layout-preview-1-2 .preview-box:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / 3;
}

.layout-preview-1-2 .preview-box:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.layout-preview-1-2 .preview-box:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

/* Badge pour la sélection multi-images */
.image-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: #333;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Bouton ajouter section */
.add-section-btn {
    width: 100%;
    padding: 30px;
    margin: 10px 0;
    background: #f9f9f9;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    font-size: 14px;
    color: #666;
}

.add-section-btn:hover {
    background: #f0f0f0;
    border-color: #333;
    color: #333;
}

.add-section-btn svg {
    flex-shrink: 0;
}

.carousel-container {
    position: relative;
    width: 100%;
}

.carousel-container::before,
.carousel-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20%;
    z-index: 5;
    pointer-events: none;
}

.carousel-container::before {
    left: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
}

.carousel-container::after {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
}

.embla {
    overflow: hidden;
    background-color: #f5f5f5;
}

.embla__viewport {
    overflow: hidden;
}

.embla__container {
    display: flex;
    align-items: center;
}

.embla__slide {
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 450px;
    margin-right: 10px;
}

.embla__slide img {
    height: 450px;
    width: auto;
    object-fit: contain;
}

.carousel-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1040px;
    margin: 0 auto;
    padding: 30px 40px;
}

.carousel-navigation {
    display: flex;
    gap: 10px;
}

.nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    padding: 0;
}

.nav-btn:hover {
    color: #999;
}

.nav-btn svg {
    width: 32px;
    height: 32px;
    display: block;
}

.carousel-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #999;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.dot:hover {
    border-color: #666;
}

.dot.active {
    background-color: #333;
    border-color: #333;
}

.agency-page {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 40px;
}

.agency-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 60px;
    margin-bottom: 40px;
}

.agency-text {
    max-width: 600px;
}

.agency-text p {
    font-size: 14px;
    line-height: 1.8;
    color: #555;
    text-align: justify;
    margin-bottom: 20px;
}

.agency-text em {
    font-style: italic;
}

.contact-section {
    padding-top: 100px;
}

.contact-section h2 {
    font-size: 18px;
    font-weight: 400;
    font-style: italic;
    color: #666;
    margin-bottom: 30px;
}

.contact-info {
    font-size: 14px;
    line-height: 1.8;
    color: #555;
    margin-bottom: 40px;
}

.contact-info strong {
    font-weight: 500;
    color: #333;
}

.contact-info a {
    color: #555;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-info a:hover {
    color: #333;
    text-decoration: underline;
}

.legal-mentions {
    font-size: 13px;
    color: #999;
    font-style: italic;
    margin-top: 30px;
}

.back-button {
    margin-top: 40px;
    padding: 10px 20px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.back-button:hover {
    background-color: #333;
    color: white;
    border-color: #333;
}

.map-container {
    grid-column: 1 / -1;
    margin-top: 40px;
    border: 1px solid #e0e0e0;
    height: 400px;
    background-color: #f5f5f5;
    position: relative;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 600px) {
    .navbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .burger-btn {
        display: block;
    }

    .project-gallery {
        max-width: 1040px;
        padding: 0 40px;
    }

    .nav-menu {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        width: 250px;
        height: 100vh;
        background: white;
        flex-direction: column;
        gap: 0;
        padding: 80px 30px 30px;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        z-index: 1001;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .nav-menu.open {
        transform: translateX(0);
    }

    .nav-menu li {
        padding: 15px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-menu a {
        font-size: 16px;
    }

    /* Overlay derrière le menu */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 250px;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 1000;
    }

    body.menu-open::before {
        opacity: 1;
        pointer-events: none;
    }

    .carousel-container::before,
    .carousel-container::after {
        display: none;
    }

    .embla {
        overflow: visible;
    }

    .embla__viewport {
        overflow: visible;
    }

    .embla__container {
        display: block;
    }

    .embla__slide {
        height: auto;
        margin-bottom: 10px;
        margin-right: 0;
    }

    .embla__slide img {
        position: static;
        height: auto;
        width: 100%;
        max-width: 100%;
        object-fit: cover;
    }

    .carousel-controls {
        display: none;
    }
}

@media (max-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 310px);
        gap: 15px;
    }

    .project-info-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .agency-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 20px;
    }

    .project-card {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
    }

    .project-header h1 {
        font-size: 24px;
    }

    .project-header h2 {
        font-size: 18px;
    }
}

/* Modal de connexion admin */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    font-size: 22px;
    font-weight: 300;
    margin-bottom: 25px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #333;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
    resize: vertical;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    background: #f9f9f9;
}

.form-group input[type="file"]:hover {
    border-color: #333;
    background: #f5f5f5;
}

.form-group input[type="file"]:focus {
    outline: none;
    border-color: #333;
    background: white;
}

.field-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    font-style: italic;
}

/* Grille de champs côte à côte */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.required {
    color: #c33;
    font-weight: bold;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.error-message {
    padding: 12px;
    background-color: #fff0f0;
    border: 1px solid #ffcccc;
    border-radius: 4px;
    color: #cc0000;
    font-size: 13px;
    margin-bottom: 15px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn-cancel,
.btn-login {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    border: none;
}

.btn-cancel {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.btn-cancel:hover {
    background-color: #e0e0e0;
}

.btn-login {
    background-color: #333;
    color: white;
}

.btn-login:hover {
    background-color: #555;
}

/* Section édition */
.edition-page {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 40px;
}

.edition-content {
    background: #f9f9f9;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.edition-content h2 {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 20px;
    color: #333;
}

.edition-content p {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
}

.edition-actions {
    display: flex;
    gap: 15px;
}

.btn-logout {
    padding: 10px 20px;
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-logout:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

/* Bouton toggle mode édition */
.btn-toggle-edit {
    padding: 10px 20px;
    background-color: #333;
    color: white;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-toggle-edit:hover {
    background-color: #555;
}

.btn-toggle-edit.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

/* Bouton modifier sur les cartes */
.edit-card-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    font-family: inherit;
}

.project-card:hover .edit-card-btn {
    opacity: 1;
}

.edit-card-btn:hover {
    background: #333;
    color: white;
    transform: translate(-50%, -50%) scale(1.05);
}

.edit-card-btn svg {
    width: 18px;
    height: 18px;
}

/* Modal de sélection de thumbnail */
.modal-large {
    max-width: 900px;
    width: 95%;
}

.modal-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 25px;
    font-style: italic;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 5px;
}

.thumbnail-option {
    position: relative;
    aspect-ratio: 1/1;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.thumbnail-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumbnail-option:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.thumbnail-option.current {
    border-color: #4CAF50;
}

.thumbnail-option.selected {
    border-color: #333;
}

.thumbnail-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.thumbnail-option.current .thumbnail-check {
    display: flex;
    background: #4CAF50;
}

.thumbnail-option.selected .thumbnail-check {
    display: flex;
    background: #333;
}

/* Bouton supprimer sur les thumbnails */
.thumbnail-delete-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(204, 51, 51, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 5;
}

.thumbnail-delete-btn:hover {
    background: #c33;
    transform: scale(1.1);
}

.thumbnail-delete-btn svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

/* Carte d'upload d'image */
.upload-card {
    position: relative;
    aspect-ratio: 1/1;
    border: 3px dashed #ccc;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.upload-card:hover {
    border-color: #333;
    background: #f0f0f0;
    transform: scale(1.05);
}

.upload-card svg {
    color: #999;
    transition: color 0.3s;
}

.upload-card:hover svg {
    color: #333;
}

.upload-card-text {
    font-size: 13px;
    color: #666;
    text-align: center;
}

.upload-card:hover .upload-card-text {
    color: #333;
}

.upload-card.uploading {
    pointer-events: none;
    opacity: 0.6;
}

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

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

.btn-save {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-save:hover {
    background-color: #45a049;
}

/* Responsive modal */
@media (max-width: 600px) {
    .modal-content {
        padding: 30px 20px;
    }

    .modal-large {
        max-width: 100%;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        max-height: 50vh;
    }

    .modal-actions {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-login,
    .btn-save {
        width: 100%;
    }

    .edit-card-btn {
        opacity: 1;
        font-size: 12px;
        padding: 10px 16px;
    }

    .edit-card-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ===== STYLES POUR CHARGEMENT D'IMAGES ROBUSTE ===== */

/* Conteneur principal pour les images avec gestion de chargement */
.thumbnail-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

/* État : Chargement en cours */
.thumbnail-image-wrapper.thumbnail-loading img {
    opacity: 0;
    visibility: hidden;
}

.thumbnail-image-wrapper.thumbnail-loading .thumbnail-spinner {
    display: block;
}

/* État : Chargement réussi */
.thumbnail-image-wrapper.thumbnail-loaded img {
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.3s ease;
}

.thumbnail-image-wrapper.thumbnail-loaded .thumbnail-spinner {
    display: none;
}

/* État : Erreur de chargement */
.thumbnail-image-wrapper.thumbnail-error img {
    opacity: 0;
    visibility: hidden;
}

.thumbnail-image-wrapper.thumbnail-error .thumbnail-spinner {
    display: none;
}

.thumbnail-image-wrapper.thumbnail-error .thumbnail-error-content {
    display: flex;
}

/* Spinner de chargement */
.thumbnail-spinner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #999;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

/* Contenu d'erreur */
.thumbnail-error-content {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #999;
    text-align: center;
}

.thumbnail-error-content svg {
    color: #ccc;
}

.thumbnail-error-content span {
    font-size: 13px;
    color: #999;
}

/* Animation pour le fade-in */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}