/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    color: #4a5568;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.header h1 i {
    color: #667eea;
    margin-right: 0.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}
.brand-logo {
    height: 44px;
    width: auto;
    display: block;
}
.btn-cross {
    background: #1e3c72;
    color: #fff;
}
.btn-cross:hover {
    background: #2a5298;
    color: #fff;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Boutons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Navigation breadcrumb */
.breadcrumb {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 12px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.breadcrumb-item {
    color: #667eea;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.breadcrumb-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.breadcrumb-separator {
    color: #a0aec0;
}

/* Actions du dossier */
.folder-actions {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.file-count {
    color: #718096;
    font-weight: 500;
}

/* Sections */
.folders-section,
.images-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.folders-section h2 {
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

/* Grille des dossiers */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.folder-item {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: #4a5568;
    transition: all 0.3s ease;
    text-align: center;
}

.folder-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.folder-item i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.folder-name {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.folder-count {
    font-size: 0.9rem;
    color: #718096;
}

/* Vue liste des images */
.images-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-item {
    display: flex;
    align-items: center;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.image-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.image-checkbox {
    margin-right: 1rem;
}

.image-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.image-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-preview:hover {
    transform: scale(1.05);
}

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

/* Aperçu PDF : miniature de la 1ʳᵉ page sur fond blanc + badge. */
.pdf-preview {
    position: relative;
    display: block;
    background: #fff;
}
.pdf-preview img {
    object-fit: contain;
    background: #fff;
}
.pdf-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
    background: #d93025;
    border-radius: 4px;
    pointer-events: none;
}

.image-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.image-name {
    font-weight: 600;
    color: #2d3748;
}

.image-meta {
    display: flex;
    gap: 1rem;
    color: #718096;
    font-size: 0.9rem;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Vue grille des images */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.image-item-grid {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-item-grid:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.image-item-grid .image-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 0.25rem;
}

.image-item-grid .image-preview {
    position: relative;
    width: 100%;
    height: 200px;
    cursor: pointer;
}

.image-item-grid .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-item-grid:hover .image-preview img {
    transform: scale(1.05);
}

.image-item-grid .image-name {
    padding: 1rem 1rem 0.5rem;
    font-weight: 600;
    color: #2d3748;
    text-align: center;
    word-break: break-word;
}
.image-actions-grid {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
    margin-top: 0;
}
.image-actions .btn.copied {
    background: #4ade80;
    border-color: #4ade80;
    color: #fff;
}

/* Dossier vide */
.empty-folder {
    text-align: center;
    padding: 3rem;
    color: #718096;
}

.empty-folder i {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 1rem;
}

.empty-folder h3 {
    margin-bottom: 0.5rem;
    color: #4a5568;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    transition: background-color 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

#lightboxImage {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.lightbox-info {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 90%;
}

#lightboxTitle {
    margin-bottom: 1rem;
    font-weight: 600;
}

.lightbox-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.copy-feedback {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: #4ade80;
    font-weight: 600;
}
.copy-feedback[hidden] { display: none; }

/* Slideshow */
.slideshow {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.slideshow.active {
    display: flex;
    opacity: 1;
}

.slideshow-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.slideshow-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    transition: background-color 0.2s ease;
}

.slideshow-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.slideshow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
}

.slideshow-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.slideshow-prev {
    left: 2rem;
}

.slideshow-next {
    right: 2rem;
}

#slideshowImage {
    max-width: 95%;
    max-height: 85%;
    object-fit: contain;
    transition: opacity 0.5s ease;
}

.slideshow-controls {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

#slideshowCounter {
    color: #cbd5e0;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        flex-direction: column;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .folder-actions {
        flex-direction: column;
        text-align: center;
    }
    
    .folders-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .image-item {
        flex-direction: column;
        text-align: center;
    }
    
    .image-preview {
        width: 120px;
        height: 120px;
        margin: 0 0 1rem 0;
    }
    
    .image-meta {
        justify-content: center;
    }
    
    .lightbox-nav,
    .slideshow-nav {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .lightbox-prev,
    .slideshow-prev {
        left: 1rem;
    }
    
    .lightbox-next,
    .slideshow-next {
        right: 1rem;
    }
    
    .lightbox-close,
    .slideshow-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .lightbox-info,
    .slideshow-controls {
        bottom: 1rem;
        padding: 0.75rem 1.5rem;
        max-width: calc(100% - 2rem);
    }
    
    .breadcrumb {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem 0;
    margin-top: 3rem;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.05);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    text-align: center;
}

.footer-copyright {
    color: #4a5568;
    font-size: 0.9rem;
}

.footer-copyright a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-copyright a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.footer-version {
    color: #718096;
    font-size: 0.85rem;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .footer-copyright {
        font-size: 0.85rem;
    }
    
    .footer-version {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }
    
    .footer-copyright {
        font-size: 0.8rem;
        line-height: 1.4;
    }
}
/* ===== Dossiers protégés & vidéos (ajout) ===== */

/* Lecteur vidéo en vue liste */
.image-item.is-video .image-preview {
    width: 280px;
    height: 158px;
    cursor: default;
    background: #000;
}
.image-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}
.image-item-grid.is-video .image-preview {
    cursor: default;
}
.image-name .fa-film {
    color: #764ba2;
    margin-right: 0.25rem;
}

/* Dossier privé (verrouillé) */
.folder-item.folder-locked .fa-lock {
    color: #764ba2;
}
.folder-item.folder-locked {
    border-color: #d6bcfa;
    background: linear-gradient(135deg, #faf5ff 0%, #f7fafc 100%);
}
.folder-item.folder-locked .folder-count {
    color: #764ba2;
    font-weight: 600;
}

/* Carte de connexion (dossier protégé) */
.login-card {
    max-width: 420px;
    margin: 4rem auto;
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.login-icon {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 1rem;
}
.login-card h2 {
    color: #2d3748;
    margin-bottom: 0.5rem;
}
.login-card p {
    color: #718096;
    margin-bottom: 1.5rem;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.login-form input[type="password"] {
    padding: 0.85rem 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}
.login-form input[type="password"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}
.login-error {
    background: #fed7d7;
    color: #c53030;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.login-back {
    display: inline-block;
    color: #718096;
    text-decoration: none;
    font-size: 0.9rem;
}
.login-back:hover {
    color: #667eea;
}

@media (max-width: 480px) {
    .image-item.is-video .image-preview {
        width: 100%;
        height: 180px;
        margin-right: 0;
    }
}

/* --- Fiche « Description du fichier » (lightbox) ----------------------- */
.lightbox-info-toggle {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 5;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}
.lightbox-info-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.file-info-card {
    position: absolute;
    top: 5rem;
    left: 2rem;
    z-index: 6;
    width: 280px;
    max-width: calc(100vw - 4rem);
    background: rgba(20, 20, 28, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.file-info-card.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.file-info-card h4 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #cbd5ff;
}
.file-info-card dl {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.9rem;
    font-size: 0.85rem;
}
.file-info-card dt {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}
.file-info-card dd {
    margin: 0;
    text-align: right;
    word-break: break-word;
}

@media (max-width: 768px) {
    .lightbox-info-toggle {
        top: 1rem;
        left: 1rem;
        width: 40px;
        height: 40px;
    }
    .file-info-card {
        top: 4rem;
        left: 1rem;
        right: 1rem;
        width: auto;
    }
}
