@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #222222;
    --bg-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-color: #333333;
    --accent: #ffffff;
    --accent-teal: #4a9b9b;
    --shadow: rgba(0, 0, 0, 0.3);
}


body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(ellipse at 15% 85%, rgba(139, 110, 92, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 85% 15%, rgba(160, 134, 115, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 30%, rgba(101, 84, 76, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse at 30% 70%, rgba(187, 164, 140, 0.05) 0%, transparent 50%),
        linear-gradient(145deg, rgba(218, 198, 175, 0.03) 0%, rgba(195, 176, 157, 0.02) 100%);
    color: var(--text-primary);
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    text-align: center;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.header h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    letter-spacing: -0.01em;
}

.header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}




/* Filter container */
.filter-container {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.2rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.8rem;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    padding: 0.5rem 1rem;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}


/* Search - Nouvelle version simple et efficace */
.search-container {
    margin-left: 1rem;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    background: var(--bg-hover);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-input.has-text + .search-icon {
    display: none;
}

.search-input.has-text ~ .search-clear {
    display: flex;
}

/* Refresh Button */
.refresh-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.refresh-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-teal);
    transform: translateY(-1px);
}

.refresh-btn.refreshing {
    color: var(--accent-teal);
    pointer-events: none;
}

.refresh-btn.refreshing svg {
    animation: refresh-spin 1s linear infinite;
}

@keyframes refresh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.refresh-btn svg {
    width: 18px;
    height: 18px;
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    padding: 1.5rem 1rem 1rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.photo-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.photo-card.vertical {
    grid-column: span 1;
}

.photo-card.horizontal {
    grid-column: span 1;
}

/* Pour permettre 3 photos par ligne si elles sont verticales */
@media (min-width: 1200px) {
    .gallery {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .photo-card.vertical {
        grid-column: span 1;
    }
    
    .photo-card.horizontal {
        grid-column: span 1;
    }
}

.photo-container {
    position: relative;
    height: 320px;
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: pointer;
}

.photo-container.vertical {
    height: 380px;
}

.photo-container.horizontal {
    height: 280px;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    pointer-events: none;
    -webkit-user-drag: none;
    cursor: pointer;
}

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

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 100%);
}

.photo-info {
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.photo-content {
    flex-grow: 1;
}

.photo-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.photo-category {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.photo-id {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
}

.photo-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.photo-description {
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.3;
    margin-bottom: 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

.photo-card:hover .photo-description {
    -webkit-line-clamp: unset;
    overflow: visible;
    display: block;
}

.photo-specs {
    display: flex;
    gap: 0.15rem;
    flex-wrap: wrap;
    align-items: flex-start;
    line-height: 1;
    margin-top: auto;
}

.spec-tag {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 0.1rem 0.25rem;
    border-radius: 2px;
    font-size: 0.55rem;
    font-weight: 500;
    white-space: nowrap;
    margin: 0;
    line-height: 1.2;
}

/* Protection */
.protection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: pointer;
}

.watermark {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.8);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-family: monospace;
    pointer-events: none;
    z-index: 11;
}

/* Status bar */
.status-bar {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    box-shadow: 0 2px 8px var(--shadow);
    z-index: 1000;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    margin-top: 3rem;
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.footer p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--text-primary);
}

.copyright {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.footer-divider {
    display: inline-block;
    margin: 0 0.5rem;
    color: var(--text-muted);
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--text-secondary);
}

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

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

