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

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

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

header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    color: #333;
    font-size: 24px;
}

.settings {
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
}

.settings span {
    margin: 0 8px;
}

/* Breadcrumb */
.breadcrumb {
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb-link {
    text-decoration: none;
    color: #667eea;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-current {
    color: #333;
    font-weight: 500;
}

/* Liste des répertoires */
.directory-list {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.directory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.directory-header h2 {
    color: #333;
    border-left: 4px solid #667eea;
    padding-left: 15px;
}

.home-link {
    background: #667eea;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.home-link:hover {
    background: #5a67d8;
}

.directories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.directory-card {
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.directory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.directory-card.has-images {
    background: #e8f5e9;
    border-color: #4caf50;
}

.directory-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    text-decoration: none;
    color: #333;
}

.directory-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.directory-name {
    font-weight: 500;
    text-align: center;
    word-break: break-word;
}

.directory-badge {
    margin-top: 8px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    background: #4caf50;
    color: white;
}

/* Galerie d'images */
.gallery {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.gallery-header h2 {
    color: #333;
    margin: 0;
    word-break: break-word;
}

.image-counter {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

.back-link {
    background: #6c757d;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s ease;
    display: inline-block;
}

.back-link:hover {
    background: #5a6268;
}

.image-grid {
    margin-top: 20px;
}

.image-item {
    text-align: center;
    transition: transform 0.3s ease;
    cursor: pointer;
    position: relative;
}

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

/* Numéro d'ordre */
.image-order {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #667eea;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

.image-link {
    text-decoration: none;
    display: block;
}

.image-item img {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    width: 100%;
    height: auto;
}

.image-caption {
    margin-top: 8px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-name {
    color: #333;
    font-weight: 500;
    word-break: break-all;
}

.image-size {
    color: #666;
    font-size: 10px;
}

.no-directories, .no-images {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 12px;
    color: #666;
}

/* Pagination */
.pagination {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.pagination-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.pagination-btn:hover {
    background: #5a67d8;
}

/* Lightbox améliorée */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

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

.lightbox-image {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-prev, .lightbox-next {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 40px;
    padding: 15px 25px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s ease;
    margin: 0 20px;
}

.lightbox-prev:hover, .lightbox-next:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-caption {
    margin-top: 20px;
    color: white;
    font-size: 16px;
    text-align: center;
}

.lightbox-counter {
    margin-top: 10px;
    color: #ccc;
    font-size: 14px;
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-lightbox:hover {
    color: #ccc;
}

footer {
    margin-top: 30px;
    text-align: center;
    color: white;
    font-size: 12px;
    opacity: 0.8;
    padding: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .settings span {
        display: inline-block;
        margin: 5px;
    }
    
    .directories-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }
    
    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .close-lightbox {
        top: 15px;
        right: 20px;
        font-size: 30px;
    }
    
    .lightbox-prev, .lightbox-next {
        font-size: 25px;
        padding: 10px 15px;
        margin: 0 10px;
    }
    
    .lightbox-image {
        max-width: 90%;
    }
    
    .image-order {
        width: 28px;
        height: 28px;
        font-size: 12px;
        top: -8px;
        left: -8px;
    }
}