/* =============================================================================
   Yasal metin modal - frontend + checkout layout ortak.
   2026-05-17: layouts/checkout.php icindeki inline <style> bloku buraya
   tasindi (Inline CSS yasak feedback'iyle uyumlu); footer yasal alt-nav
   modal'i da ayni stili kullaniyor.
   ========================================================================== */
.legal-modal {
    position: fixed;
    inset: 0;
    /* 1140 = mobile-bottom-bar (1110) ustunde. Aksi halde mobilde modal'in
       alt 60px'i alt navigasyon barinin arkasinda kaliyordu. sepet-drawer
       (1130) seviyesinin de uzeri - yasal metin acikken sepet acilamamali. */
    z-index: 1140;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.legal-modal[hidden] { display: none; }

.legal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: legalFadeIn 180ms ease-out;
}

.legal-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 880px;
    /* 100dvh: mobil tarayicilarda URL bar acilip kapaninca da gercek gorunur
       alana uyar. Fallback olarak vh kalir (eski tarayicilar). */
    height: min(86vh, 760px);
    height: min(86dvh, 760px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: legalSlideUp 220ms cubic-bezier(.21, 1.02, .73, 1);
}

.legal-modal-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(180deg, var(--brand-primary-soft, #f0fdf4) 0%, #fff 100%);
}
.legal-modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-primary-dark, #14532d);
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

.legal-modal-close {
    background: transparent;
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 140ms ease;
}
.legal-modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.legal-modal-body {
    flex: 1 1 auto;
    position: relative;
    background: #fff;
}
.legal-modal-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.legal-modal-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #64748b;
    font-size: 14px;
    background: #fff;
}
.legal-modal-loading .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--brand-primary, #15803d);
    border-radius: 50%;
    animation: legalSpin 700ms linear infinite;
}

.legal-modal-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 22px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}
.legal-modal-newtab {
    color: var(--brand-primary, #15803d);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.legal-modal-newtab:hover { text-decoration: underline; }

@keyframes legalFadeIn {
    from { opacity: 0 }
    to   { opacity: 1 }
}
@keyframes legalSlideUp {
    from { transform: translateY(16px); opacity: 0 }
    to   { transform: translateY(0);    opacity: 1 }
}
@keyframes legalSpin {
    to { transform: rotate(360deg) }
}

@media (max-width: 640px) {
    .legal-modal { padding: 0; }
    .legal-modal-dialog {
        max-width: none;
        /* 100dvh: iOS Safari + Android Chrome URL bar dinamigine uyar.
           100vh fallback - eski tarayicilar (Safari < 15.4) icin. */
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }
    /* iOS notch + home indicator: header top'a safe-area-inset-top,
       footer bottom'a safe-area-inset-bottom. max() default padding'i korur. */
    .legal-modal-header {
        padding: max(16px, env(safe-area-inset-top, 16px)) 18px 14px;
    }
    .legal-modal-footer {
        padding: 12px 18px max(14px, env(safe-area-inset-bottom, 14px));
    }
}

body.legal-modal-open { overflow: hidden; }
