/* ===== RESET ET VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Thème clair */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e0e0e0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #dddddd;
    --accent-color: #4a6bff;
    --accent-hover: #3a5bef;
    --shadow: rgba(0, 0, 0, 0.1);
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* Thème sombre */
.theme-dark {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #404040;
    --accent-color: #6a8bff;
    --accent-hover: #5a7bef;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* ===== BASE ===== */
html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ===== HEADER ===== */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow);
}

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

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-toggle {
    display: flex;
    gap: var(--spacing-sm);
}

.theme-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn:hover {
    background: var(--accent-color);
    color: white;
}

.theme-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 0 2px var(--accent-color)40;
}

/* ===== MAIN LAYOUT ===== */
.main {
    padding: var(--spacing-lg) 0;
}

.gallery-layout {
    display: flex;
    gap: var(--spacing-lg);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    box-shadow: 0 2px 10px var(--shadow);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.image-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.image-thumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: var(--bg-tertiary);
    cursor: pointer;
    border: 2px solid transparent;
}

.image-thumb:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.image-thumb.active {
    border-color: var(--accent-color);
    background: rgba(74, 107, 255, 0.1);
}

.image-thumb img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--border-radius);
    flex-shrink: 0;
}

.image-thumb .image-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-thumb .comment-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 10px;
}

.no-images {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--spacing-md);
}

/* ===== CONTENT ===== */
.content {
    flex: 1;
    min-width: 0;
}

.image-viewer {
    position: relative;
    margin-bottom: var(--spacing-xl);
}

.image-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: 0 2px 10px var(--shadow);
    text-align: center;
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.main-image {
    max-width: 100%;
    max-height: calc(100vh - 250px);
    object-fit: contain;
    border-radius: var(--border-radius);
    cursor: pointer;
}

/* Navigation entre images */
.image-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none;
}

.nav-arrow {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    margin: 0 20px;
}

.nav-arrow:hover {
    background: rgba(74, 107, 255, 0.8);
    transform: scale(1.1);
}

.image-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

/* ===== COMMENTS SECTION ===== */
.comments-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: 0 2px 10px var(--shadow);
}

.comments-section h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.comment-form {
    margin-bottom: var(--spacing-xl);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(74, 107, 255, 0.2);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.char-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: var(--spacing-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 107, 255, 0.3);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.comment {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.comment-author {
    font-weight: 600;
    color: var(--accent-color);
}

.comment-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.comment-text {
    color: var(--text-primary);
    line-height: 1.6;
}

.no-comments {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--spacing-lg);
}

.empty-gallery {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.empty-gallery i {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-gallery h2 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.empty-gallery code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
    text-align: center;
    margin-top: var(--spacing-xl);
}

.footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: var(--spacing-lg);
    left: var(--spacing-lg);
    background: var(--accent-color);
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 107, 255, 0.3);
    z-index: 1000;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .gallery-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        max-height: none;
    }
    .image-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--spacing-md);
    }
    .image-thumb {
        flex-direction: column;
        text-align: center;
        width: calc(20% - var(--spacing-md));
        min-width: 100px;
    }
    .image-thumb img {
        width: 100%;
        height: 80px;
    }
    .main-image {
        max-height: 600px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        bottom: 0;
        z-index: 1001;
        transition: var(--transition);
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .sidebar > h2 {
        flex-shrink: 0;
        padding: var(--spacing-md);
        margin: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .image-list {
        flex: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .image-thumb {
        flex-direction: row;
        width: 100%;
    }

    .image-thumb img {
        width: 50px;
        height: 50px;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .main.sidebar-open {
        overflow: hidden;
    }

    .image-navigation {
        top: auto;
        bottom: -50px;
        transform: none;
        justify-content: center;
        gap: var(--spacing-lg);
    }

    .nav-arrow {
        margin: 0;
    }

    .main-image {
        max-height: 400px;
    }

    .header .container,
    .container {
        padding: 0 var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    .header h1 {
        font-size: 1.25rem;
    }
    .image-container {
        padding: var(--spacing-md);
    }
    .comments-section {
        padding: var(--spacing-md);
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .theme-toggle {
        gap: 4px;
    }
    .theme-btn {
        width: 36px;
        height: 36px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.comment {
    animation: fadeIn 0.3s ease;
}





/* Style pour le titre cliquable */
.fullscreen-toggle {
    cursor: pointer;
    user-select: none; /* Empêche la sélection du texte */
}

/* Icône plein écran (optionnel) */
.fullscreen-toggle::after {
    content: " 📱";
    font-size: 0.8em;
    opacity: 0.7;
}

@media (min-width: 769px) {
    .fullscreen-toggle {
        cursor: default; /* Désactive le curseur "pointer" sur PC */
    }
    .fullscreen-toggle::after {
        content: none; /* Masque l'icône sur PC */
    }
}