/* ============================================
   REFERENCES PAGE STYLES
   Inspired by Reynaers Project Gallery
   ============================================ */

/* Sidebar Glassmorphism Fix for White Background */
@media (min-width: 1025px) {
    .sidebar-nav {
        /* overflow: hidden; - Removed to allow scrolling on hover */
        border-right: 1px solid #d1d5db !important;
        background: transparent !important;
        backdrop-filter: none !important;
    }

    /* Fond de la sidebar (Image au choix) */
    .sidebar-nav::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        /* CHOIX DE LA PHOTO ICI */
        background-image: url('assets/hero_image/sidebar-ref-bg.webp');
        background-size: cover;
        background-position: left center;
        z-index: -1;
        /* Derrière le contenu */
        opacity: 0.7;
        /* Opacité du fond */
        filter: blur(25px);
        /* Intensité du flou */
        transform: scale(1.1);
        /* Évite les bords blancs du flou */
    }

    /* On s'assure que tout le contenu est bien au-dessus */
    .sidebar-nav>* {
        position: relative;
        z-index: 10;
    }
}

/* Hero Section */
.references-hero {
    position: relative;
    padding: 4rem 0 0.5rem 0;
    /* Reduced bottom padding to bring grid closer */
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 250px;
    overflow: hidden;
}

.hero-overlay {
    display: none;
    /* Removed the dark overlay */
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #1a2332;
    /* Dark text on white bg */
    max-width: 1100px;
    padding: 0 1rem;
}

.hero-subtitle {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #3498db;
    margin-bottom: 1rem;
    padding: 0.6rem 1.8rem;
    background: rgba(52, 152, 219, 0.08);
    border-radius: 30px;
}

.hero-content h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 4.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    color: #1a2332;
    letter-spacing: -1px;
}

