* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

:root {
    --primary-color: #0ea5e9;
    --accent-color: #f97316;
    --bg-light: #f8fafc;
    --bg-dark: #0f172a;
    --text-light: #1e293b;
    --text-dark: #f1f5f9;
}

body {
    background: linear-gradient(135deg, var(--bg-light) 0%, #e2e8f0 100%), url('https://www.transparenttextures.com/patterns/light-wool.png');
    background-blend-mode: overlay;
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
    transition: background 0.3s ease;
}

body.dark-mode {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e293b 100%);
    color: var(--text-dark);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.1) 0%, transparent 70%);
    z-index: -1;
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    transition: opacity 0.5s ease;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-circle {
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-color);
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Header */
header {
    position: sticky;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

body.dark-mode header {
    background: rgba(15, 23, 42, 0.95);
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--text-light);
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
    will-change: transform;
}

body.dark-mode header h1 {
    color: var(--text-dark);
}

@keyframes glow {
    from { text-shadow: 0 0 5px rgba(249, 115, 22, 0.2); }
    to { text-shadow: 0 0 15px rgba(249, 115, 22, 0.4); }
}

.menu-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.menu-links a {
    text-decoration: none;
    color: #fff;
    font-weight: 500;
    font-size: 1rem;
    padding: 10px 20px;
    background: var(--primary-color);
    border-radius: 25px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    position: relative;
    overflow: hidden;
}

.menu-links a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.menu-links a:hover::before,
.menu-links a:focus::before {
    width: 300px;
    height: 300px;
}

.menu-links a:hover,
.menu-links a:focus {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

#theme-toggle {
    background: var(--accent-color);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

#theme-toggle:hover {
    transform: scale(1.2) rotate(15deg);
}

/* Hero Carousel */
.hero {
    width: 100%;
    height: 35vh;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.hero-track {
    display: flex;
    height: 100%;
    will-change: transform;
}

.hero-item {
    min-width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.hero-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.85);
}

.hero-caption {
    position: absolute;
    bottom: 10px;
    left: 15px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 3px;
}

.hero-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.4rem;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

body.dark-mode .hero-arrow {
    background: var(--accent-color);
}

.hero-arrow:hover,
.hero-arrow:focus {
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

.hero-left { left: 15px; }
.hero-right { right: 15px; }

/* Filter Menu */
.filter-menu {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 40px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 900;
    border-bottom: 1px solid rgba(249, 115, 22, 0.3);
}

body.dark-mode .filter-menu {
    background: rgba(15, 23, 42, 0.95);
}

.filter-item {
    background: var(--primary-color);
    border: none;
    color: #fff;
    font-size: 1rem;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    position: relative;
    overflow: hidden;
}

body.dark-mode .filter-item {
    background: var(--accent-color);
}

.filter-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.filter-item:hover::before,
.filter-item:focus::before {
    width: 300px;
    height: 300px;
}

.filter-item:hover,
.filter-item:focus {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

.filter-item.active {
    background: var(--accent-color);
    font-weight: 700;
    transform: scale(1.15);
}

body.dark-mode .filter-item.active {
    background: var(--primary-color);
}

/* Gallery */
main {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

body.dark-mode main {
    background: rgba(15, 23, 42, 0.9);
}

.category {
    margin-bottom: 40px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.category.hidden {
    opacity: 0;
    transform: translateY(20px);
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.category-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    position: relative;
}

body.dark-mode .category-title {
    color: var(--text-dark);
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.category-title:hover::after {
    width: 80px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.photo-card {
    position: relative;
    height: 200px;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    will-change: transform, box-shadow;
}

.photo-card:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 6px 18px rgba(249, 115, 22, 0.3);
}

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

.photo-card:hover img {
    transform: scale(1.1);
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

body.dark-mode .photo-overlay {
    background: rgba(15, 23, 42, 0.7);
}

.photo-card:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay span {
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
}

body.dark-mode .photo-overlay span {
    color: var(--text-dark);
}

/* Viewer */
.viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.viewer.active {
    opacity: 1;
    pointer-events: auto;
}

.viewer-image-container {
    width: 90%;
    height: 80%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.viewer-image-container img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    animation: fadeIn 0.5s ease;
    will-change: transform;
    transition: transform 0.2s ease;
    cursor: grab;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.viewer-caption {
    position: absolute;
    bottom: 20px;
    color: #fff;
    font-size: 1.5rem;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

.viewer-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-color);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
    z-index: 2100;
}

.viewer-close:hover,
.viewer-close:focus {
    transform: scale(1.2) rotate(45deg);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

.viewer-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 18px;
    font-size: 1.8rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    z-index: 2100;
}

.viewer-arrow:hover,
.viewer-arrow:focus {
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

.viewer-zoom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 150px;
    background: var(--primary-color);
    border-radius: 25px;
    padding: 5px;
    cursor: pointer;
    z-index: 2100;
    -webkit-appearance: none;
    appearance: none;
}

.viewer-zoom::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.viewer-zoom::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
}

.viewer-zoom::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.viewer-zoom::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    background: var(--bg-light);
    color: var(--text-light);
    margin-top: 40px;
    border-top: 1px solid rgba(249, 115, 22, 0.3);
}

body.dark-mode footer {
    background: var(--bg-dark);
    color: var(--text-dark);
}

/* Responsive Design */
@media (max-width: 768px) {
    header { padding: 10px 20px; flex-direction: column; }
    header h1 { font-size: 1.8rem; }
    .menu-links { gap: 10px; margin-top: 10px; }
    .menu-links a { font-size: 0.9rem; padding: 8px 16px; }
    .hero { height: 25vh; }
    .hero-caption { font-size: 1rem; }
    .hero-arrow { padding: 8px 12px; font-size: 1.2rem; }
    .filter-menu { padding: 10px 20px; gap: 8px; }
    .filter-item { padding: 8px 20px; }
    .photo-card { height: 160px; }
    .viewer-image-container { height: 70%; }
    .photo-overlay span { font-size: 1rem; }
    main { padding: 20px; }
    .viewer-zoom { width: 100px; bottom: 15px; right: 15px; }
    .zoom-controls { bottom: 15px; left: 15px; }
    .zoom-btn { width: 40px; height: 40px; font-size: 1.2rem; }
}

/* Boutons de zoom améliorés */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 2100;
}

.zoom-btn {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    user-select: none;
}

.zoom-btn:hover {
    transform: scale(1.1);
    background: var(--accent-color);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-btn.zoom-reset {
    background: #6b7280;
}

.zoom-btn.zoom-reset:hover {
    background: #4b5563;
}

/* Amélioration du slider de zoom */
.viewer-zoom {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Animation fluide pour les transformations */
.viewer-image-container img {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* Indicateur de zoom */
.zoom-level-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2100;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}