/**
 * «Sizi arayalım» sol yapışkan talep formu (panel sağa doğru açılır)
 */

.crw {
    position: fixed;
    left: 0;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10400;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    font-family: inherit;
    max-height: calc(100vh - 2rem);
}

/* Uzun kenar boyunca parlama (dikey sekme + rotate ile uyumlu) */
@keyframes crw-tab-shine {
    0% {
        background-position: 50% 140%;
    }
    100% {
        background-position: 50% -60%;
    }
}

.crw-tab {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    min-height: 132px;
    margin: 0;
    padding: 0.5rem 0.35rem;
    border: none;
    /* rotate(180deg) ile birlikte ekranda sol düz, sağ yuvarlak görünür (sol kenara yapışık) */
    border-radius: 8px 0 0 8px;
    background: var(--primary, #ed4b25);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 2px 0 12px rgba(15, 23, 42, 0.15);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    letter-spacing: 0.02em;
    transition: filter 0.15s ease, background 0.15s ease;
}

.crw-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        transparent 34%,
        rgba(255, 255, 255, 0.1) 42%,
        rgba(255, 255, 255, 0.52) 50%,
        rgba(255, 255, 255, 0.1) 58%,
        transparent 66%,
        transparent 100%
    );
    background-size: 100% 260%;
    background-position: 50% 0;
    animation: crw-tab-shine 4.2s ease-in-out infinite alternate;
}

.crw-tab__label {
    position: relative;
    z-index: 1;
}

.crw-tab:hover::before,
.crw-tab:focus-visible::before {
    animation-play-state: paused;
}

.crw-tab:hover,
.crw-tab:focus-visible {
    filter: brightness(1.05);
    outline: none;
}

.crw-tab:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary, #ed4b25);
}

.crw-panel {
    position: relative;
    width: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-left: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.1);
    transition: width 0.2s ease, max-width 0.2s ease, opacity 0.2s ease, padding 0.2s ease;
    box-sizing: border-box;
}

.crw.is-open .crw-panel {
    width: min(280px, calc(100vw - 52px));
    max-width: min(280px, calc(100vw - 52px));
    opacity: 1;
    padding: 0.875rem 0.875rem 0.75rem;
    overflow: auto;
}

.crw-panel__title {
    margin: 0 0 0.35rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gray-900, #111827);
}

.crw-panel__hint {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--gray-600, #4b5563);
}

.crw-field {
    margin-bottom: 0.5rem;
}

.crw-field label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-600, #4b5563);
    margin-bottom: 0.2rem;
}

.crw-field input,
.crw-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 6px;
    font-family: inherit;
}

.crw-field textarea {
    min-height: 52px;
    resize: vertical;
}

.crw-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.crw-actions {
    margin-top: 0.65rem;
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.crw-submit {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: var(--primary, #ed4b25);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
}

.crw-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.crw-msg {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.4;
    min-height: 1rem;
}

.crw-msg--err {
    color: #b91c1c;
}

.crw-msg--ok {
    color: #047857;
}

/* Kapat: yalnızca mobil tam ekran modunda görünür */
.crw-panel__close {
    display: none;
}

@media (max-width: 640px) {
    /* Kapalı: sekme sol kenarda dikey ortalı */
    .crw {
        left: 0;
        right: auto;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        max-height: calc(100dvh - 1rem);
    }

    .crw-tab {
        min-height: 100px;
        width: 36px;
        font-size: 0.75rem;
        border-radius: 6px 0 0 6px;
    }

    /* Açık: tam ekran — taşıyıcı + panel viewport’a sabit (üst layout ölçeğinden bağımsız) */
    .crw.is-open {
        position: fixed;
        inset: 0;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100vw;
        min-width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
        align-items: stretch;
        z-index: 100060;
    }

    .crw.is-open .crw-tab {
        position: absolute;
        width: 0;
        min-height: 0;
        height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        border: none;
    }

    .crw.is-open .crw-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 100dvh !important;
        border-radius: 0;
        border: none;
        box-shadow: none;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 1rem;
        padding-top: max(3.5rem, calc(env(safe-area-inset-top, 0px) + 2.75rem));
        padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
        padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
        z-index: 1;
    }

    .crw.is-open .crw-panel__title {
        font-size: 1.35rem;
        margin-bottom: 0.5rem;
    }

    .crw.is-open .crw-panel__hint {
        font-size: 0.9375rem;
        margin-bottom: 1rem;
        line-height: 1.5;
    }

    .crw.is-open .crw-field {
        margin-bottom: 0.85rem;
    }

    .crw.is-open .crw-field label {
        font-size: 0.8125rem;
        margin-bottom: 0.35rem;
    }

    .crw.is-open .crw-field input,
    .crw.is-open .crw-field textarea {
        font-size: 16px;
        padding: 0.75rem 0.875rem;
        min-height: 48px;
        border-radius: 8px;
    }

    .crw.is-open .crw-field textarea {
        min-height: 96px;
    }

    .crw.is-open .crw-actions {
        margin-top: 1rem;
    }

    .crw.is-open .crw-submit {
        font-size: 1rem;
        padding: 0.85rem 1rem;
        min-height: 48px;
        border-radius: 8px;
    }

    .crw.is-open .crw-msg {
        font-size: 0.875rem;
        margin-top: 0.65rem;
    }

    .crw-panel__close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: max(0.35rem, env(safe-area-inset-top, 0px));
        right: max(0.35rem, env(safe-area-inset-right, 0px));
        z-index: 2;
        width: 44px;
        height: 44px;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 999px;
        background: var(--gray-100, #f3f4f6);
        color: var(--gray-700, #374151);
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        font-family: inherit;
    }

    .crw-panel__close:hover,
    .crw-panel__close:focus-visible {
        background: var(--gray-200, #e5e7eb);
        outline: none;
    }

    .crw-panel__close:focus-visible {
        box-shadow: 0 0 0 2px var(--primary, #ed4b25);
    }
}

@media (prefers-reduced-motion: reduce) {
    .crw-tab::before {
        animation: none;
        opacity: 0;
    }
}

@media print {
    .crw {
        display: none !important;
    }
}