/* Animations */
.photo-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading indicator for infinite scroll */
.loading-more {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading-more .loader {
    width: 30px;
    height: 30px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mobile filter toggle */
.filter-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.filter-toggle:hover {
    background: var(--bg-hover);
}

.filter-toggle svg {
    width: 16px;
    height: 16px;
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.filter-toggle.active svg {
    transform: rotate(180deg);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: none !important;
    }
    
    body {
        data-theme: dark !important;
    }
    
    .header {
        padding: 0.8rem 0.5rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .header p {
        font-size: 0.8rem;
    }
    
    .filter-container {
        padding: 0.5rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .filters {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .filter-buttons {
        display: none;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .filter-buttons.show {
        display: grid;
    }
    
    .filter-btn {
        padding: 0.5rem 0.4rem;
        font-size: 0.7rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .search-container {
        width: 100%;
        margin: 0;
        display: flex;
        justify-content: center;
    }
    
    .search-wrapper {
        width: 100%;
        max-width: 300px;
    }
    
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        padding: 0.8rem;
    }
    
    .photo-container {
        height: 200px;
    }
    
    .photo-container.vertical {
        height: 240px;
    }
    
    .photo-container.horizontal {
        height: 180px;
    }
    
    .photo-info {
        padding: 0.4rem;
    }
    
    .photo-title {
        font-size: 0.8rem;
        margin-bottom: 0.2rem;
    }
    
    .photo-description {
        font-size: 0.65rem;
        margin-bottom: 0.3rem;
        line-height: 1.2;
    }
    
    .photo-specs {
        gap: 0.15rem;
    }
    
    .spec-tag {
        font-size: 0.5rem;
        padding: 0.1rem 0.25rem;
    }
    
    .photo-meta {
        margin-bottom: 0.3rem;
    }
    
    .photo-category,
    .photo-id {
        font-size: 0.55rem;
    }
    
    .status-bar {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }

    .footer {
        padding: 1.5rem 0.5rem;
        margin-top: 2rem;
    }

    .footer-links {
        gap: 1rem;
    }

    .footer-link {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.6rem 0.3rem;
    }
    
    .filter-container {
        padding: 0.4rem 0.3rem;
    }
    
    .filters {
        gap: 0.6rem;
    }
    
    .filter-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .filter-buttons.show {
        display: grid;
    }
    
    .filter-btn {
        padding: 0.4rem 0.3rem;
        font-size: 0.65rem;
    }
    
    .search-wrapper {
        max-width: 250px;
    }
    
    .gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.8rem 0.5rem;
    }
    
    .photo-container {
        height: 280px;
    }
    
    .photo-container.vertical {
        height: 350px;
    }
    
    .photo-container.horizontal {
        height: 240px;
    }
    
    .photo-info {
        padding: 0.4rem;
    }
    
    .photo-title {
        font-size: 0.75rem;
    }
    
    .photo-description {
        font-size: 0.6rem;
    }
    
    .spec-tag {
        font-size: 0.5rem;
        padding: 0.08rem 0.2rem;
    }

    .footer {
        padding: 1rem 0.3rem;
        margin-top: 1.5rem;
    }

    .footer h3 {
        font-size: 1rem;
    }

    .footer p,
    .footer-link {
        font-size: 0.75rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Lightbox supprimée - maintenant on utilise la page taille originale */

/* Zoom functionality for photo view page */
.photo-view-image-container {
    cursor: zoom-in;
}

.photo-view-image-container.zoomed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.3s ease;
}

.photo-view-image-container.zoomed .photo-view-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    cursor: zoom-out;
}

/* Photo view page */
.photo-view-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.photo-view-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-btn:hover {
    color: var(--accent);
}

.back-btn svg {
    width: 18px;
    height: 18px;
}

.photo-view-actions {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.nav-btn svg {
    width: 18px;
    height: 18px;
}

.fullsize-btn {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.fullsize-btn:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.photo-view-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.photo-view-image-container {
    position: relative;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0;
}

.photo-view-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px var(--shadow);
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.photo-view-watermark {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: monospace;
    pointer-events: none;
    z-index: 10;
}

.photo-view-protection {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: default;
}

.photo-view-info {
    max-width: 800px;
    text-align: center;
    color: var(--text-primary);
}

.photo-view-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.photo-view-category {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.photo-view-id {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    padding: 0.4rem 0.8rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.photo-view-title-section {
    text-align: center;
    margin-bottom: 0;
    padding: 0 2rem;
}

.photo-view-title {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.photo-view-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.photo-view-specs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.photo-view-specs .spec-tag {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Mobile optimizations pour photo view */
@media (max-width: 768px) {
    .photo-view-header {
        padding: 0.8rem;
    }
    
    .photo-view-nav {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .photo-view-actions {
        justify-content: center;
    }
    
    .photo-view-container {
        padding: 1.5rem 0.8rem;
        gap: 1.5rem;
    }
    
    .photo-view-image {
        max-height: 60vh;
        border-radius: 8px;
    }
    
    .photo-view-watermark {
        bottom: 8px;
        right: 8px;
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .photo-view-title-section {
        margin-bottom: 0;
        padding: 0 1rem;
    }
    
    .photo-view-title {
        font-size: 1.5rem;
    }
    
    .photo-view-description {
        font-size: 1rem;
    }
    
    .photo-view-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .back-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .photo-view-container {
        padding: 1rem 0.5rem;
    }
    
    .photo-view-image {
        max-height: 50vh;
        border-radius: 6px;
    }
    
    .photo-view-title-section {
        margin-bottom: 0;
        padding: 0 0.5rem;
    }
    
    .photo-view-title {
        font-size: 1.3rem;
    }
    
    .photo-view-description {
        font-size: 0.9rem;
    }
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}