/**
 * Boat Gallery Styles
 * Styles dédiés pour les galeries photos des pages bateaux
 * Compatible avec la charte graphique OKCroisière
 */

:root {
    /* Variables de couleurs basées sur la charte OKCroisière */
    --gallery-primary: #0077b6;
    --gallery-primary-light: #00b4d8;
    --gallery-primary-dark: #005f8f;
    --gallery-accent: #ffd60a;
    --gallery-success: #52b788;
    --gallery-danger: #e63946;
    --gallery-dark: #1d3557;
    --gallery-gray: #6c757d;
    --gallery-light-gray: #f8f9fa;
    --gallery-white: #ffffff;
    
    /* Ombres et effets */
    --gallery-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --gallery-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --gallery-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
    --gallery-shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.24);
    
    /* Transitions */
    --gallery-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gallery-transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Spacing */
    --gallery-spacing-xs: 0.5rem;
    --gallery-spacing-sm: 1rem;
    --gallery-spacing-md: 1.5rem;
    --gallery-spacing-lg: 2rem;
    --gallery-spacing-xl: 3rem;
}

/* ========================================
   LOADER STYLES
   ======================================== */

.gallery-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: var(--gallery-transition);
}

.gallery-loader.active {
    visibility: visible;
    opacity: 1;
}

.gallery-loader .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
    color: var(--gallery-primary);
}

/* ========================================
   CONTAINER & HEADER
   ======================================== */

.gallery-container {
    padding: var(--gallery-spacing-xl) 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 60vh;
    position: relative;
}

.gallery-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: linear-gradient(180deg, 
        rgba(0, 119, 182, 0.05) 0%, 
        transparent 100%);
    pointer-events: none;
}

.gallery-header {
    text-align: center;
    margin-bottom: var(--gallery-spacing-xl);
    position: relative;
    z-index: 1;
}

.gallery-main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gallery-dark);
    margin-bottom: var(--gallery-spacing-sm);
    position: relative;
    display: inline-block;
}

.gallery-main-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--gallery-primary) 0%, 
        var(--gallery-primary-light) 100%);
    border-radius: 2px;
}

.gallery-main-description {
    font-size: 1.125rem;
    color: var(--gallery-gray);
    max-width: 600px;
    margin: var(--gallery-spacing-md) auto;
    line-height: 1.6;
}

.gallery-stats {
    display: inline-flex;
    align-items: center;
    gap: var(--gallery-spacing-xs);
    padding: var(--gallery-spacing-sm) var(--gallery-spacing-md);
    background: var(--gallery-white);
    border-radius: 50px;
    box-shadow: var(--gallery-shadow-md);
    margin-top: var(--gallery-spacing-md);
    font-weight: 600;
    color: var(--gallery-primary);
}

.gallery-stats i {
    font-size: 1.25rem;
}

/* ========================================
   CATEGORIES GRID
   ======================================== */

.gallery-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--gallery-spacing-lg);
    margin-bottom: var(--gallery-spacing-xl);
    position: relative;
    z-index: 1;
}

.gallery-category-card {
    background: var(--gallery-white);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--gallery-transition);
    cursor: pointer;
    box-shadow: var(--gallery-shadow-sm);
    position: relative;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.gallery-category-card:nth-child(1) { animation-delay: 0.1s; }
.gallery-category-card:nth-child(2) { animation-delay: 0.2s; }
.gallery-category-card:nth-child(3) { animation-delay: 0.3s; }
.gallery-category-card:nth-child(4) { animation-delay: 0.4s; }
.gallery-category-card:nth-child(5) { animation-delay: 0.5s; }
.gallery-category-card:nth-child(6) { animation-delay: 0.6s; }

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

.gallery-category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--gallery-shadow-xl);
}

.gallery-category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        var(--gallery-primary) 0%, 
        var(--gallery-primary-light) 100%);
    opacity: 0;
    transition: var(--gallery-transition);
    z-index: 1;
}

.gallery-category-card:hover::before {
    opacity: 0.05;
}

.gallery-card-image-wrapper {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gallery-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--gallery-transition);
}

.gallery-category-card:hover .gallery-card-image {
    transform: scale(1.1);
}

.gallery-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(0, 0, 0, 0.8) 100%);
    color: var(--gallery-white);
    padding: var(--gallery-spacing-lg) var(--gallery-spacing-md) var(--gallery-spacing-md);
    transform: translateY(100%);
    transition: var(--gallery-transition);
}

.gallery-category-card:hover .gallery-card-overlay {
    transform: translateY(0);
}

.gallery-overlay-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--gallery-spacing-xs);
}

.gallery-overlay-count {
    display: flex;
    align-items: center;
    gap: var(--gallery-spacing-xs);
    font-size: 0.875rem;
    opacity: 0.9;
}

.gallery-card-body {
    padding: var(--gallery-spacing-md);
}

.gallery-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--gallery-spacing-sm);
}

.gallery-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gallery-dark);
    margin: 0;
    flex: 1;
}

.gallery-card-badge {
    background: linear-gradient(135deg, 
        var(--gallery-primary) 0%, 
        var(--gallery-primary-light) 100%);
    color: var(--gallery-white);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.gallery-card-description {
    color: var(--gallery-gray);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   MODAL STYLES
   ======================================== */

#galleryModal .modal-dialog {
    max-width: 95vw;
}

#galleryModal .modal-content {
    border-radius: 20px;
    border: none;
    background: var(--gallery-white);
    box-shadow: var(--gallery-shadow-xl);
}

