/* ============================================
   AI TRY-ON  —  SlickInterior
   ============================================ */

/* --- Modal overlay & container --- */

body.tryon-scroll-locked {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
}

.tryon-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
}

.tryon-modal.active {
    display: block;
}

.tryon-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: tryon-fadeIn 0.2s ease;
}

.tryon-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    max-width: 94vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 20px;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    animation: tryon-slideUp 0.3s ease;
}

/* --- Header --- */

.tryon-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.tryon-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.01em;
}

.tryon-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 0;
    cursor: pointer;
    color: #999;
    padding: 0;
    transition: color 0.15s ease;
}

.tryon-close-btn:hover {
    color: #333;
}

/* --- Subtitle --- */

.tryon-subtitle {
    padding: 10px 20px 0;
    font-size: 13px;
    color: #777;
    line-height: 1.45;
}

/* --- Body --- */

.tryon-body {
    padding: 20px;
}

/* --- Steps --- */

.tryon-step {
    margin-bottom: 20px;
}

.tryon-step-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

.tryon-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* --- Upload zone --- */

.tryon-upload-zone {
    position: relative;
    border: 2px dashed #ddd;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.tryon-upload-zone:hover {
    border-color: #bbb;
}

.tryon-file-input {
    display: none !important;
}

.tryon-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px 20px;
    text-align: center;
    color: #999;
    cursor: pointer;
}

.tryon-upload-placeholder svg {
    color: #ccc;
}

.tryon-upload-text {
    font-size: 13px;
    color: #888;
}

.tryon-upload-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
    justify-content: center;
}

.tryon-btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    color: #444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tryon-btn-upload:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.tryon-btn-upload:active {
    transform: scale(0.97);
}

.tryon-btn-upload-full {
    width: 100%;
    max-width: 240px;
    justify-content: center;
}

/* Preview */

.tryon-upload-preview {
    position: relative;
}

.tryon-upload-preview img {
    display: block;
    width: 100%;
    border-radius: 12px;
    transition: opacity 0.2s ease;
}

.tryon-change-photo {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s ease;
}

.tryon-change-photo:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* --- Colors --- */

.tryon-colors {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.tryon-colors .tryon-swiper {
    width: 100%;
    padding: 4px 30px;
    overflow: hidden;
}

/* Navigation arrows */
.tryon-colors .si-swiper-prev,
.tryon-colors .si-swiper-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    transition: color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.tryon-colors .si-swiper-prev:hover,
.tryon-colors .si-swiper-next:hover {
    color: #333;
}

.tryon-colors .si-swiper-prev {
    left: 0;
}

.tryon-colors .si-swiper-next {
    right: 0;
}

/* Arrow icons via pseudo-elements */
.tryon-colors .si-swiper-prev::after,
.tryon-colors .si-swiper-next::after {
    font-size: 18px;
    font-weight: 300;
    line-height: 1;
}

.tryon-colors .si-swiper-prev::after {
    content: '‹';
    font-size: 24px;
}

.tryon-colors .si-swiper-next::after {
    content: '›';
    font-size: 24px;
}

/* Hide when disabled */
.tryon-colors .si-swiper-prev.swiper-button-disabled,
.tryon-colors .si-swiper-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: default;
}

.tryon-colors .tryon-swiper .swiper-wrapper {
    display: flex !important;
    align-items: center;
    width: auto !important;
}

.tryon-colors .tryon-swiper .swiper-slide {
    width: auto !important;
    flex: 0 0 auto !important;
    display: flex;
}

.tryon-colors .tryon-swiper .color-circle-label {
    display: block;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid transparent !important;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tryon-colors .tryon-swiper .color-circle-label:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.tryon-colors .tryon-swiper .color-circle-label.active {
    border-color: #111 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
    transform: scale(1.08);
}

/* --- Generate button --- */

.tryon-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: #111;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.tryon-generate-btn:hover:not(:disabled) {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.tryon-generate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.tryon-generate-btn:disabled {
    background: #e0e0e0;
    color: #aaa;
    cursor: not-allowed;
}

/* --- Remaining counter --- */

.tryon-remaining {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.tryon-remaining.tryon-limit-reached {
    color: #c0392b;
    font-weight: 600;
}

/* --- Disclaimer --- */

.tryon-disclaimer {
    text-align: center;
    font-size: 11px;
    color: #bbb;
    margin-top: 6px;
    line-height: 1.4;
}

/* --- Loader --- */

.tryon-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 30px 0;
    text-align: center;
}

.tryon-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #eee;
    border-top-color: #111;
    border-radius: 50%;
    animation: tryon-spin 0.7s linear infinite;
}

