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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Ensure consistent box model */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #fafafa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure no element can cause horizontal overflow */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 20px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    color: #000;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 40px;
    list-style: none;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    font-weight: 400;
    font-size: 15px;
    transition: color 0.3s ease;
    letter-spacing: 0.3px;
}

.nav-links a:hover {
    color: #000;
}

/* Instagram icon */
.instagram-link {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.instagram-link:hover {
    color: #E4405F !important;
    transform: scale(1.1);
}

.instagram-link svg {
    transition: all 0.3s ease;
}

/* Main Content */
main {
    margin-top: 100px;
    max-width: 100%; /* Full width */
    margin-left: auto;
    margin-right: auto;
    padding: 20px 0; /* Only vertical padding */
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal overflow */
    width: 100%;
}

/* Gallery */
.gallery-container {
    width: 100%;
    margin: 0 auto;
    position: relative;
    padding: 0 60px; /* Augmenté pour laisser plus d'espace blanc sur les côtés */
    box-sizing: border-box;
    overflow: hidden;
}

.gallery-actions {
    display: flex;
    justify-content: flex-end; /* Align to the right */
    padding: 20px 0; /* Add some vertical padding */
    margin-bottom: 20px; /* Space between button and gallery grid */
}

.shuffle-button {
    background: #fff;
    color: #333;
    padding: 12px 25px;
    border: 1px solid #e0e0e0;
    border-radius: 25px; /* Pill shape */
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
    -webkit-appearance: none; /* Remove default button styles for consistency */
    -moz-appearance: none;
    appearance: none;
}

.shuffle-button:hover {
    border-color: #d0d0d0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.shuffle-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.gallery-grid {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: visible;
}

.gallery-item {
    position: absolute;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: #fff;
    width: 280px; /* Taille fixe pour un meilleur contrôle */
    height: 350px; /* Ratio 4:5 */
    max-width: calc(100vw - 120px); /* S'assurer qu'elle ne dépasse pas l'écran avec marges */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 6s ease-in-out infinite;
    animation-delay: calc(var(--delay, 0) * 0.5s);
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02) rotate(1deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 10;
    animation-play-state: paused;
}

.gallery-item img {
    width: 100%;
    height: 100%; /* Fill the fixed height of the parent */
    object-fit: cover; /* Ensure images cover the area without distortion */
    transition: transform 0.4s ease;
    display: block;
    /* Protection contre le téléchargement */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Placeholder style for lazy loading */
.gallery-item.placeholder {
    background-color: #f5f5f5; /* Light grey background */
    min-height: 200px; /* Reduced height to minimize vertical scrolling */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Loading indicator animation */
.loading-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000;
    animation: spin 1s infinite linear;
}

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

.gallery-item:hover img {
    transform: scale(1.03);
}


/* About Page */
.about-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 40px;
    text-align: center;
}

.profile-image {
    width: 200px;
    height: 250px;
    border-radius: 20px;
    object-fit: cover;
    object-position: center;
    margin: 0 auto 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.about-container h1 {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #000;
    letter-spacing: -1px;
}

.about-container p {
    font-size: 18px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 30px;
    font-weight: 300;
    text-align: justify;
    text-justify: inter-word;
}

/* Contact Page */
.contact-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 40px;
}

.contact-container h1 {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 40px;
    text-align: center;
    color: #000;
    letter-spacing: -1px;
}

.contact-form {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background: #fafafa;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #000;
    background: #fff;
}

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

.submit-btn {
    background: #000;
    color: #fff;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    letter-spacing: 0.3px;
}

.submit-btn:hover {
    background: #333;
    transform: translateY(-2px);
}

/* Animations pour le formulaire de contact */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.form-message.success {
    animation: successPulse 0.6s ease-in-out;
}

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

.submit-btn.sending {
    position: relative;
    color: transparent;
}

.submit-btn.sending::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.back-to-top:hover {
    background: #333;
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.back-to-top.show {
    display: flex;
}

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

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.lightbox img {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 2001;
}

.lightbox-close:hover {
    opacity: 0.7;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 20px;
    }
    
    .nav-links {
        gap: 20px;
    }
    
    main {
        padding: 20px 0;
        margin-top: 80px;
        max-width: 100%;
    }
    
    .gallery-container {
        padding: 0 40px; /* Marges augmentées pour mobile */
    }
    
    .gallery-item {
        width: 200px; /* Plus petit sur mobile */
        height: 250px; /* Maintenir le ratio */
        max-width: calc(100vw - 80px); /* S'assurer qu'elle ne dépasse pas */
    }
    
    .about-container,
    .contact-container {
        padding: 40px 20px;
    }
    
    .about-container h1,
    .contact-container h1 {
        font-size: 36px;
    }
    
    .contact-form {
        padding: 30px 20px;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(5px, 10px) rotate(0.5deg);
    }
    50% {
        transform: translate(0, 0) rotate(0deg);
    }
    75% {
        transform: translate(-5px, 10px) rotate(-0.5deg);
    }
    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}
@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }
    
    .nav-links a {
        font-size: 14px;
    }
    
    .about-container h1,
    .contact-container h1 {
        font-size: 28px;
    }
    
    .profile-image {
        width: 150px;
        height: 150px;
    }
    
    .gallery-container {
        padding: 0 20px; /* Marges minimales */
    }
    
    .gallery-item {
        width: 160px; /* Encore plus petit sur très petits écrans */
        height: 200px;
        max-width: calc(100vw - 40px); /* S'assurer qu'elle ne dépasse pas */
    }
}


/* Admin Gallery Grid Styles (for both manage and upload preview) */
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* Adjust for 8 images per line */
    gap: 10px; /* Smaller gap for denser grid */
    padding: 20px 0;
    position: static; /* Override absolute positioning from .gallery-grid */
    min-height: auto; /* Override min-height from .gallery-grid */
}

.admin-gallery-grid .image-item {
    position: static; /* Override absolute positioning */
    width: auto; /* Allow grid to control width */
    transform: none !important; /* Remove scattered layout transforms */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Lighter shadow for admin */
    transition: none; /* Remove hover transition */
}

.admin-gallery-grid .image-item:hover {
    transform: none !important; /* Ensure no transform on hover */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.admin-gallery-grid .image-item img {
    width: 100%;
    height: 100px; /* Fixed height for uniform size */
    object-fit: cover;
    border-radius: 4px;
}
