/**
 * Fabric Gallery Styles
 * Brand Color Theme:
 * - Dark: #061c1c
 * - Teal: #112626
 * - Cream: #ffead5
 * - Light: #f8f8f8
 * - White: #ffffff
 * - Sage: #8fa29a
 */

:root {
    --wcdt-brand-dark: #061c1c;
    --wcdt-brand-teal: #112626;
    --wcdt-brand-cream: #ffead5;
    --wcdt-brand-light: #f8f8f8;
    --wcdt-brand-white: #ffffff;
    --wcdt-brand-sage: #8fa29a;
}

/* Gallery Container */
.wcdt-fabric-gallery {
    width: 100%;
    max-width: 100%;
    padding: 40px 20px;
    background-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Improve mobile scrolling performance */
@media (max-width: 768px) {
    .wcdt-fabric-gallery {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
}

/* Gallery root wrapper */
#wcdt-fabric-gallery-root {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Filter Bar Container */
.wcdt-gallery-filters {
    max-width: 1200px;
    margin: 0 auto 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Search Bar Container */
.wcdt-gallery-search {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--wcdt-brand-white);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding-right: 7px;
}

.wcdt-gallery-search:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.wcdt-gallery-search:focus-within {
    border-color: var(--wcdt-brand-sage);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
                0 0 0 3px rgba(143, 162, 154, 0.1);
}

.wcdt-gallery-search::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%238fa29a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.6;
    z-index: 10;
}

.wcdt-gallery-search__input {
    flex: 1;
    min-width: 0;
    margin-left: 5px;
    padding: 18px 20px 18px 20px;
    font-size: 16px;
    border: none !important;
    border-radius: 12px;
    background: transparent;
    color: var(--wcdt-brand-dark);
    font-family: inherit;
    transition: none;
    box-sizing: border-box;
    box-shadow: none !important;
    text-indent: 36px;
    outline: none !important;
}

.wcdt-gallery-search__input:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.wcdt-gallery-search__input::placeholder {
    color: var(--wcdt-brand-sage);
    opacity: 0.6;
    font-weight: 400;
}

.wcdt-gallery-search__clear {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(143, 162, 154, 0.15);
    color: var(--wcdt-brand-sage);
    border-radius: 50%;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcdt-gallery-search__clear:hover {
    background: var(--wcdt-brand-dark);
    color: var(--wcdt-brand-white);
    transform: scale(1.1) rotate(90deg);
}

/* Filter Controls Container */
.wcdt-gallery-filter-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* Filter Select Dropdowns */
.wcdt-gallery-filter-select {
    padding: 14px 40px 14px 18px;
    font-size: 15px;
    border: none;
    border-radius: 12px;
    background: var(--wcdt-brand-white);
    color: var(--wcdt-brand-dark);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(6, 28, 28, 0.08), 0 0 0 1px rgba(143, 162, 154, 0.15);
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%238fa29a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    min-width: 160px;
}

.wcdt-gallery-filter-select:hover {
    box-shadow: 0 4px 16px rgba(6, 28, 28, 0.12), 0 0 0 1px rgba(143, 162, 154, 0.25);
}

.wcdt-gallery-filter-select:focus {
    outline: none;
    box-shadow: 0 6px 24px rgba(6, 28, 28, 0.15), 0 0 0 2px var(--wcdt-brand-sage);
}

/* Clear All Filters Button */
.wcdt-gallery-clear-filters {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: rgba(143, 162, 154, 0.12);
    color: var(--wcdt-brand-sage);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.wcdt-gallery-clear-filters:hover {
    background: var(--wcdt-brand-sage);
    color: var(--wcdt-brand-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(143, 162, 154, 0.3);
}

/* Color Filter */
.wcdt-gallery-color-filter {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px 20px;
    background: var(--wcdt-brand-white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(6, 28, 28, 0.08), 0 0 0 1px rgba(143, 162, 154, 0.15);
}

.wcdt-gallery-color-filter__label {
    font-size: 15px;
    font-weight: 600;
    color: var(--wcdt-brand-dark);
    white-space: nowrap;
}

.wcdt-gallery-color-filter__swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wcdt-gallery-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.wcdt-gallery-color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.wcdt-gallery-color-swatch:active {
    transform: scale(1.05);
}

.wcdt-gallery-color-swatch--active {
    border-color: var(--wcdt-brand-dark);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.wcdt-gallery-color-swatch--active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Mobile-friendly color swatches */
@media (max-width: 768px) {
    .wcdt-gallery-color-swatch:hover {
        transform: none;
    }

    .wcdt-gallery-color-swatch:active {
        transform: scale(0.95);
    }

    .wcdt-gallery-color-swatch--active::after {
        font-size: 20px;
    }
}

/* Search Results Count - inline with filters */
.wcdt-gallery-results {
    margin: 0;
    margin-left: auto;
    padding: 0 8px;
    font-size: 14px;
    color: var(--wcdt-brand-dark);
    font-weight: 500;
    opacity: 0.85;
    white-space: nowrap;
}

/* AI Explanation */
.wcdt-gallery-ai-explanation {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-left: 4px solid var(--wcdt-brand-teal);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    font-style: italic;
    animation: aiExplanationSlideIn 0.5s ease-out;
}

@keyframes aiExplanationSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.wcdt-gallery-ai-explanation::before {
    content: "💬 ";
    margin-right: 8px;
    font-style: normal;
}

/* Typing cursor animation */
.typing-cursor {
    display: inline-block;
    margin-left: 2px;
    font-style: normal;
    animation: cursorBlink 0.8s infinite;
    color: var(--wcdt-brand-teal);
    font-weight: 600;
}

@keyframes cursorBlink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* No Results Message */
.wcdt-gallery-no-results {
    text-align: center;
    padding: 80px 20px;
    font-size: 18px;
    color: var(--wcdt-brand-sage);
    font-weight: 500;
}

.wcdt-gallery-no-results::before {
    content: '🔍';
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .wcdt-gallery-filters {
        gap: 16px;
    }

    .wcdt-gallery-search__input {
        padding: 16px 55px 16px 52px;
        font-size: 15px;
    }

    .wcdt-gallery-search::before {
        left: 20px;
        width: 18px;
        height: 18px;
    }

    .wcdt-gallery-filter-controls {
        gap: 10px;
    }

    .wcdt-gallery-filter-select {
        padding: 16px 40px 16px 18px;
        font-size: 15px;
        min-width: 140px;
        flex: 1;
        min-height: 48px;
    }

    .wcdt-gallery-clear-filters {
        padding: 16px 24px;
        font-size: 15px;
        width: 100%;
        min-height: 52px;
        font-weight: 600;
    }

    .wcdt-gallery-color-filter {
        padding: 14px 16px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .wcdt-gallery-color-filter__label {
        font-size: 14px;
    }

    .wcdt-gallery-color-swatch {
        width: 44px;
        height: 44px;
        border-radius: 8px;
    }

    .wcdt-gallery-results {
        font-size: 12px;
        margin: 0;
        padding: 0 4px;
        flex-basis: 100%;
        text-align: center;
        margin-top: 8px;
    }

    .wcdt-gallery-ai-explanation {
        padding: 14px 16px;
        font-size: 13px;
        margin: 0 auto 16px;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .wcdt-gallery-filters {
        gap: 12px;
    }

    .wcdt-gallery-search__input {
        padding: 14px 50px 14px 48px;
        font-size: 15px;
    }

    .wcdt-gallery-search::before {
        left: 18px;
        width: 16px;
        height: 16px;
    }

    .wcdt-gallery-search__clear {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    /* Larger touch targets for all interactive elements */
    .wcdt-gallery-search__ai-toggle {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .wcdt-gallery-search__ai-toggle.active {
        font-size: 22px;
    }

    .wcdt-gallery-search__ai-submit {
        padding: 14px 24px;
        font-size: 15px;
        min-height: 48px;
    }

    .wcdt-gallery-filter-select {
        width: 100%;
        min-width: auto;
        padding: 18px 40px 18px 20px;
        font-size: 16px;
        min-height: 52px;
    }

    .wcdt-gallery-clear-filters {
        min-height: 56px;
        font-size: 16px;
    }

    /* Ensure color swatches are easy to tap on smallest screens */
    .wcdt-gallery-color-swatch {
        width: 48px;
        height: 48px;
    }

    .wcdt-gallery-color-filter {
        padding: 16px;
        gap: 14px;
        flex-wrap: wrap;
    }
}

/* Loading State */
.wcdt-gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--wcdt-brand-teal);
}

.wcdt-gallery-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--wcdt-brand-cream);
    border-top: 4px solid var(--wcdt-brand-sage);
    border-radius: 50%;
    animation: wcdt-spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Error and Empty States */
.wcdt-gallery-error,
.wcdt-gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--wcdt-brand-teal);
    font-size: 18px;
}

/* Collection Section */
.wcdt-fabric-collection {
    margin-bottom: 60px;
}

.wcdt-fabric-collection__title {
    font-size: 32px;
    font-weight: 700;
    color: var(--wcdt-brand-dark);
    margin: 0 0 30px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--wcdt-brand-sage);
    text-transform: capitalize;
}

/* Fabric Grid */
.wcdt-fabric-collection__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

/* Tablet optimization */
@media (max-width: 1024px) and (min-width: 769px) {
    .wcdt-fabric-collection__grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .wcdt-fabric-collection__grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .wcdt-fabric-collection__grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Very small phones - single column for optimal viewing */
@media (max-width: 360px) {
    .wcdt-fabric-collection__grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* Fabric Card */
.wcdt-fabric-card {
    background: var(--wcdt-brand-white);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(6, 28, 28, 0.1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.wcdt-fabric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(6, 28, 28, 0.15);
}

/* Active state for mobile tap feedback */
@media (max-width: 768px) {
    .wcdt-fabric-card:active {
        transform: scale(0.98);
        box-shadow: 0 4px 12px rgba(6, 28, 28, 0.12);
    }

    /* Disable hover transforms on mobile (use tap feedback instead) */
    .wcdt-fabric-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(6, 28, 28, 0.1);
    }
}

.wcdt-fabric-card__image-wrapper {
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    position: relative;
    background-color: var(--wcdt-brand-cream);
    overflow: hidden;
}

.wcdt-fabric-card__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    background: var(--wcdt-brand-cream);
}

/* Image loading state */
.wcdt-fabric-card__image[loading="lazy"] {
    background: linear-gradient(
        90deg,
        var(--wcdt-brand-cream) 0%,
        var(--wcdt-brand-light) 50%,
        var(--wcdt-brand-cream) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.wcdt-fabric-card:hover .wcdt-fabric-card__image {
    transform: scale(1.05);
}

/* Disable image zoom on mobile */
@media (max-width: 768px) {
    .wcdt-fabric-card:hover .wcdt-fabric-card__image {
        transform: none;
    }
}

.wcdt-fabric-card__placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: var(--wcdt-brand-sage);
    background: linear-gradient(135deg, var(--wcdt-brand-cream), var(--wcdt-brand-light));
}

/* Fabric card info wrapper */
.wcdt-fabric-card__info {
    padding: 15px;
    background: var(--wcdt-brand-white);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.wcdt-fabric-card__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--wcdt-brand-dark);
    text-align: center;
}

/* Weight Indicator with circular progress */
.wcdt-weight-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wcdt-weight-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--wcdt-brand-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: -10px;
}

.wcdt-weight-circle {
    width: 60px;
    height: 60px;
    color: var(--wcdt-brand-sage);
}

.wcdt-weight-circle-progress {
    transition: stroke-dasharray 0.3s ease;
}

.wcdt-weight-circle-text {
    fill: var(--wcdt-brand-dark);
}

.wcdt-weight-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--wcdt-brand-sage);
    text-align: center;
}

/* Indicators container (weight + seasons at bottom of popup) */
.wcdt-fabric-popup__indicators {
    margin-top: 32px;
    padding-top: 24px;
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* Season indicator (matches weight indicator style) */
.wcdt-season-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wcdt-season-icon {
    display: block;
    width: 60px;
    height: 60px;
}

.wcdt-season-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--wcdt-brand-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: -10px;
}

.wcdt-season-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--wcdt-brand-sage);
    text-align: center;
}

