/**
 * SweetAlert2 — geniş form modalları, içerik kaydırılabilir
 */
:root {
    --plankey-swal-width: min(920px, 94vw);
    --plankey-swal-cari-width: min(680px, 92vw);
    --plankey-swal-gider-split-width: min(1240px, 96vw);
}

/* Form / işlem modalları */
.swal2-popup.swal2-plankey-form {
    width: var(--plankey-swal-width) !important;
    max-width: 94vw !important;
    padding: 1.75rem 2rem 1.5rem !important;
    max-height: calc(100dvh - 1rem) !important;
    overflow: hidden !important;
}

/* Gider kaydı + fatura önizleme (Gelen e-Fatura) */
.swal2-popup.swal2-plankey-gider-split {
    width: var(--plankey-swal-gider-split-width) !important;
    max-width: 96vw !important;
}

.swal2-popup.swal2-plankey-gider-split .swal2-html-container {
    max-height: calc(100dvh - 10.5rem) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.plankey-gider-split {
    display: grid;
    grid-template-columns: minmax(0, 42%) minmax(0, 58%);
    gap: 1.25rem;
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
    isolation: isolate;
}

.plankey-gider-split__form {
    min-width: 0;
    padding-right: 0.15rem;
    position: relative;
    z-index: 2;
    overflow: auto;
}

.plankey-gider-split__preview {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #eff2f5;
    padding-left: 1.25rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
    isolation: isolate;
}

.plankey-gider-split__preview-head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.65rem;
    flex-shrink: 0;
}

.plankey-gider-split__preview-body {
    flex: 1 1 auto;
    min-height: 12rem;
    max-height: calc(100dvh - 14rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #f9f9f9;
    border: 1px solid #eff2f5;
    border-radius: 0.475rem;
}

.plankey-gider-fatura-iframe-wrap {
    display: inline-block;
    min-width: 100%;
    width: max-content;
    vertical-align: top;
    background: #fff;
    border-radius: 0.35rem;
}

.plankey-gider-fatura-iframe {
    display: block;
    min-height: 320px;
    border: 0;
    background: #fff;
    vertical-align: top;
}

.swal2-popup.swal2-plankey-gider-split input[name="tutar"] {
    text-align: right;
}

/* Hızlı Müşteri & Tedarikçi Ekle */
.swal2-popup.swal2-plankey-cari-form {
    width: var(--plankey-swal-cari-width) !important;
    max-width: 92vw !important;
    padding: 1.35rem 1.5rem 1.25rem !important;
    max-height: calc(100dvh - 1rem) !important;
    overflow: hidden !important;
}

.swal2-popup.swal2-plankey-cari-form .swal2-title {
    font-size: 1.2rem !important;
    padding-bottom: 0.6rem !important;
}

.swal2-popup.swal2-plankey-cari-form .row {
    --bs-gutter-x: 0.85rem;
    --bs-gutter-y: 0.65rem;
}

.swal2-popup.swal2-plankey-form .swal2-title {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    padding: 0 0 0.75rem !important;
    margin: 0 !important;
}

.swal2-popup.swal2-plankey-form .swal2-html-container,
.swal2-popup.swal2-plankey-cari-form .swal2-html-container {
    max-height: calc(100dvh - 11.5rem) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0.25rem 0 0 !important;
    padding-right: 0.2rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    -webkit-overflow-scrolling: touch;
}

.swal2-popup.swal2-plankey-form .swal2-actions,
.swal2-popup.swal2-plankey-cari-form .swal2-actions,
.swal2-popup.swal2-plankey-gider-split .swal2-actions {
    position: relative;
    bottom: auto;
    background: #fff;
    margin-top: 1.5rem !important;
    padding-top: 0.5rem !important;
    border-top: 1px solid #eff2f5;
    flex-wrap: wrap;
    gap: 0.5rem;
    z-index: 1;
    flex-shrink: 0;
}

.swal2-popup.swal2-plankey-form .form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5675;
    margin-bottom: 0.35rem;
}

.swal2-popup.swal2-plankey-form .form-control,
.swal2-popup.swal2-plankey-form .form-select {
    background-color: #fff;
    border: 1px solid #e4e6ef;
    color: #181c32;
    font-size: 0.95rem;
}

.swal2-popup.swal2-plankey-form .form-control.form-control-solid,
.swal2-popup.swal2-plankey-form .form-select.form-select-solid {
    background-color: #fff !important;
    border: 1px solid #e4e6ef !important;
    color: #181c32 !important;
}

