* {
    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;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mode-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: bold;
}

.mode-read {
    background: #28a745;
    color: white;
}

.mode-edit {
    background: #ff9800;
    color: white;
}

/* Formulaire code */
.code-form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.code-form {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.code-form h2 {
    margin-bottom: 15px;
    color: #333;
}

.code-form p {
    margin-bottom: 20px;
    color: #666;
}

.code-input {
    font-size: 24px;
    padding: 12px 20px;
    text-align: center;
    letter-spacing: 5px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    width: 150px;
}

.btn-validate-code, .btn-cancel-code {
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn-validate-code {
    background: #28a745;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-cancel-code {
    background: #6c757d;
    color: white;
}

/* Message */
.message {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* 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-current {
    color: #333;
    font-weight: 500;
}

/* 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;
}

.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;
}


.directory-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
}


/* Stats Bar */
.stats-bar {
    background: white;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-icon {
    font-size: 20px;
}

.stat-value {
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

.stat-label {
    color: #666;
    font-size: 13px;
}


.stat-mini {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.stat-mini .stat-icon {
    font-size: 14px;
}

.stat-mini .stat-value {
    font-size: 14px;
}


/* Galerie */
.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;
}

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

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

.back-link, .home-link, .mode-switch {
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.back-link {
    background: #6c757d;
    color: white;
}

.home-link {
    background: #667eea;
    color: white;
}

.mode-switch {
    background: #ff9800;
    color: white;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

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

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

.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-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;
}

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

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

/* Mode Édition */
.edit-mode .image-item {
    cursor: pointer;
}

.edit-mode .image-item.selected {
    background: rgba(255, 152, 0, 0.1);
    border-radius: 10px;
    padding: 5px;
}

.selection-checkbox {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 15;
}

.selection-checkbox input {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.edit-toolbar {
    background: #fff3e0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.selection-controls, .action-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.selection-count {
    background: #ff9800;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.btn-select-all, .btn-select-none, .btn-delete, .btn-copy, .btn-move {
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-select-all {
    background: #28a745;
    color: white;
}

.btn-select-none {
    background: #6c757d;
    color: white;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-copy {
    background: #17a2b8;
    color: white;
}

.btn-move {
    background: #ffc107;
    color: #333;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: auto;
    padding: 25px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.directory-tree-modal {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
}

.tree-list {
    list-style: none;
    margin-left: 0;
}

.tree-list li {
    margin: 5px 0;
}

.tree-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.tree-item:hover {
    background: #f0f0f0;
}

.tree-item.selected {
    background: #e3f2fd;
}

.selected-indicator {
    color: #4caf50;
    font-weight: bold;
    margin-left: auto;
}

.tree-children {
    margin-left: 25px;
}

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

.btn-cancel, .btn-validate {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-validate {
    background: #28a745;
    color: white;
}

/* Mode selector */
.mode-selector {
    margin-top: 20px;
    text-align: center;
}

.btn-edit-mode {
    display: inline-block;
    background: #ff9800;
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s ease;
}

.btn-edit-mode:hover {
    background: #e68900;
}

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

.lightbox-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lightbox-image {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 8px;
}

.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;
}

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

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

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

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

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

/* Responsive */
@media (max-width: 1200px) {
    .image-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .directories-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .edit-toolbar {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: 1fr;
    }
    
    .lightbox-prev, .lightbox-next {
        font-size: 25px;
        padding: 10px 15px;
    }
}

/* Mode Transfert */
.transfer-mode {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.transfer-header h2 {
    color: #333;
    border-left: 4px solid #ff9800;
    padding-left: 15px;
}

.mode-switch-edit {
    background: #ff9800;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
}

.mode-switch-transfer {
    background: #17a2b8;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
}

.transfer-form {
    margin-top: 20px;
}

.transfer-sources {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.source-section, .target-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.source-section h3, .target-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.current-path {
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    word-break: break-all;
}

.back-link-small {
    display: inline-block;
    margin-bottom: 15px;
    color: #667eea;
    text-decoration: none;
}

.back-link-small:hover {
    text-decoration: underline;
}

.source-selection, .target-selection {
    margin-top: 15px;
}

.source-selection label, .target-selection label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.source-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

.target-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

.transfer-stats {
    background: #e3f2fd;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.transfer-stats h3 {
    margin-bottom: 10px;
    color: #0d47a1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    padding: 10px;
    background: white;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.stat-item.success {
    color: #28a745;
}

.stat-item.warning {
    color: #ffc107;
}

.stat-item.error {
    color: #dc3545;
}

.transfer-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-transfer {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-transfer:hover {
    background: #138496;
}

.btn-scroll-top {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-scroll-top:hover {
    background: #5a6268;
}

.btn-switch-mode {
    background: #28a745;
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s ease;
}

.btn-switch-mode:hover {
    background: #218838;
}

/* Conflits */
.conflict-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.conflict-warning h3 {
    color: #856404;
    margin-bottom: 10px;
}

.conflict-warning p {
    color: #856404;
    margin-bottom: 15px;
}

.conflict-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-overwrite {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-skip {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.conflict-list {
    max-height: 200px;
    overflow-y: auto;
}

.conflict-item {
    padding: 5px 10px;
    background: white;
    margin: 3px 0;
    border-radius: 4px;
    font-size: 13px;
}

/* Bottom actions */
.bottom-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 992px) {
    .transfer-sources {
        grid-template-columns: 1fr;
    }
}

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .transfer-actions {
        flex-direction: column;
        align-items: center;
    }
}