.tryon-loader-text {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.tryon-loader-sub {
    font-size: 12px;
    color: #aaa;
}

/* --- Result --- */

.tryon-result {
    margin-top: 20px;
}

.tryon-result-label {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    margin-bottom: 10px;
}

.tryon-result img {
    width: 100%;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Try again button */
.tryon-try-again-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.tryon-try-again-btn:hover {
    border-color: #bbb;
    color: #333;
}

/* Result CTA */
.tryon-result-cta {
    margin-top: 14px;
    padding: 14px;
    background: #f8f8f8;
    border-radius: 12px;
    text-align: center;
}

.tryon-result-cta-text {
    display: block;
    font-size: 13px;
    color: #555;
    font-weight: 500;
    margin-bottom: 10px;
    line-height: 1.4;
}

.tryon-smartfit-recommended {
    display: block;
    color: #e6a817;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.tryon-result-cta .tryon-smartfit-btn {
    background: #000;
    width: 100%;
    display: flex;
    margin: 0;
    cursor: pointer;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 400;
    box-shadow: 0px 0px 10px 3px rgb(184 184 184);
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #fff;
    border: none;
    padding: 14px 20px;
    transition: all 0.2s ease;
}

.tryon-result-cta .tryon-smartfit-btn:hover {
    box-shadow: 0px 0px 14px 4px rgb(150 150 150);
    transform: translateY(-1px);
}

.tryon-result-cta .tryon-smartfit-btn .si-smartfit-icon {
    width: 28px;
    height: auto;
    filter: invert(1);
}

/* --- Selected color name --- */

.tryon-selected-color-name {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    min-height: 18px;
}

/* --- History --- */

.tryon-history {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.tryon-history-label {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.tryon-history-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.tryon-history-thumb {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.tryon-history-thumb:hover {
    transform: scale(1.04);
}

.tryon-history-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Community Gallery (before/after) --- */

.tryon-community {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.tryon-community-label {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.tryon-community-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tryon-community-empty {
    text-align: center;
    font-size: 13px;
    color: #bbb;
    padding: 20px 0;
}

.tryon-community-load {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.tryon-community-load:hover {
    border-color: #ccc;
    color: #333;
}

/* --- Before/After Slider Card --- */

.tryon-ba-card {
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.tryon-ba-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    cursor: ew-resize;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
    background: #f0f0f0;
}

.tryon-ba-after {
    position: absolute;
    inset: 0;
}

.tryon-ba-after img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tryon-ba-before {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 50%;
    overflow: hidden;
    z-index: 2;
}

/* Key trick: the before img is positioned relative to the SLIDER (not the clipped before div).
   We use width/height 100% of the slider by referencing the slider's size via a wrapper trick. */
.tryon-ba-before img {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    object-fit: cover;
    max-width: none;
}

.tryon-ba-label {
    position: absolute;
    bottom: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    pointer-events: none;
    z-index: 5;
}

.tryon-ba-label--before {
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
}

.tryon-ba-label--after {
    right: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: #111;
}

/* Handle (draggable divider) */

.tryon-ba-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    pointer-events: auto;
    cursor: ew-resize;
}

.tryon-ba-handle-line {
    flex: 1;
    width: 2px;
    background: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.tryon-ba-handle-knob {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* --- Utilities --- */

.hidden {
    display: none !important;
}

/* --- Animations --- */

@keyframes tryon-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes tryon-slideUp {
    from { opacity: 0; transform: translate(-50%, -46%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes tryon-spin {
    to { transform: rotate(360deg); }
}

/* --- Mobile --- */

@media (max-width: 480px) {
    .tryon-content {
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
        animation: none;
    }

    .tryon-body {
        padding: 16px;
        padding-bottom: 40px;
    }

    .tryon-upload-actions {
        flex-direction: row;
        width: 100%;
    }

    .tryon-btn-upload {
        flex: 1;
        justify-content: center;
    }

    .tryon-generate-btn {
        padding: 16px;
        font-size: 16px;
    }
}

/* ============================================
   FLOATING TRY-ON BUTTON (inside gallery)
   ============================================ */

/* --- Shared base styles --- */
.tryon-gallery-btn {
    position: absolute;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
    white-space: nowrap;
    line-height: 1;
}

.tryon-gallery-btn svg {
    flex-shrink: 0;
}

.tryon-gallery-btn:active {
    transform: scale(0.96);
}

/* --- Slider version (≤1024px): bottom-center, above pagination --- */
.tryon-gallery-btn--slider {
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    padding: 9px 16px;
    font-size: 12px;
}

.tryon-gallery-btn--slider:active {
    transform: translateX(-50%) scale(0.96);
}

/* --- Grid version (≥1025px): top-right corner of desktop gallery --- */
.tryon-gallery-btn--grid {
    top: 16px;
    right: 16px;
    padding: 10px 18px;
    font-size: 13px;
}

.tryon-gallery-btn--grid:hover {
    background: rgba(0, 0, 0, 0.88);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tryon-gallery-btn--grid:active {
    transform: translateY(0);
}

/* --- Visibility: only show the right button at the right breakpoint --- */
/* ≤1024: show slider button, hide grid button */
@media (max-width: 1024px) {
    .tryon-gallery-btn--grid {
        display: none !important;
    }
}

/* ≥1025: show grid button, hide slider button */
@media (min-width: 1025px) {
    .tryon-gallery-btn--slider {
        display: none !important;
    }
}

/* Ensure gallery wrapper is positioned for the grid button */
.si-gallery {
    position: relative;
}

.si-gallery__desktop {
    position: relative;
}
