/**
 * Enhanced Inspiration Gallery Styles
 * Features: Masonry Layout + Color Filtering + Design Story Cards
 */

/* ============================================================================
   SECTION: Enhanced Gallery Container
   ============================================================================ */

.enhanced-inspiration-gallery {
    padding: 80px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    position: relative;
    overflow: hidden;
}

.enhanced-inspiration-gallery::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(254,0,0,0.03) 0%, transparent 70%);
    animation: rotateGradient 30s linear infinite;
    pointer-events: none;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

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

.enhanced-inspiration-gallery .container {
    position: relative;
    z-index: 1;
}

/* ============================================================================
   SECTION: Gallery Header
   ============================================================================ */

.gallery-header {
    text-align: center;
    margin-bottom: 50px;
}

.gallery-header .section-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #1a1a1a 0%, #FE0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gallery-header .section-subtitle {
    font-size: 1.2rem;
    color: #666;
    font-weight: 400;
}

/* ============================================================================
   SECTION: Color Filter Bar
   ============================================================================ */

.color-filter-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    padding: 25px 30px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 1rem;
    white-space: nowrap;
}

.color-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
}

.color-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
}

.color-chip:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.color-chip.active {
    background: #FE0000;
    color: white;
    border-color: #FE0000;
}

.chip-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chip-count {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.color-chip.active .chip-count {
    background: rgba(255,255,255,0.3);
}

/* ============================================================================
   SECTION: View Mode Toggle
   ============================================================================ */

.view-mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: flex-end;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #495057;
    transition: all 0.3s ease;
}

.view-btn:hover {
    border-color: #FE0000;
    color: #FE0000;
}

.view-btn.active {
    background: #FE0000;
    border-color: #FE0000;
    color: white;
}

/* ============================================================================
   SECTION: Masonry Gallery Layout
   ============================================================================ */

.masonry-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 20px;
    gap: 20px;
    margin-bottom: 40px;
}

.masonry-gallery.active {
    animation: fadeInUp 0.6s ease;
}

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

/* ============================================================================
   SECTION: Design Story Cards
   ============================================================================ */

.design-card {
    grid-row-end: span 13; /* Normal height */
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    animation: cardAppear 0.6s ease backwards;
}

.design-card.large {
    grid-row-end: span 17; /* Featured cards - taller portrait */
}

.design-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

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

/* Stagger animation delays */
.design-card:nth-child(1) { animation-delay: 0.05s; }
.design-card:nth-child(2) { animation-delay: 0.1s; }
.design-card:nth-child(3) { animation-delay: 0.15s; }
.design-card:nth-child(4) { animation-delay: 0.2s; }
.design-card:nth-child(5) { animation-delay: 0.25s; }
.design-card:nth-child(6) { animation-delay: 0.3s; }
.design-card:nth-child(7) { animation-delay: 0.35s; }
.design-card:nth-child(8) { animation-delay: 0.4s; }

/* Card Image Wrapper */
.card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.design-card.large .card-image-wrapper {
    aspect-ratio: 0.65; /* Much taller portrait for large cards - creates masonry effect */
}

.card-images {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: all 0.5s ease;
    transform: scale(1.05);
}

.card-image.active {
    opacity: 1;
    transform: scale(1);
}

.design-card:hover .card-image.active {
    transform: scale(1.08);
}

/* View Toggle Dots */
.view-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.view-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.view-dots .dot:hover {
    background: rgba(255,255,255,0.8);
    transform: scale(1.2);
}

.view-dots .dot.active {
    background: #FE0000;
    border-color: #FE0000;
    width: 24px;
    border-radius: 5px;
}

/* Quick Action Overlay */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

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

.quick-actions {
    display: flex;
    gap: 15px;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.design-card:hover .quick-actions {
    transform: translateY(0);
}

.action-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #1a1a1a;
}

.action-btn:hover {
    background: #FE0000;
    color: white;
    transform: scale(1.15) rotate(10deg);
}

/* Card Content - Story */
.enhanced-inspiration-gallery .card-content {
    padding: 16px;
    flex: none !important; /* Override other CSS that sets flex: 1 */
    display: block !important; /* Override flexbox from other CSS */
}

.enhanced-inspiration-gallery .design-colors {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.enhanced-inspiration-gallery .design-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.enhanced-inspiration-gallery .design-style {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0 0 10px 0;
    text-transform: capitalize;
}

.enhanced-inspiration-gallery .design-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #6c757d;
}

.meta-item svg {
    opacity: 0.7;
}