.gradient-text {
    background: linear-gradient(90deg, #1e5799 0%, #3498db 50%, #7db9e8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    /* Fixed compatibility lint warning */
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero-content p {
    font-size: 1.4rem;
    line-height: 1.5;
    color: #666e7a;
    max-width: 800px;
    margin: 0 auto 2rem auto;
    font-weight: 400;
}

.hero-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

.btn-hero-primary {
    padding: 1.1rem 2.8rem;
    /* Restored larger buttons */
    background: #1e5799;
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30, 87, 153, 0.3);
}

.btn-hero-primary:hover {
    background: #3498db;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.btn-hero-secondary {
    padding: 1.1rem 2.8rem;
    background: white;
    color: #1a2332;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.btn-hero-secondary:hover {
    background: #f8f9fa;
    border-color: #3498db;
    color: #3498db;
    transform: translateY(-3px);
}

/* Filter Section */
.filter-section {
    padding: 0.5rem 0 1.5rem 0;
    /* Reduced bottom padding */
    margin-left: 250px;
    border-bottom: 1px solid #e0e0e0;
    margin-top: 0 !important;
    /* Reset global margin-top from style.css */
}

.filter-header {
    margin-bottom: 1.5rem;
}

.filter-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a2332;
    margin: 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label i {
    color: #3498db;
}

.filter-group select {
    padding: 0.9rem 1.2rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-group select:hover {
    border-color: #3498db;
}

.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-reset-filters {
    padding: 0.9rem 2rem;
    background: #1a2332;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-reset-filters:hover {
    background: #2d3e50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 35, 50, 0.2);
}

/* Projects Grid Section */
.projects-grid-section {
    padding: 2rem 0 4rem 0;
    /* Small spacing below buttons */
    margin-left: 250px;
    background: white;
    margin-top: 0 !important;
}

.projects-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 2rem;
    padding: 0 2rem;
}

.projects-count span {
    color: #3498db;
    font-size: 1.3rem;
    font-weight: 700;
}

/* Masonry Grid Layout (Reynaers Style) */
.projects-masonry {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding: 0 2rem;
}

.project-card {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Featured projects (larger cards REMOVED for 4-column layout) */
.project-card.featured {
    grid-column: auto;
}

.project-card-image {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.project-card.featured .project-card-image {
    height: 300px;
}

.project-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-orientation: from-image;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .project-card-image img {
    transform: scale(1.08);
}


.project-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(26, 35, 50, 0.9) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-card:hover .project-card-overlay {
    opacity: 1;
}

.project-card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(52, 152, 219, 0.95);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 2;
}

.project-card-info-simple {
    padding: 1.2rem;
    background: white;
    text-align: center;
    border-top: 1px solid #f0f4f8;
}

.project-card-info-simple h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a2332;
    margin: 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.project-card:hover .project-card-info-simple h4 {
    color: #003580;
}

.project-card-action {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3;
}

.project-card:hover .project-card-action {
    opacity: 1;
    transform: scale(1);
}

.project-card-action i {
    color: #3498db;
    font-size: 1.2rem;
}

.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 10000;
    padding: 2rem;
    touch-action: none;
}

.lightbox-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row; /* Sibling items side-by-side */
    gap: 4rem;
    padding: 2rem 2rem 2rem 8rem; /* Extra padding on the left to make room for vertical thumbnails */
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-close:hover {
    background: white;
    color: #1a2332;
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-nav:hover {
    background: white;
    color: #1a2332;
}

.lightbox-prev {
    left: 9rem; /* Positioned to the right of the vertical thumbnails list */
}

.lightbox-next {
    right: 2rem;
}

.lightbox-content {
    max-width: 75%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    order: 2; /* Displays on the right */
    padding-top: 4rem; /* Safe zone to prevent overlap with the top-aligned absolute title */
    touch-action: none;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh; /* Enlarged photo display now that bottom text is moved */
    object-fit: contain;
    image-orientation: from-image;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    touch-action: none;
}

.lightbox-info {
    position: absolute;
    top: 2rem;
    left: 18rem; /* Elegantly sits at the top-left next to vertical thumbnails */
    text-align: left;
    color: white;
    max-width: calc(100% - 30rem); /* Safe bounds to prevent stretching or overlapping close button */
    z-index: 10001;
}

.lightbox-info h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lightbox-info p {
    font-size: 1rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
    margin: 5px 0 0 0;
}

.lightbox-thumbnails {
    display: flex;
    flex-direction: column; /* Stacks thumbnails vertically */
    gap: 1rem;
    max-height: 75vh;
    overflow-y: auto;
    padding: 0.5rem;
    order: 1; /* Displays on the left */
    width: 90px;
    flex-shrink: 0; /* Prevent shrinking */
    
    /* Thin custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Webkit scrollbar stylings */
.lightbox-thumbnails::-webkit-scrollbar {
    width: 4px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.lightbox-thumbnail {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    flex-shrink: 0;
}

.lightbox-thumbnail:hover,
.lightbox-thumbnail.active {
    opacity: 1;
    border-color: #3498db;
}

.lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-orientation: from-image;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .projects-masonry {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1100px) {
    .projects-masonry {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .references-hero,
    .filter-section,
    .projects-grid-section {
        margin-left: 0;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .projects-masonry {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0 1rem;
    }

    .project-card-image {
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
    }

    .project-card.featured .project-card-image {
        height: auto !important;
    }

    .project-card-info-simple {
        padding: 0.8rem;
    }

    .project-card-info-simple h4 {
        font-size: 0.95rem;
    }

    /* Lightbox Mobile Android-Style Overlay */
    .lightbox-modal.active {
        display: block; /* Disable vertical stacking layout */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        background: #000000;
        z-index: 10000;
    }

    .lightbox-content {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1;
        padding: 0;
        margin: 0;
    }

    .lightbox-content img {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        border-radius: 0;
        box-shadow: none;
    }

    .lightbox-thumbnails {
        position: absolute;
        bottom: 25px; /* Floating over the bottom area */
        left: 0;
        width: 100%;
        z-index: 10;
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        max-height: 80px;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: safe center;
        padding: 0.5rem;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        -webkit-overflow-scrolling: touch;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .lightbox-thumbnail {
        width: 50px;
        height: 50px;
        flex-shrink: 0;
        border-radius: 6px;
        border: 2px solid transparent;
        padding: 0;
    }

    .lightbox-thumbnail.active {
        border-color: #3498db;
    }

    .lightbox-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        color: white;
        font-size: 1.1rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
    }

    .lightbox-prev {
        left: 15px;
    }

    .lightbox-next {
        right: 15px;
    }

    .lightbox-info {
        position: absolute;
        top: 25px; /* Floating over the top area */
        left: 20px;
        right: 70px;
        z-index: 10;
        text-align: left;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        padding: 0.6rem 1rem;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        max-width: none;
        margin-top: 0;
    }

    .lightbox-info h3 {
        font-size: 1.1rem;
        text-shadow: none;
        color: #ffffff;
        margin: 0;
    }

    .lightbox-info p {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.7);
        margin: 3px 0 0 0;
    }

    .lightbox-close {
        position: absolute;
        top: 25px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        color: white;
        font-size: 1.1rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10002;
    }
}

/* Loading Animation */
.projects-loading {
    text-align: center;
    padding: 4rem 0;
    color: #666;
}

.projects-loading i {
    font-size: 3rem;
    color: #3498db;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Empty State */
.projects-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.projects-empty i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.projects-empty h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.projects-empty p {
    color: #999;
    font-size: 1rem;
}

/* Lightbox Photo Swipe Slide Transitions */
#lightboxImage {
    transition: transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
    touch-action: none;
}

.slide-out-left {
    transform: translateX(-60px) scale(0.95) !important;
    opacity: 0 !important;
}

.slide-out-right {
    transform: translateX(60px) scale(0.95) !important;
    opacity: 0 !important;
}

.slide-in-right {
    transform: translateX(60px) scale(0.95) !important;
    opacity: 0 !important;
}

.slide-in-left {
    transform: translateX(-60px) scale(0.95) !important;
    opacity: 0 !important;
}