/* ============ AI İLE ÜZERİNDE DENE ============
   Mobilde alttan açılan sheet, masaüstünde ortalanmış modal.
   Renk/tipografi jetonları style.css'ten miras alınır. */

/* ---- ürün sayfasındaki tetik butonu ---- */
.pdp-tryon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 54px;
    margin-top: 12px;
    border-radius: var(--r-pill);
    border: 1px solid var(--rose);
    background: linear-gradient(120deg, rgba(242, 122, 26, .08), rgba(240, 168, 104, .16));
    color: var(--rose-deep);
    font-family: var(--f-body);
    font-size: 12.5px;
    letter-spacing: .13em;
    text-transform: uppercase;
    font-weight: 500;
    cursor: pointer;
    transition: .35s var(--ease);
}

.pdp-tryon:hover {
    background: var(--rose);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--sh-2);
}

.pdp-tryon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pdp-tryon__new {
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--rose);
    color: #fff;
    font-size: 9px;
    letter-spacing: .12em;
}

.pdp-tryon:hover .pdp-tryon__new {
    background: #fff;
    color: var(--rose-deep);
}

/* Bileşen içinde [hidden] her zaman gizler.
   Aşağıdaki kurallar display verdiği için tarayıcının [hidden] varsayılanını ezerdi. */
.tryon [hidden] {
    display: none !important;
}

/* ---- kabuk ---- */
.tryon {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
    pointer-events: none;
}

.tryon.on {
    visibility: visible;
    pointer-events: auto;
}

.tryon__bg {
    position: absolute;
    inset: 0;
    background: rgba(34, 34, 34, .5);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .35s var(--ease);
}

.tryon.on .tryon__bg {
    opacity: 1;
}

.tryon__sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 92vh;
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 60px -20px rgba(34, 34, 34, .35);
    transform: translateY(100%);
    transition: transform .4s var(--ease);
}

.tryon.on .tryon__sheet {
    transform: none;
}

.tryon__grip {
    width: 44px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: var(--r-pill);
    background: var(--line);
    flex-shrink: 0;
}

/* ---- başlık ---- */
.tryon__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px 12px;
    flex-shrink: 0;
}

.tryon__eyebrow {
    display: block;
    font-size: 10px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--rose-deep);
    margin-bottom: 4px;
}

.tryon__head h2 {
    font-family: var(--f-display);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.1;
    margin: 0;
    color: var(--ink);
}

.tryon__x {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--rose-soft);
    color: var(--rose-deep);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: .3s var(--ease);
}

.tryon__x:hover {
    background: var(--rose);
    color: #fff;
}

.tryon__x svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

/* ---- adım göstergesi ---- */
.tryon__steps {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0 22px 14px;
    flex-shrink: 0;
}

.tryon__steps li {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: .04em;
    color: var(--ink-40);
    transition: color .3s var(--ease);
}

.tryon__steps li i {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--rose-soft);
    color: var(--ink-40);
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 11px;
    font-weight: 500;
    transition: .3s var(--ease);
}

.tryon__steps li.on {
    color: var(--ink);
}

.tryon__steps li.on i {
    background: var(--rose);
    color: #fff;
}

/* ---- gövde ---- */
.tryon__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 22px 20px;
}

.tryon__pane {
    display: none;
}

.tryon__pane.on {
    display: block;
    animation: tryonIn .35s var(--ease) both;
}

@keyframes tryonIn {
    from { opacity: 0; transform: translateY(8px); }
}

.tryon__lede {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--ink-60);
}

/* ---- adım 1: yükleme alanı ---- */
.tryon__drop {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 4/3;
    max-height: 42vh;
    border: 1.5px dashed var(--rose);
    border-radius: var(--r-md);
    background: linear-gradient(150deg, #fff, var(--rose-soft));
    cursor: pointer;
    overflow: hidden;
    transition: .3s var(--ease);
}

.tryon__drop.over {
    background: var(--rose-soft);
    border-style: solid;
}

.tryon__drop.has {
    border-style: solid;
    border-color: var(--line);
    background: #faf7f5;
}

.tryon__drop-inner {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
    padding: 20px;
    pointer-events: none;
}

.tryon__drop-ico {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: var(--rose);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tryon__drop-inner b {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
}

.tryon__drop-inner small {
    font-size: 11.5px;
    color: var(--ink-40);
    line-height: 1.5;
}

/* Kutuyu tam kaplar. Grid öğesi olarak height:100% otomatik satır yüksekliğine
   karşı döngüsel bağımlılık yaratıp auto'ya düşüyor ve görsel taşıyordu. */
.tryon__preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.tryon__retake {
    display: block;
    margin: 10px auto 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--rose-deep);
    font-family: var(--f-body);
    font-size: 12.5px;
    border-bottom: 1px solid currentColor;
    cursor: pointer;
}

.tryon__inline-err {
    margin: 10px 0 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--rose-soft);
    color: var(--rose-deep);
    font-size: 12.5px;
    line-height: 1.5;
}

