/* =============================================================================
 * KVKK Aydınlatma Popup component CSS
 * Kayıt sayfasında "Metni Oku" butonu tıklanınca açılan modal.
 * Inline CSS yasak (feedback_inline_css_js_yasak.md) - tüm stiller burada.
 * Tetikleyici .kvkk-popup-trigger; modal #kvkkPopup; gizleme JS ile.
 * ========================================================================== */

/* --- Tetikleyici: form içinde "Metni Oku" link gibi görünsün, button olarak */
.kvkk-popup-trigger {
    display: inline;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: var(--brand-primary, #15803d);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.kvkk-popup-trigger:hover,
.kvkk-popup-trigger:focus {
    color: var(--brand-primary-dark, #14532d);
    text-decoration: underline;
    outline: none;
}
.kvkk-popup-trigger:focus-visible {
    outline: 2px solid var(--brand-primary, #15803d);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- Modal kabuğu --- */
.kvkk-popup {
    position: fixed;
    inset: 0;
    /* 1140 = mobile-bottom-bar (1110) ustunde. 1080'de iken mobilde popup'in
       alt kismi alt navigasyon barinin arkasinda kaliyordu. sepet-drawer
       (1130) ustu - popup acikken sepet drawer acilmasin. */
    z-index: 1140;
    display: none;
    align-items: stretch;
    justify-content: center;
}
.kvkk-popup.is-open {
    display: flex;
}
.kvkk-popup[hidden] {
    display: none !important;
}

.kvkk-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    animation: kvkkPopupOverlayIn 160ms ease-out;
}

@keyframes kvkkPopupOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.kvkk-popup-dialog {
    position: relative;
    z-index: 1;
    margin: auto;
    width: min(720px, calc(100vw - 28px));
    /* 100dvh: mobil tarayicilarda URL bar acilip kapaninca dialog gercek
       gorunur alana uyar. Fallback olarak 100vh kalir. */
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: kvkkPopupIn 220ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes kvkkPopupIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Header --- */
.kvkk-popup-header {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--c-border, #e2e8f0);
    background: #fff;
}
.kvkk-popup-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--c-text, #0f172a);
    line-height: 1.3;
}
.kvkk-popup-meta {
    margin: 0;
    font-size: 12px;
    color: var(--c-muted, #64748b);
}
.kvkk-popup-meta strong {
    color: var(--c-text, #0f172a);
    font-weight: 600;
}

.kvkk-popup-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--c-bg-soft, #f1f5f9);
    color: var(--c-text, #0f172a);
    cursor: pointer;
    transition: background 120ms ease;
}
.kvkk-popup-close:hover,
.kvkk-popup-close:focus {
    background: var(--c-border, #e2e8f0);
    outline: none;
}
.kvkk-popup-close:focus-visible {
    outline: 2px solid var(--brand-primary, #15803d);
    outline-offset: 2px;
}

/* --- Body (scrollable metin) --- */
.kvkk-popup-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 22px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}
/* Global frontend.css'teki .legal-content max-width 760px + padding 48px/80px
 * sayfa-seviyesi içindi. Modal'da article container yok - body padding'i bu işi
 * görüyor. Reset: max-width sınırsız, padding 0 ki modal body padding'i ile
 * çift padding olmasın. */
.kvkk-popup-body .legal-content {
    max-width: none;
    margin: 0;
    padding: 0;
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--c-text, #0f172a);
}
.kvkk-popup-body .legal-content :first-child { margin-top: 0; }
.kvkk-popup-body .legal-content h1,
.kvkk-popup-body .legal-content h2,
.kvkk-popup-body .legal-content h3 {
    font-weight: 700;
    color: var(--c-text, #0f172a);
    margin: 18px 0 8px;
}
.kvkk-popup-body .legal-content h1 { font-size: 18px; }
.kvkk-popup-body .legal-content h2 { font-size: 16px; }
.kvkk-popup-body .legal-content h3 { font-size: 14.5px; }
.kvkk-popup-body .legal-content p,
.kvkk-popup-body .legal-content ul,
.kvkk-popup-body .legal-content ol {
    margin: 0 0 12px;
}
.kvkk-popup-body .legal-content ul,
.kvkk-popup-body .legal-content ol {
    padding-left: 22px;
}
.kvkk-popup-body .legal-content li { margin-bottom: 4px; }
.kvkk-popup-body .legal-content a {
    color: var(--brand-primary, #15803d);
    text-decoration: underline;
}
.kvkk-popup-body .legal-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}
.kvkk-popup-body .legal-content table th,
.kvkk-popup-body .legal-content table td {
    border: 1px solid var(--c-border, #e2e8f0);
    padding: 8px 10px;
    vertical-align: top;
    text-align: left;
}
.kvkk-popup-body .legal-content table th {
    background: var(--c-bg-soft, #f8fafc);
    font-weight: 600;
}

/* --- Footer (sticky aksiyon barı) --- */
.kvkk-popup-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px 16px;
    border-top: 1px solid var(--c-border, #e2e8f0);
    background: #fff;
}
.kvkk-popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--c-muted, #64748b);
    text-decoration: none;
}
.kvkk-popup-link:hover,
.kvkk-popup-link:focus {
    color: var(--brand-primary, #15803d);
    text-decoration: underline;
    outline: none;
}
.kvkk-popup-confirm {
    min-width: 160px;
}

/* --- Body scroll-lock (JS açıkken html.kvkk-popup-acik set eder) --- */
html.kvkk-popup-acik,
html.kvkk-popup-acik body {
    overflow: hidden;
}

/* --- Mobile (< 600px) --- */
@media (max-width: 600px) {
    .kvkk-popup-dialog {
        width: 100%;
        /* 100dvh: mobil tarayicida URL bar acilinca da gercek gorunur alana uyar.
           100vh fallback - dvh desteklemeyen eski tarayicilar icin (Safari < 15.4). */
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
    }
    /* Header padding-top'a notch (env safe-area-inset-top), footer padding-bottom'a
       home indicator (env safe-area-inset-bottom) eklenir. max() sayesinde safe-area
       sifirsa default padding aynen kalir. */
    .kvkk-popup-header {
        padding: max(14px, env(safe-area-inset-top, 14px)) 16px 12px;
    }
    .kvkk-popup-body   { padding: 14px 16px 8px;  }
    .kvkk-popup-footer {
        padding: 12px 16px max(14px, env(safe-area-inset-bottom, 14px));
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .kvkk-popup-confirm { width: 100%; min-width: 0; }
    .kvkk-popup-link    { justify-content: center; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .kvkk-popup-overlay,
    .kvkk-popup-dialog {
        animation: none;
    }
}