.popularity-badge {
    padding: 4px 10px;
    background: linear-gradient(135deg, #FFF3CD 0%, #FFE5A0 100%);
    border-radius: 12px;
    font-weight: 700;
    color: #856404;
    font-size: 0.75rem;
}

.customize-design-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #FE0000 0%, #C70000 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.customize-design-btn:hover {
    background: linear-gradient(135deg, #C70000 0%, #A00000 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(254,0,0,0.4);
}

.customize-design-btn svg {
    transition: transform 0.3s ease;
}

.customize-design-btn:hover svg {
    transform: translateX(4px);
}

/* ============================================================================
   SECTION: Regular Grid View (Alternative)
   ============================================================================ */

.grid-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.grid-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.grid-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.grid-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

.grid-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.grid-card:hover .grid-image-wrapper img {
    transform: scale(1.1);
}

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

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

.grid-quick-view {
    padding: 12px 24px;
    background: white;
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.grid-quick-view:hover {
    background: #FE0000;
    color: white;
}

.grid-content {
    padding: 15px;
}

.grid-content h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #1a1a1a;
}

.grid-content p {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
}

/* ============================================================================
   SECTION: No Results Message
   ============================================================================ */

.no-results {
    text-align: center;
    padding: 80px 20px;
}

.no-results svg {
    color: #dee2e6;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 1.8rem;
    color: #495057;
    margin: 0 0 10px 0;
}

.no-results p {
    font-size: 1.1rem;
    color: #6c757d;
    margin: 0 0 25px 0;
}

.reset-filters-btn {
    padding: 12px 30px;
    background: #FE0000;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-filters-btn:hover {
    background: #C70000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(254,0,0,0.3);
}

/* ============================================================================
   SECTION: Hidden State
   ============================================================================ */

.design-card.hidden,
.grid-card.hidden {
    display: none;
}

/* ============================================================================
   SECTION: Responsive Design
   ============================================================================ */

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

    .design-card {
        grid-row-end: span 13;
    }

    .design-card.large {
        grid-row-end: span 17;
    }
}

@media (max-width: 992px) {
    .gallery-header .section-title {
        font-size: 2.2rem;
    }

    .color-filter-bar {
        padding: 20px;
    }

    .masonry-gallery {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
    }

    .design-card {
        grid-row-end: span 13;
    }

    .design-card.large {
        grid-row-end: span 13; /* Same as normal on tablet */
    }
}

