/**
 * ================================================
 * AQUA PLASTIC SURGERY - RESULTS GALLERY
 * ================================================
 * Filterable before/after results gallery
 * Design System: Teal gradient, Libre Caslon + Nunito Sans
 */

/* ===================================
   GALLERY CONTAINER
   =================================== */

/* ===================================
   KILL ALL INTERFERENCE
   =================================== */

/* Stop ANY script from animating gallery elements */
.aps-results-gallery,
.aps-results-gallery *,
.aps-gallery-modal,
.aps-gallery-modal * {
    background-attachment: scroll !important;
    -webkit-animation: none !important;
    animation: none !important;
}

/* Gallery container stays clean */
.aps-results-gallery {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    background: none !important;
    background-image: none !important;
    position: relative;
    isolation: isolate;
}

/* ===================================
   FILTER BAR
   =================================== */

.aps-gallery-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 32px 0 24px;
    margin: 0 auto 40px;
    max-width: 1200px;
    background: transparent;
    border-bottom: 1px solid #E5E5E5;
}

.aps-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.aps-filter-label {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #666666;
    margin-bottom: 8px;
    display: block;
}

/* Custom Select Dropdown Styling - Classic Minimal */
.aps-filter-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 44px 10px 14px;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 15px;
    color: #333333;
    background: #ffffff;
    border: 1px solid #CCCCCC;
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='10' viewBox='0 0 16 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L8 8L15 1' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px 10px !important;
    transition: border-color 0.2s ease;
    outline: none;
}

.aps-filter-select:hover {
    border-color: #999999;
}

.aps-filter-select:focus {
    border-color: #666666;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 102, 102, 0.1);
}

/* Select placeholder/first option styling */
.aps-filter-select option[value=""] {
    color: #999999;
}

/* Disabled option styling */
.aps-filter-select option:disabled {
    color: #CCCCCC;
    font-style: italic;
}

/* Active state indicator - applied via JS class */
.aps-filter-select.has-selection {
    border-color: #666666;
    color: #333333;
}

.aps-filter-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #F8FAFA;
}

/* ===================================
   ACTIVE FILTERS (Facet Pills)
   =================================== */

.aps-active-filters {
    display: none; /* Hidden by default, shown by JS when filters active */
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 0 20px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.aps-facet-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 16px;
    background: linear-gradient(180deg, #31c3f2 0%, #1d87af 100%);
    color: white;
    border-radius: 20px;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(49, 195, 242, 0.3);
    transition: all 0.2s ease;
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.aps-facet-label {
    white-space: nowrap;
}

.aps-facet-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    transition: all 0.2s ease;
}

.aps-facet-remove:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* ===================================
   RESULTS GRID
   =================================== */

.aps-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 80px;
    background: none !important;
    background-image: none !important;
    animation: none !important;
}

/* ===================================
   RESULT CARDS
   =================================== */

.aps-result-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 7px 30.7px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    text-decoration: none;
    color: inherit;
}

.aps-result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .aps-result-card {
        grid-template-columns: 1fr;
    }
    
    .aps-result-card-images {
        grid-template-columns: 1fr 1fr;
    }
}

/* Card Before/After Images Container */
.aps-result-card-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    background-color: #f3f9fa;
}

.aps-result-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #f3f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aps-result-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    max-width: 100%;
}

.aps-result-card:hover .aps-result-image img {
    transform: scale(1.05);
}


/* Card Content */
.aps-result-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.aps-result-card-case-id {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #1d87af;
    margin-bottom: 8px;
}

.aps-result-card-title {
    font-family: 'Libre Caslon Text', serif;
    font-weight: 400;
    font-size: 26px !important;
    line-height: 30px;
    color: #03151c;
    margin: 0 0 12px 0;
    letter-spacing: 0.5px;
}

.aps-result-card-excerpt {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 22px;
    color: #03151c;
    margin: 0 0 16px 0;
    
    /* Truncate to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aps-result-card-link {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #31c3f2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    transition: color 0.3s ease;
}

.aps-result-card-link:hover {
    color: #1d87af;
}

.aps-result-card-link::after {
    content: '→';
    font-size: 20px;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.aps-result-card:hover .aps-result-card-link::after {
    transform: translateX(4px);
}

/* ===================================
   FADE-IN ANIMATION (CONTROLLED)
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aps-result-card.fade-in {
    animation: fadeIn 0.4s ease forwards !important;
}

/* Prevent any other animations on cards */
.aps-result-card:not(.fade-in) {
    animation: none !important;
}

/* ===================================
   NO RESULTS MESSAGE
   =================================== */

.aps-no-results {
    text-align: center;
    padding: 80px 20px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 18px;
    color: #03151c;
    display: none;
}

.aps-no-results.show {
    display: block;
}

/* ===================================
   LIGHTBOX MODAL (Simple Version)
   =================================== */

.aps-gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 21, 28, 0.95) !important;
    background-image: none !important;
    background-attachment: scroll !important;
    -webkit-animation: none !important;
    animation: none !important;
    z-index: 99999;
    overflow-y: auto;
    padding: 40px 20px;
    isolation: isolate;
}

