/**
 * Surface Panel — masaüstünde sağ drawer, mobilde bottom sheet.
 * Kök: .sp-layer.is-open  |  Kapat: [data-sp-dismiss] veya SurfacePanel.close(el)
 */
:root {
    --sp-z: 12050;
    --sp-duration: 0.32s;
    --sp-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

body.sp-noscroll {
    overflow: hidden;
    overscroll-behavior: none;
}

@media (prefers-reduced-motion: reduce) {
    .sp-layer,
    .sp-backdrop,
    .sp-shell {
        transition-duration: 0.01ms !important;
    }
}

.sp-layer {
    position: fixed;
    inset: 0;
    z-index: var(--sp-z);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--sp-duration) var(--sp-ease),
        visibility var(--sp-duration) linear;
}

.sp-layer.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sp-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--sp-duration) var(--sp-ease);
}

.sp-layer.is-open .sp-backdrop {
    opacity: 1;
}

.sp-shell {
    position: absolute;
    z-index: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.2);
}

.sp-drag {
    flex-shrink: 0;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    background: #fff;
    cursor: grab;
}

.sp-drag:active {
    cursor: grabbing;
}

.sp-drag::after {
    content: "";
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: #cbd5e1;
}

.sp-sheet {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobil: bottom sheet */
@media (max-width: 767.98px) {
    .sp-shell {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        max-height: min(92dvh, 920px);
        width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(calc(100% + 24px));
        transition: transform var(--sp-duration) var(--sp-ease);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .sp-layer.is-open .sp-shell {
        transform: translateY(0);
    }

    .sp-drag {
        display: flex;
    }

    .sp-shell--wide {
        max-height: min(94dvh, 960px);
    }
}

/* Masaüstü: sağ drawer */
@media (min-width: 768px) {
    .sp-shell {
        top: 0;
        right: 0;
        bottom: 0;
        width: min(100vw - 32px, 440px);
        max-width: 100%;
        border-radius: 18px 0 0 18px;
        box-shadow: -12px 0 48px rgba(0, 0, 0, 0.18);
        transform: translateX(calc(100% + 24px));
        transition: transform var(--sp-duration) var(--sp-ease);
    }

    .sp-layer.is-open .sp-shell {
        transform: translateX(0);
    }

    .sp-shell--wide {
        width: min(100vw - 40px, 960px);
    }
}