/* Color badge - shows most dominant color */
.wcdt-fabric-card__color {
    position: absolute;
    bottom: 70px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid var(--wcdt-brand-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Popup Modal */
.wcdt-fabric-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(6, 28, 28, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999999 !important;
    padding: 20px;
    overscroll-behavior: contain;
}

/* Full-screen popup on mobile */
@media (max-width: 768px) {
    .wcdt-fabric-popup {
        padding: 0;
        background-color: var(--wcdt-brand-white);
        backdrop-filter: none;
    }
}

.wcdt-fabric-popup__content {
    background: var(--wcdt-brand-white);
    border-radius: 20px;
    max-width: 1400px;
    width: 100%;
    max-height: 92vh;
    overflow: hidden;
    position: relative;
    animation: wcdt-popupAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Simple centered modal on mobile - just like desktop */
@media (max-width: 768px) {
    .wcdt-fabric-popup__content {
        border-radius: 12px;
        max-width: 95%;
        width: 95%;
        max-height: 90vh;
        margin: 20px auto;
    }
}

@keyframes wcdt-popupAppear {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Close Button */
.wcdt-fabric-popup__close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(6, 28, 28, 0.08);
    color: var(--wcdt-brand-dark);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 12px;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.wcdt-fabric-popup__close:hover {
    background: var(--wcdt-brand-dark);
    color: var(--wcdt-brand-white);
    transform: rotate(90deg) scale(1.05);
}

/* Luxury refined close button on mobile - elegant and subtle */
@media (max-width: 768px) {
    .wcdt-fabric-popup__close {
        /* Positioning - top right */
        top: 20px;
        right: 20px;

        /* Larger touch target - 56px (above 44px minimum) */
        width: 56px;
        height: 56px;

        /* Elegant dark circle with subtle transparency */
        background: rgba(6, 28, 28, 0.75);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);

        /* Refined white X icon */
        color: var(--wcdt-brand-white);
        font-size: 24px;
        font-weight: 200;

        /* Subtle border for definition */
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 50%;

        /* Elegant shadow - soft and refined */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15),
                    0 1px 4px rgba(0, 0, 0, 0.1);

        /* Smooth luxury transition */
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

        position: absolute;
        z-index: 11;
    }

    .wcdt-fabric-popup__close:hover {
        background: rgba(6, 28, 28, 0.9);
        border-color: rgba(255, 255, 255, 0.25);
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2),
                    0 2px 8px rgba(0, 0, 0, 0.15);
        transform: scale(1.05);
    }

    .wcdt-fabric-popup__close:active {
        transform: scale(0.95);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    }
}

/* Extra-small phones - slightly larger for easier tapping */
@media (max-width: 480px) {
    .wcdt-fabric-popup__close {
        width: 60px;
        height: 60px;
        font-size: 26px;
        top: 16px;
        right: 16px;
    }
}

/* Popup Layout */
.wcdt-fabric-popup__layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0;
    overflow-y: auto;
    max-height: 92vh;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 968px) {
    .wcdt-fabric-popup__layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .wcdt-fabric-popup__layout {
        max-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
}

/* Popup Image Section */
.wcdt-fabric-popup__image-section {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff, #f5f5f5);
    padding: 80px 60px 60px 60px;
    position: relative;
    overflow: hidden;
}

@media (max-width: 968px) {
    .wcdt-fabric-popup__image-section {
        padding: 60px 40px 40px 40px;
        min-height: 400px;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .wcdt-fabric-popup__image-section {
        padding: 30px;
        min-height: 280px;
    }
}

.wcdt-fabric-popup__image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 700px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(6, 28, 28, 0.15);
}

/* Zoomable image - scales up on hover and pans based on cursor */
.wcdt-fabric-popup__image--zoomable {
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.wcdt-fabric-popup__image--zoomable:hover {
    transform: scale(2);
    cursor: move;
}

.wcdt-fabric-popup__image-placeholder {
    padding: 60px;
    color: var(--wcdt-brand-sage);
    font-size: 18px;
    text-align: center;
    font-weight: 500;
}

/* Popup Details Section */
.wcdt-fabric-popup__details {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 60px 50px;
    background: var(--wcdt-brand-white);
}

@media (max-width: 968px) {
    .wcdt-fabric-popup__details {
        padding: 40px 35px;
    }
}

@media (max-width: 480px) {
    .wcdt-fabric-popup__details {
        padding: 30px 25px;
    }
}

.wcdt-fabric-popup__title {
    font-size: 42px;
    font-weight: 700;
    color: var(--wcdt-brand-dark);
    margin: 0 0 32px 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

@media (max-width: 768px) {
    .wcdt-fabric-popup__title {
        font-size: 34px;
        margin-bottom: 24px;
    }
}

@media (max-width: 480px) {
    .wcdt-fabric-popup__title {
        font-size: 28px;
        margin-bottom: 20px;
    }
}

/* AI Reason in Popup - prominent recommendation box */
.wcdt-fabric-popup__ai-reason {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 2px solid #a7f3d0;
    border-radius: 12px;
    animation: aiReasonPopupFadeIn 0.5s ease-out;
}

.wcdt-fabric-popup__ai-reason-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.wcdt-fabric-popup__ai-reason-text {
    flex: 1;
}

.wcdt-fabric-popup__ai-reason-text strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #047857;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcdt-fabric-popup__ai-reason-text p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #065f46;
    font-style: italic;
}

@keyframes aiReasonPopupFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .wcdt-fabric-popup__ai-reason {
        padding: 16px;
        gap: 12px;
    }

    .wcdt-fabric-popup__ai-reason-icon {
        font-size: 24px;
    }

    .wcdt-fabric-popup__ai-reason-text strong {
        font-size: 14px;
    }

    .wcdt-fabric-popup__ai-reason-text p {
        font-size: 14px;
    }
}

.wcdt-fabric-popup__field {
    padding: 20px 0;
    border-bottom: 1px solid rgba(6, 28, 28, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.wcdt-fabric-popup__field:last-child {
    border-bottom: none;
}

.wcdt-fabric-popup__field strong {
    flex-shrink: 0;
    width: 140px;
    color: var(--wcdt-brand-sage);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 2px;
}

.wcdt-fabric-popup__field > span,
.wcdt-fabric-popup__field > div {
    flex: 1;
    color: var(--wcdt-brand-dark);
    font-size: 16px;
    line-height: 1.6;
}

.wcdt-fabric-popup__description {
    margin: 0;
    padding: 0;
    color: var(--wcdt-brand-dark);
    line-height: 1.7;
}

.wcdt-fabric-popup__description p {
    margin: 0 0 12px 0;
}

.wcdt-fabric-popup__description p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .wcdt-fabric-popup__field {
        flex-direction: column;
        gap: 8px;
        padding: 16px 0;
    }

    .wcdt-fabric-popup__field strong {
        width: auto;
    }

    .wcdt-fabric-popup__color-swatch {
        display: block;
        margin-left: 0;
        margin-top: 12px;
    }
}

.wcdt-fabric-popup__color-swatch {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin-left: 12px;
    vertical-align: middle;
    border: 2px solid rgba(6, 28, 28, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    top: -1px;
}

/* Season items with icons */
.wcdt-fabric-popup__seasons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.wcdt-fabric-popup__season-item {
    display: flex;
    align-items: center;
    font-size: 16px;
    color: var(--wcdt-brand-dark);
}

/* Scrollbar Styling */
.wcdt-fabric-popup__layout::-webkit-scrollbar {
    width: 8px;
}

.wcdt-fabric-popup__layout::-webkit-scrollbar-track {
    background: transparent;
}

.wcdt-fabric-popup__layout::-webkit-scrollbar-thumb {
    background: var(--wcdt-brand-sage);
    border-radius: 4px;
}

.wcdt-fabric-popup__layout::-webkit-scrollbar-thumb:hover {
    background: var(--wcdt-brand-teal);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wcdt-fabric-gallery {
        padding: 30px 15px;
    }

    .wcdt-fabric-collection__title {
        font-size: 26px;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .wcdt-fabric-gallery {
        padding: 20px 15px;
    }

    .wcdt-fabric-collection {
        margin-bottom: 40px;
    }

    .wcdt-fabric-collection__title {
        font-size: 22px;
    }

    .wcdt-fabric-card__title {
        font-size: 16px;
        padding: 16px;
        min-height: 60px;
        line-height: 1.4;
    }
}

/* Avada Theme Compatibility - Ensure popup is above header */
body.wcdt-popup-open .fusion-header,
body.wcdt-popup-open .fusion-header-wrapper,
body.wcdt-popup-open .awb-header,
body.wcdt-popup-open .awb-header-wrapper,
body.wcdt-popup-open #header,
body.wcdt-popup-open .header-wrapper,
body.wcdt-popup-open header,
body.wcdt-popup-open .fusion-sticky-header,
body.wcdt-popup-open .fusion-mobile-menu-icons {
    z-index: 100 !important;
}

/* Hide any Avada overlays/dropdowns when popup is open */
body.wcdt-popup-open .fusion-megamenu-wrapper,
body.wcdt-popup-open .fusion-dropdown-menu,
body.wcdt-popup-open .fusion-main-menu {
    z-index: 99 !important;
}

/* AI Search Styles - Integrated Design */

/* AI textarea variant */
.wcdt-gallery-search__input--ai {
    padding: 18px 20px 18px 20px;
    min-height: 120px;
    resize: vertical;
    text-indent: 0;
    line-height: 1.6;
}

/* Better mobile AI textarea */
@media (max-width: 768px) {
    .wcdt-gallery-search__input--ai {
        min-height: 140px;
        font-size: 16px;
        padding: 20px;
        line-height: 1.7;
    }
}

@media (max-width: 480px) {
    .wcdt-gallery-search__input--ai {
        min-height: 160px;
        padding: 20px;
    }
}

.wcdt-gallery-search__input--ai::placeholder {
    color: #9ca3af;
    opacity: 1;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 400;
}

/* AI Toggle Button (✨ / ×) */
.wcdt-gallery-search__ai-toggle {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 2px solid var(--wcdt-brand-sage);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--wcdt-brand-sage);
    border-radius: 10px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(143, 162, 154, 0.15);
    position: relative;
}

.wcdt-gallery-search__ai-toggle::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    padding: 2px;
    background: linear-gradient(135deg, var(--wcdt-brand-sage), var(--wcdt-brand-teal));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.wcdt-gallery-search__ai-toggle:hover {
    background: linear-gradient(135deg, var(--wcdt-brand-sage) 0%, var(--wcdt-brand-teal) 100%);
    color: var(--wcdt-brand-white);
    border-color: var(--wcdt-brand-teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(143, 162, 154, 0.3);
}

.wcdt-gallery-search__ai-toggle:active {
    transform: scale(0.95);
    transition: all 0.1s ease;
}

.wcdt-gallery-search__ai-toggle:focus {
    outline: none;
    border-color: var(--wcdt-brand-sage);
    box-shadow: 0 0 0 4px rgba(143, 162, 154, 0.2), 0 2px 8px rgba(143, 162, 154, 0.15);
}

/* Active state (when AI mode is on - X button) */
.wcdt-gallery-search__ai-toggle.active {
    background: linear-gradient(135deg, var(--wcdt-brand-dark) 0%, var(--wcdt-brand-teal) 100%);
    border-color: var(--wcdt-brand-dark);
    color: var(--wcdt-brand-white);
    font-size: 24px;
    font-weight: 400;
    box-shadow: 0 2px 12px rgba(6, 28, 28, 0.3);
}

.wcdt-gallery-search__ai-toggle.active::before {
    opacity: 1;
    animation: aiTogglePulse 2s ease-in-out infinite;
}

@keyframes aiTogglePulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

.wcdt-gallery-search__ai-toggle.active:hover {
    background: linear-gradient(135deg, var(--wcdt-brand-teal) 0%, var(--wcdt-brand-dark) 100%);
    color: var(--wcdt-brand-cream);
    transform: rotate(90deg) scale(1.05);
    box-shadow: 0 4px 20px rgba(6, 28, 28, 0.4);
}

.wcdt-gallery-search__ai-toggle.active:active {
    transform: scale(0.95) rotate(90deg);
}

/* AI Submit Button (visible in AI mode) */
.wcdt-gallery-search__ai-submit {
    flex-shrink: 0;
    padding: 10px 20px;
    border: 1px solid var(--wcdt-brand-dark);
    background: var(--wcdt-brand-dark);
    color: var(--wcdt-brand-white);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    letter-spacing: 0.3px;
}

.wcdt-gallery-search__ai-submit:hover:not(:disabled) {
    background: var(--wcdt-brand-teal);
    border-color: var(--wcdt-brand-teal);
}

.wcdt-gallery-search__ai-submit:active:not(:disabled) {
    transform: scale(0.95);
    transition: all 0.1s ease;
}

.wcdt-gallery-search__ai-submit:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(143, 162, 154, 0.1);
}

.wcdt-gallery-search__ai-submit:disabled {
    opacity: 1;
    cursor: not-allowed;
    background: var(--wcdt-brand-dark);
    border-color: var(--wcdt-brand-dark);
    animation: aiSearchPulse 2s ease-in-out infinite, aiSearchShimmer 3s linear infinite;
    position: relative;
    overflow: hidden;
}

/* Keyframe Animations */
@keyframes aiSearchPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(17, 38, 38, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(17, 38, 38, 0);
    }
}

@keyframes aiSearchShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes aiTextFade {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

/* AI Loading Text Animation */
.ai-loading-text {
    display: inline-flex;
    align-items: center;
    animation: aiTextFade 2s ease-in-out infinite;
}

.ai-spinner {
    display: inline-block;
    animation: aiSpinnerRotate 2s linear infinite;
    margin-right: 6px;
    font-size: 16px;
}

.wcdt-gallery-search__ai-submit:disabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: aiSearchShimmer 2s linear infinite;
}

/* Hide search icon when in AI mode */
.wcdt-gallery-search:has(.wcdt-gallery-search__input--ai)::before {
    display: none;
}

@media (max-width: 768px) {
    .wcdt-gallery-search__input--ai {
        padding-right: 16px;
        padding-bottom: 80px;
    }

    /* Enhanced AI toggle button for mobile */
    .wcdt-gallery-search__ai-toggle {
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-width: 2.5px;
        border-radius: 12px;
        box-shadow: 0 3px 12px rgba(143, 162, 154, 0.25);
    }

    .wcdt-gallery-search__ai-toggle:hover {
        transform: none; /* Disable hover on mobile */
    }

    .wcdt-gallery-search__ai-toggle:active {
        transform: scale(0.92);
        box-shadow: 0 2px 8px rgba(143, 162, 154, 0.2);
    }

    .wcdt-gallery-search__ai-toggle.active {
        font-size: 26px;
        box-shadow: 0 3px 16px rgba(6, 28, 28, 0.4);
    }

    .wcdt-gallery-search__ai-toggle.active:hover {
        transform: none; /* Disable hover on mobile */
    }

    .wcdt-gallery-search__ai-toggle.active:active {
        transform: scale(0.92);
    }

    .wcdt-gallery-search__ai-submit {
        position: absolute;
        top: auto;
        bottom: 16px;
        right: 68px;
        transform: none;
    }

    .wcdt-gallery-search__ai-submit:hover:not(:disabled) {
        transform: translateY(-2px);
    }
}

/* Extra-small phones - even larger touch target */
@media (max-width: 480px) {
    .wcdt-gallery-search__ai-toggle {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }

    .wcdt-gallery-search__ai-toggle.active {
        font-size: 28px;
    }
}