.tryon__tips {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.tryon__tips li {
    position: relative;
    padding-left: 22px;
    font-size: 12.5px;
    color: var(--ink-60);
}

.tryon__tips li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rose);
}

.tryon__kvkk {
    margin: 16px 0 0;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--ink-40);
}

/* ---- adım 2: ürün görselleri ---- */
.tryon__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px;
}

.tryon__pick {
    position: relative;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    background: var(--rose-soft);
    aspect-ratio: 3/4;
    overflow: hidden;
    cursor: pointer;
    transition: .3s var(--ease);
}

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

.tryon__pick.on {
    border-color: var(--rose);
    box-shadow: var(--sh-2);
}

.tryon__tick {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--rose);
    color: #fff;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(.6);
    transition: .3s var(--ease);
}

.tryon__pick.on .tryon__tick {
    opacity: 1;
    transform: none;
}

.tryon__tick svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---- adım 3: yükleniyor / sonuç / hata ---- */
.tryon__loading {
    display: grid;
    justify-items: center;
    gap: 10px;
    text-align: center;
    padding: 46px 20px;
}

.tryon__loading b {
    font-size: 15px;
    font-weight: 500;
}

.tryon__loading small {
    font-size: 12.5px;
    color: var(--ink-40);
}

.tryon__spin {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid var(--rose-soft);
    border-top-color: var(--rose);
    animation: tryonSpin .9s linear infinite;
}

@keyframes tryonSpin {
    to { transform: rotate(360deg); }
}

.tryon__compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tryon__compare figure {
    margin: 0;
}

.tryon__compare img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 12px;
    background: var(--rose-soft);
    display: block;
}

.tryon__compare figcaption {
    margin-top: 6px;
    text-align: center;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-40);
}

.tryon__compare figure:last-child img {
    border: 2px solid var(--rose);
}

.tryon__error {
    display: grid;
    justify-items: center;
    gap: 12px;
    text-align: center;
    padding: 44px 20px;
}

.tryon__error svg {
    width: 40px;
    height: 40px;
    fill: none;
    stroke: var(--rose-deep);
    stroke-width: 1.6;
    stroke-linecap: round;
}

.tryon__error b {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--ink-60);
    max-width: 34ch;
}

/* ---- alt butonlar ---- */
.tryon__foot {
    display: flex;
    gap: 10px;
    padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #fff;
    flex-shrink: 0;
}

.tryon__btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    font-family: var(--f-body);
    font-size: 12px;
    letter-spacing: .13em;
    text-transform: uppercase;
    font-weight: 500;
    cursor: pointer;
    transition: .3s var(--ease);
}

.tryon__btn--fill {
    background: var(--plum);
    color: #fff;
}

.tryon__btn--fill:hover:not(:disabled) {
    background: var(--wine);
}

.tryon__btn--fill:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.tryon__btn--ghost {
    background: #fff;
    border-color: var(--rose);
    color: var(--rose-deep);
}

.tryon__btn--ghost:hover {
    background: var(--rose-soft);
}

/* ---- masaüstü: ortalanmış modal ---- */
@media (min-width: 768px) {
    .tryon {
        align-items: center;
        padding: 24px;
    }

    .tryon__sheet {
        max-width: 620px;
        max-height: 88vh;
        border-radius: var(--r-lg);
        transform: translateY(24px) scale(.97);
        opacity: 0;
        transition: transform .4s var(--ease), opacity .3s var(--ease);
    }

    .tryon.on .tryon__sheet {
        transform: none;
        opacity: 1;
    }

    .tryon__grip {
        display: none;
    }

    .tryon__head {
        padding-top: 24px;
    }

    /* Butonlar sağa yaslanır. margin-left:auto kullanılmaz: gizli kardeşler
       (örn. hidden "Geri") kardeş seçicilerini yine de eşleştirdiği için
       hizalama beklenmedik şekilde bozuluyordu. */
    .tryon__foot {
        justify-content: flex-end;
    }

    .tryon__btn {
        flex: 0 1 auto;
        min-width: 130px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tryon__sheet,
    .tryon__bg,
    .tryon__pane.on {
        transition: none;
        animation: none;
    }
}