.swal2-popup.swal2-plankey-form .form-control:focus,
.swal2-popup.swal2-plankey-form .form-select:focus,
.swal2-popup.swal2-plankey-form .form-control.form-control-solid:focus,
.swal2-popup.swal2-plankey-form .form-select.form-select-solid:focus {
    background-color: #fff !important;
    border-color: #88ac35 !important;
    box-shadow: 0 0 0 0.2rem rgba(136, 172, 53, 0.15);
}

.swal2-popup.swal2-plankey-form .bg-light,
.swal2-popup.swal2-plankey-form .bg-light-warning,
.swal2-popup.swal2-plankey-form .bg-opacity-10 {
    background-color: #fff !important;
    border-color: #e4e6ef !important;
}

.swal2-popup.swal2-plankey-form .select2-container--bootstrap5 .select2-selection--single,
.swal2-popup.swal2-plankey-form .select2-container--bootstrap5 .select2-selection--multiple {
    background-color: #fff !important;
    border: 1px solid #e4e6ef !important;
    min-height: calc(1.5em + 1.1rem + 2px);
}

.swal2-popup.swal2-plankey-form .select2-container--bootstrap5 .select2-selection__rendered,
.swal2-popup.swal2-plankey-form .select2-container--bootstrap5 .select2-selection__placeholder {
    color: #181c32 !important;
}

.swal2-container .select2-container--open,
.swal2-container .select2-dropdown {
    z-index: 11050 !important;
}

.swal2-popup.swal2-plankey-form .row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 0.75rem;
}

/* PayTR ödeme iframe modalı */
.swal2-popup.swal2-plankey-paytr {
    width: min(640px, 96vw) !important;
    max-width: 96vw !important;
    display: flex !important;
    flex-direction: column !important;
}

.swal2-popup.swal2-plankey-paytr .swal2-title {
    flex-shrink: 0;
}

.swal2-popup.swal2-plankey-paytr .swal2-html-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100dvh - 7.5rem) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.paytr-iframe-wrap {
    width: 100%;
    min-height: 420px;
}

.paytr-iframe-wrap iframe {
    display: block;
    width: 100%;
    min-height: 420px;
    border: 0;
}

/* Form swal: ekran içinde kalsın, gövde kaydırılsın */
.swal2-container:has(> .swal2-popup.swal2-plankey-form),
.swal2-container:has(> .swal2-popup.swal2-plankey-cari-form) {
    align-items: flex-start !important;
    padding: 0.5rem !important;
    overflow-y: auto !important;
}

/* Onay / uyarı pencereleri (biraz daha geniş) */
.swal2-popup.swal2-plankey-dialog {
    width: min(32rem, 92vw) !important;
    max-width: 92vw !important;
    padding: 1.5rem 1.75rem !important;
}

/* KEY AI drawer (z-index 1105) üstünde; diyalog ekranın üstünde */
body[data-kt-drawer-key_ai='on'] .swal2-container {
    z-index: 1200 !important;
}

.swal2-container:has(> .swal2-popup.swal2-plankey-dialog) {
    align-items: flex-start !important;
    padding-top: max(1rem, env(safe-area-inset-top, 0px)) !important;
}

.swal2-popup.swal2-plankey-dialog .swal2-html-container,
.swal2-popup.swal2-plankey-dialog .swal2-content {
    max-height: none !important;
    overflow: visible !important;
}

.swal2-popup .swal2-close {
    width: 2rem !important;
    height: 2rem !important;
    right: 0.85rem !important;
    top: 0.85rem !important;
    color: #7e8299 !important;
    border-radius: 0.475rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.swal2-popup .swal2-close:hover {
    background: rgba(126, 130, 153, 0.12) !important;
    color: #181c32 !important;
}

/* Doğrulama uyarıları (preConfirm) — danger */
.swal2-container .swal2-validation-message {
    background-color: #fff5f8 !important;
    color: #d81a48 !important;
    border: 1px solid #f1416c !important;
    border-radius: 0.475rem !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    padding: 0.65rem 0.85rem 0.65rem 2.5rem !important;
    margin: 0.75rem 0 0 !important;
    box-shadow: none !important;
}

/* Gider formu — Swal2 tarzı uyarı (ana form açık kalır) */
.plankey-gider-form-uyari {
    position: fixed;
    inset: 0;
    z-index: 1000001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.plankey-gider-form-uyari__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 28, 50, 0.45);
}