@media (max-width: 768px) {
    /* ============================================================================
       STATE-OF-THE-ART MOBILE GALLERY DESIGN
       ============================================================================ */

    .enhanced-inspiration-gallery {
        padding: 40px 0;
        background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
        overflow: hidden;
    }

    .enhanced-inspiration-gallery::before {
        background: radial-gradient(circle at 30% 20%, rgba(254, 0, 0, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 70% 80%, rgba(254, 0, 0, 0.03) 0%, transparent 50%);
        animation: none;
    }

    /* Stunning Header */
    .gallery-header {
        margin-bottom: 25px;
        padding: 0 15px;
    }

    .gallery-header .section-title {
        font-size: 1.5rem;
        background: linear-gradient(135deg, #1a1a1a 0%, #FE0000 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        text-shadow: none;
    }

    .gallery-header .section-subtitle {
        font-size: 0.85rem;
        color: #666;
    }

    /* Horizontal Scrolling Color Filter */
    .color-filter-bar {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 10px;
        padding: 15px;
        margin: 0 -15px 20px;
        background: #fff;
        border-radius: 0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
        -webkit-overflow-scrolling: touch;
    }

    .color-filter-bar::-webkit-scrollbar {
        display: none;
    }

    .filter-label {
        display: none;
    }

    .color-chips {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .color-chip {
        flex: 0 0 auto;
        padding: 8px 14px;
        background: #f5f5f5;
        border: 1px solid #e0e0e0;
        border-radius: 20px;
        font-size: 0.7rem;
        color: #333;
    }

    .color-chip:hover,
    .color-chip.active {
        background: linear-gradient(135deg, #FE0000 0%, #ff4444 100%);
        border-color: transparent;
        color: #fff;
        transform: scale(1.05);
    }

    .chip-color {
        width: 14px;
        height: 14px;
        border-width: 1px;
    }

    .chip-count {
        background: rgba(0, 0, 0, 0.08);
        padding: 2px 6px;
        font-size: 0.65rem;
    }

    .color-chip.active .chip-count {
        background: rgba(255, 255, 255, 0.3);
    }

    /* Hide view mode toggle on mobile */
    .view-mode-toggle {
        display: none;
    }

    /* Scroll Hint Indicator */
    .masonry-gallery-wrapper {
        position: relative;
    }

    .masonry-gallery-wrapper::after {
        content: 'Swipe →';
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        background: linear-gradient(135deg, #FE0000 0%, #ff4444 100%);
        color: #fff;
        padding: 8px 14px;
        border-radius: 20px;
        font-size: 0.7rem;
        font-weight: 700;
        z-index: 10;
        animation: pulseSwipe 2s ease-in-out infinite;
        box-shadow: 0 4px 20px rgba(254, 0, 0, 0.4);
        pointer-events: none;
    }

    @keyframes pulseSwipe {
        0%, 100% {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
        50% {
            opacity: 0.7;
            transform: translateY(-50%) translateX(5px);
        }
    }

    /* Fade edge on right side */
    .masonry-gallery-wrapper::before {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 60px;
        background: linear-gradient(90deg, transparent 0%, rgba(248, 249, 250, 0.95) 100%);
        z-index: 5;
        pointer-events: none;
    }

    /* Stunning Card Gallery */
    .masonry-gallery {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 15px;
        padding: 10px 15px 20px;
        padding-right: 80px;
        margin: 0;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-padding: 15px;
    }

    .masonry-gallery::-webkit-scrollbar {
        display: none;
    }

    /* Hide scroll hint after user scrolls */
    .masonry-gallery-wrapper.scrolled::after,
    .masonry-gallery-wrapper.scrolled::before {
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .design-card {
        flex: 0 0 260px;
        min-width: 260px;
        max-width: 260px;
        grid-row-end: auto;
        background: #fff;
        border: none;
        border-radius: 16px;
        scroll-snap-align: start;
        animation: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }

    .design-card.large {
        grid-row-end: auto;
    }

    .design-card:hover {
        transform: none;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    }

    /* Card Image */
    .card-image-wrapper {
        aspect-ratio: 1;
        border-radius: 16px 16px 0 0;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    }

    .design-card.large .card-image-wrapper {
        aspect-ratio: 1;
    }

    .card-image {
        border-radius: 16px 16px 0 0;
    }

    /* View Dots - Larger for touch */
    .view-dots {
        bottom: 12px;
        gap: 10px;
    }

    .view-dots .dot {
        width: 10px;
        height: 10px;
        background: rgba(255, 255, 255, 0.5);
        border: 2px solid #fff;
    }

    .view-dots .dot.active {
        width: 24px;
        background: #FE0000;
        border-color: #fff;
    }

    /* Quick Actions - Hidden on mobile */
    .card-overlay {
        opacity: 0;
    }

    .quick-actions {
        display: none;
    }

    /* Card Content */
    .enhanced-inspiration-gallery .card-content {
        padding: 12px !important;
        background: #fff;
        border-radius: 0 0 16px 16px;
    }

    .enhanced-inspiration-gallery .design-colors {
        margin-bottom: 8px;
    }

    .color-dot {
        width: 14px;
        height: 14px;
        border: 1px solid #ddd;
    }

    .enhanced-inspiration-gallery .design-name {
        font-size: 0.85rem;
        color: #1a1a1a;
        margin-bottom: 2px;
    }

    .enhanced-inspiration-gallery .design-style {
        font-size: 0.7rem;
        color: #666;
        margin-bottom: 10px;
    }

    .enhanced-inspiration-gallery .design-meta {
        display: none;
    }

    .customize-design-btn {
        padding: 10px 14px;
        font-size: 0.75rem;
        border-radius: 10px;
        background: linear-gradient(135deg, #FE0000 0%, #ff4444 100%);
        box-shadow: 0 4px 15px rgba(254, 0, 0, 0.3);
    }

    .customize-design-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(254, 0, 0, 0.4);
    }

    /* Grid Gallery Alternative */
    .grid-gallery {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 12px;
        padding: 10px 15px;
        -webkit-overflow-scrolling: touch;
    }

    .grid-gallery::-webkit-scrollbar {
        display: none;
    }

    .grid-card {
        flex: 0 0 180px;
        min-width: 180px;
        background: #fff;
        border: none;
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .grid-content h4 {
        color: #1a1a1a;
        font-size: 0.8rem;
    }

    .grid-content p {
        color: #666;
        font-size: 0.7rem;
    }

    /* No Results */
    .no-results {
        padding: 60px 20px;
    }

    .no-results svg {
        color: #ccc;
    }

    .no-results h3 {
        color: #1a1a1a;
        font-size: 1.4rem;
    }

    .no-results p {
        color: #666;
        font-size: 0.95rem;
    }

    .reset-filters-btn {
        background: linear-gradient(135deg, #FE0000 0%, #ff4444 100%);
        border-radius: 10px;
    }
}