.aps-gallery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.aps-modal-content {
    background: #ffffff;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    position: relative;
    margin: auto;
    animation: fadeIn 0.3s ease;
}

.aps-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(180deg, #31c3f2 0%, #1d87af 100%);
    color: #ffffff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    z-index: 10;
}

.aps-modal-close:hover {
    transform: scale(1.1);
}

.aps-modal-body {
    padding: 60px 40px 40px;
}

.aps-modal-case-id {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #1d87af;
    margin-bottom: 12px;
}

.aps-modal-title {
    font-family: 'Libre Caslon Text', serif;
    font-weight: 400;
    font-size: 32px;
    line-height: 40px;
    color: #03151c;
    margin: 0 0 24px 0;
}

.aps-modal-content-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 26px;
    color: #03151c;
    margin-bottom: 32px;
}

.aps-modal-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.aps-modal-image-pair {
    display: flex;
    flex-direction: column;
}

.aps-modal-image-label {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #03151c;
    margin-bottom: 12px;
    padding-left: 4px;
}

.aps-modal-image-wrapper {
    position: relative;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 3/4;
    margin-bottom: 20px;
}

/* padding-bottom fallback for Safari < 15 (aspect-ratio unsupported) */
@supports not (aspect-ratio: 1/1) {
    .aps-modal-image-wrapper {
        height: 0;
        padding-bottom: 133.33%; /* 4 / 3 × 100 */
    }
    .aps-modal-image-wrapper img {
        position: absolute;
        top: 0;
        left: 0;
    }
}

.aps-modal-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.aps-modal-view-angle {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #1d87af;
    text-transform: capitalize;
    margin-bottom: 16px;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .aps-gallery-modal {
        padding: 20px;
    }
    
    .aps-modal-body {
        padding: 50px 24px 24px;
    }
    
    .aps-modal-title {
        font-size: 24px;
        line-height: 32px;
    }
    
    .aps-modal-images {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .aps-modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}

/* ===================================
   MOBILE RESPONSIVE
   =================================== */

@media (max-width: 768px) {
    .aps-gallery-filters {
        grid-template-columns: 1fr;
        padding: 24px 0 20px;
        gap: 18px;
    }
    
    .aps-filter-select {
        min-height: 42px;
        font-size: 14px;
        padding: 9px 42px 9px 12px;
        background-position: right 12px center !important;
        background-size: 14px 9px !important;
    }
    
    .aps-active-filters {
        padding: 0 15px 25px;
    }
    
    .aps-facet-pill {
        font-size: 12px;
        padding: 6px 10px 6px 14px;
    }
}

@media (max-width: 640px) {
    .aps-gallery-filters {
        padding: 25px 15px 10px;
    }
    
    .aps-results-grid {
        grid-template-columns: 1fr;
        padding-bottom: 60px;
    }
    
    .aps-result-card-content {
        padding: 20px;
    }
    
    .aps-result-card-title {
        font-size: 16px;
        line-height: 22px;
    }
    
    .aps-result-card-excerpt {
        font-size: 14px;
        line-height: 20px;
    }
}

/* ===================================
   PROVIDER GALLERY LANDING PAGE
   =================================== */

.aps-provider-gallery-landing {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.aps-provider-gallery-header {
    text-align: center;
    max-width: 900px;
    margin: 60px auto 0;
    padding: 0 20px;
}

.aps-provider-gallery-header h1 {
    font-family: 'Libre Caslon Text', 'Georgia', serif;
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    color: #03151c;
    margin: 0 0 24px;
}

.aps-provider-gallery-intro {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: #3a5a6a;
    margin: 0;
}

@media (max-width: 768px) {
    .aps-provider-gallery-header {
        margin-top: 40px;
    }

    .aps-provider-gallery-header h1 {
        font-size: 28px;
    }

    .aps-provider-gallery-intro {
        font-size: 15px;
    }
}