.plankey-gider-form-uyari__card {
    position: relative;
    z-index: 1;
    width: min(32rem, calc(100vw - 2rem));
    padding: 1.5rem 1.75rem 1.35rem;
    background: #fff;
    border-radius: 0.65rem;
    box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.28);
    text-align: center;
}

.plankey-gider-form-uyari__icon.swal2-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: content-box;
    width: 5em;
    height: 5em;
    margin: 0 auto 1rem;
    font-size: 1rem;
    line-height: 1;
    border: 0.25em solid var(--bs-danger, #f1416c);
    border-radius: 50%;
    color: var(--bs-danger, #f1416c);
}

.plankey-gider-form-uyari__icon.swal2-error .swal2-x-mark {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.plankey-gider-form-uyari__icon.swal2-error [class^='swal2-x-mark-line'] {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.9375em;
    height: 0.3125em;
    margin-top: -0.15625em;
    margin-left: -1.46875em;
    border-radius: 0.125em;
    background-color: var(--bs-danger, #f1416c);
}

.plankey-gider-form-uyari__icon.swal2-error .swal2-x-mark-line-left {
    transform: rotate(45deg);
}

.plankey-gider-form-uyari__icon.swal2-error .swal2-x-mark-line-right {
    transform: rotate(-45deg);
}

.plankey-gider-form-uyari__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #181c32;
    margin: 0 0 0.5rem;
}

.plankey-gider-form-uyari__text {
    font-size: 0.95rem;
    color: #4b5675;
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.plankey-gider-form-uyari__card .btn {
    min-width: 6.5rem;
}

[data-bs-theme='dark'] .plankey-gider-form-uyari__card {
    background: #2d2f33;
    border: 1px solid #393a3d;
}

[data-bs-theme='dark'] .plankey-gider-form-uyari__title {
    color: #f5f8fa;
}

[data-bs-theme='dark'] .plankey-gider-form-uyari__text {
    color: #b5b5c3;
}

.swal2-container .swal2-validation-message::before {
    color: #f1416c !important;
}

[data-bs-theme="dark"] .swal2-container .swal2-validation-message {
    background-color: #2a1219 !important;
    color: #fb7e9c !important;
    border-color: #f1416c !important;
}

[data-bs-theme="dark"] .swal2-container .swal2-validation-message::before {
    color: #f1416c !important;
}

@media (max-width: 991.98px) {
    .swal2-popup.swal2-plankey-form,
    .swal2-popup.swal2-plankey-cari-form,
    .swal2-popup.swal2-plankey-gider-split {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 1rem 0.9rem 0.9rem !important;
    }

    .plankey-gider-split {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .plankey-gider-split__preview {
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid #eff2f5;
        padding-top: 1rem;
    }

    .plankey-gider-split__preview-body {
        max-height: 50vh;
    }

    .swal2-popup.swal2-plankey-form .swal2-title,
    .swal2-popup.swal2-plankey-cari-form .swal2-title {
        font-size: 1.15rem !important;
        padding-bottom: 0.5rem !important;
    }

    .swal2-popup.swal2-plankey-form .swal2-actions,
    .swal2-popup.swal2-plankey-cari-form .swal2-actions {
        margin-top: 0.85rem !important;
        padding-top: 0.65rem !important;
    }
}

[data-bs-theme="dark"] .swal2-popup.swal2-plankey-form .swal2-actions,
[data-bs-theme="dark"] .swal2-popup.swal2-plankey-cari-form .swal2-actions,
[data-bs-theme="dark"] .swal2-popup.swal2-plankey-gider-split .swal2-actions {
    background: var(--bs-body-bg, #1e1e2d) !important;
    border-top-color: #393a3d;
}

[data-bs-theme="dark"] .plankey-gider-split__preview {
    border-left-color: #393a3d;
}

[data-bs-theme="dark"] .plankey-gider-split__preview-body {
    background: #252536;
    border-color: #393a3d;
}

@media (max-width: 991.98px) {
    [data-bs-theme="dark"] .plankey-gider-split__preview {
        border-top-color: #393a3d;
    }
}

[data-bs-theme="dark"] .swal2-popup .swal2-close {
    color: #9A9CAE !important;
}

/* Swal icinde acilan hizli cari modal (alttaki swal kapanmadan) */
.swal2-popup.plankey-cari-parent-open {
    position: relative;
    overflow: visible !important;
}

/* Hizli cari — Swal ustu, viewport ortasinda (body'ye mount) */
.plankey-cari-nested--viewport {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem;
    margin: 0 !important;
    box-sizing: border-box;
}

.plankey-cari-nested--viewport .plankey-cari-nested__backdrop {
    position: fixed;
    inset: 0;
    z-index: 999998;
    border-radius: 0;
    background: rgba(24, 28, 50, 0.55);
}

.plankey-cari-nested--viewport .plankey-cari-nested__card {
    position: relative;
    z-index: 1000000 !important;
    width: min(680px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: auto;
}

.plankey-cari-nested--viewport .plankey-cari-nested__body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100dvh - 11rem);
}

.plankey-cari-nested {
    position: absolute;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    overflow: hidden;
    box-sizing: border-box;
}

.plankey-cari-nested__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 28, 50, 0.35);
    border-radius: 0.65rem;
}

.plankey-cari-nested__card {
    position: relative;
    z-index: 1000000;
    width: calc(100% - 1rem);
    max-width: min(680px, calc(100% - 1rem));
    max-height: none;
    background: #fff;
    border-radius: 0.65rem;
    box-shadow: 0 1rem 2.25rem rgba(15, 23, 42, 0.32);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.plankey-cari-nested__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.plankey-cari-nested__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #181c32;
}

.plankey-cari-nested__body {
    overflow: visible;
    overflow-x: hidden;
    min-width: 0;
    flex: 0 1 auto;
}

.plankey-cari-nested__body .row {
    --bs-gutter-x: 0.85rem;
    --bs-gutter-y: 0.65rem;
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
}

.plankey-cari-nested__body [class*='col-'] {
    min-width: 0;
}

.plankey-cari-nested__body .form-control,
.plankey-cari-nested__body .form-select,
.plankey-cari-nested__body .select2-container {
    max-width: 100%;
}

.plankey-cari-nested__body textarea.form-control {
    resize: vertical;
}

.plankey-cari-nested__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.65rem;
    border-top: 1px solid #eff2f5;
    flex-shrink: 0;
}

@media (max-width: 991.98px) {
    .plankey-cari-nested:not(.plankey-cari-nested--viewport) {
        align-items: flex-start;
        padding: 0.35rem;
    }

    .plankey-cari-nested--viewport {
        align-items: center !important;
        padding: 0.5rem;
    }

    .plankey-cari-nested__card {
        width: 100%;
        padding: 0.75rem 0.85rem 0.8rem;
    }

    .plankey-cari-nested--viewport .plankey-cari-nested__card {
        width: min(680px, calc(100vw - 1rem));
    }

    .plankey-cari-nested__body .row > [class*='col-md-'] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

[data-bs-theme="dark"] .plankey-cari-nested__backdrop {
    background: rgba(0, 0, 0, 0.45);
}

[data-bs-theme="dark"] .plankey-cari-nested__card {
    background: #2d2f33;
    border: 1px solid #393a3d;
}

[data-bs-theme="dark"] .plankey-cari-nested__title {
    color: #f5f8fa;
}

[data-bs-theme="dark"] .plankey-cari-nested__footer {
    border-top-color: #393a3d;
}

/* Türk Lirası (₺) — butonlarda ki-dollar yerine */
.plankey-icon-tl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

/* Randevu durum seçimi (Swal2 içinde radyo listesi) */
.esnaf-durum-secenekler {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.esnaf-durum-secenek {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border: 1px solid var(--bs-gray-300, #dbdfe9);
    border-radius: 0.65rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    margin: 0;
}

.esnaf-durum-secenek:hover {
    background-color: var(--bs-gray-100, #f9f9f9);
}

.esnaf-durum-secenek.aktif {
    border-color: var(--bs-primary, #1b84ff);
    background-color: var(--bs-primary-light, #e9f3ff);
}

.esnaf-durum-secenek .form-check-input {
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

[data-bs-theme="dark"] .esnaf-durum-secenek {
    border-color: #393a3d;
}

[data-bs-theme="dark"] .esnaf-durum-secenek:hover {
    background-color: #2d2f33;
}

[data-bs-theme="dark"] .esnaf-durum-secenek.aktif {
    background-color: rgba(27, 132, 255, 0.15);
}