#galleryModal .modal-header {
    background: linear-gradient(135deg, 
        var(--gallery-primary) 0%, 
        var(--gallery-primary-light) 100%);
    color: var(--gallery-white);
    border-radius: 20px 20px 0 0;
    padding: var(--gallery-spacing-md) var(--gallery-spacing-lg);
    border: none;
}

#galleryModal .modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

#galleryModal .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: var(--gallery-transition-fast);
}

#galleryModal .btn-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

#galleryModal .modal-body {
    padding: var(--gallery-spacing-lg);
    background: var(--gallery-light-gray);
}

/* ========================================
   CAROUSEL STYLES
   ======================================== */

#galleryCarousel {
    background: var(--gallery-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--gallery-shadow-md);
}

#galleryCarousel .carousel-inner {
    border-radius: 12px;
    background: #000;
}

#galleryCarousel .carousel-item {
    transition: transform 0.6s ease-in-out;
}

#galleryCarousel img {
    max-height: 70vh;
    width: 100%;
    object-fit: contain;
    background: #000;
}

#galleryCarousel .ratio {
    max-height: 70vh;
    background: #000;
    border-radius: 12px;
}

#galleryCarousel .carousel-control-prev,
#galleryCarousel .carousel-control-next {
    width: 50px;
    height: 50px;
    background: var(--gallery-primary);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
    transition: var(--gallery-transition-fast);
}

#galleryCarousel .carousel-control-prev:hover,
#galleryCarousel .carousel-control-next:hover {
    opacity: 1;
    background: var(--gallery-primary-dark);
}

#galleryCarousel .carousel-control-prev {
    left: 20px;
}

#galleryCarousel .carousel-control-next {
    right: 20px;
}

#galleryCarousel .carousel-control-prev-icon,
#galleryCarousel .carousel-control-next-icon {
    width: 20px;
    height: 20px;
}

/* ========================================
   PHOTO INFO STYLES
   ======================================== */

#photoInfo {
    background: var(--gallery-white);
    padding: var(--gallery-spacing-md);
    border-radius: 12px;
    margin-top: var(--gallery-spacing-md);
    box-shadow: var(--gallery-shadow-sm);
}

#photoTitle {
    color: var(--gallery-dark);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--gallery-spacing-xs);
}

#photoDescription {
    color: var(--gallery-gray);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
}

/* ========================================
   THUMBNAILS STYLES
   ======================================== */

#thumbnailsContainer {
    background: var(--gallery-white);
    padding: var(--gallery-spacing-sm);
    border-radius: 12px;
    box-shadow: var(--gallery-shadow-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--gallery-primary) var(--gallery-light-gray);
}

#thumbnailsContainer::-webkit-scrollbar {
    height: 8px;
}

#thumbnailsContainer::-webkit-scrollbar-track {
    background: var(--gallery-light-gray);
    border-radius: 4px;
}

#thumbnailsContainer::-webkit-scrollbar-thumb {
    background: var(--gallery-primary);
    border-radius: 4px;
}

#thumbnailsContainer::-webkit-scrollbar-thumb:hover {
    background: var(--gallery-primary-dark);
}

.gallery-thumbnail {
    width: 100px;
    height: 75px;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: var(--gallery-transition-fast);
    flex-shrink: 0;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
    border-color: var(--gallery-primary-light);
    box-shadow: var(--gallery-shadow-md);
}

.gallery-thumbnail.active {
    border-color: var(--gallery-primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.2);
    transform: scale(1.1);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .gallery-categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .gallery-container {
        padding: var(--gallery-spacing-lg) 0;
    }
    
    .gallery-main-title {
        font-size: 1.75rem;
    }
    
    .gallery-main-description {
        font-size: 1rem;
    }
    
    .gallery-categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: var(--gallery-spacing-md);
    }
    
    .gallery-card-image-wrapper {
        height: 180px;
    }
    
    #galleryCarousel img {
        max-height: 50vh;
    }
    
    #galleryCarousel .carousel-control-prev,
    #galleryCarousel .carousel-control-next {
        width: 40px;
        height: 40px;
    }
    
    #galleryCarousel .carousel-control-prev {
        left: 10px;
    }
    
    #galleryCarousel .carousel-control-next {
        right: 10px;
    }
    
    .gallery-thumbnail {
        width: 70px;
        height: 55px;
    }
    
    #galleryModal .modal-body {
        padding: var(--gallery-spacing-md);
    }
}

@media (max-width: 576px) {
    .gallery-main-title {
        font-size: 1.5rem;
    }
    
    .gallery-categories-grid {
        grid-template-columns: 1fr;
        padding: 0 var(--gallery-spacing-sm);
    }
    
    .gallery-card-title {
        font-size: 1.125rem;
    }
    
    .gallery-stats {
        font-size: 0.875rem;
    }
    
    #galleryModal .modal-header {
        padding: var(--gallery-spacing-sm) var(--gallery-spacing-md);
    }
    
    #galleryModal .modal-title {
        font-size: 1.125rem;
    }
}

/* ========================================
   ANIMATIONS & TRANSITIONS
   ======================================== */

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 119, 182, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(0, 119, 182, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 119, 182, 0);
    }
}

.gallery-category-card:hover .gallery-card-badge {
    animation: pulse 1.5s infinite;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.gallery-category-card:focus-visible,
.gallery-thumbnail:focus-visible {
    outline: 3px solid var(--gallery-primary);
    outline-offset: 2px;
}

.btn-close:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.5);
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .gallery-container {
        background: none;
    }
    
    .gallery-category-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    #galleryModal {
        display: none;
    }
}