/**
 * SweetAlert2 — تم هم‌رنگ با jijiboo / پنل سوپرادمین
 * رنگ‌ها از tailwind.config.js: primary #6b97c4، showcase.title #2f4a6b
 */

:root {
    --swal2-z-index: 2147483646;
    --swal2-backdrop: rgba(31, 51, 78, 0.38);
    --kids-swal-primary: #6b97c4;
    --kids-swal-primary-light: #8eb3d6;
    --kids-swal-primary-dark: #4d7aab;
    --kids-swal-teal: #2f4a6b;
    --kids-swal-teal-soft: #4d7aab;
    --kids-swal-ink: #1a1d28;
    --kids-swal-muted: #5e7a99;
    --kids-swal-page-bg: #eaf1f9;
    --kids-swal-success: #6b97c4;
    --kids-swal-warning: #4d7aab;
    --kids-swal-error: #3a6394;
    --kids-swal-info: #6b97c4;
}

.swal2-container {
    z-index: 2147483646 !important;
    font-family: "Vazirmatn", ui-sans-serif, system-ui, sans-serif;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
}

.swal2-container.swal2-backdrop-show:not(.kids-toast-container) {
    background: var(--swal2-backdrop) !important;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: background-color 0.2s ease;
}

.swal2-container.swal2-backdrop-hide:not(.kids-toast-container) {
    background: transparent !important;
    transition: background-color 0.15s ease;
}

.swal2-popup.kids-swal-popup {
    border-radius: 24px;
    border: 2px solid rgba(107, 151, 196, 0.25);
    background: linear-gradient(
        165deg,
        rgba(255, 255, 255, 0.97) 0%,
        rgba(245, 246, 251, 0.98) 45%,
        rgba(255, 255, 255, 0.99) 100%
    );
    box-shadow:
        0 8px 24px rgba(31, 51, 78, 0.1),
        0 24px 52px rgba(31, 51, 78, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.9) inset;
    padding: 1.5rem 1.35rem 1.25rem;
    max-width: min(28rem, calc(100vw - 2rem));
    animation: swal-popup-bounce-in 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes swal-popup-bounce-in {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.swal2-title.kids-swal-title {
    color: var(--kids-swal-teal);
    font-weight: 900;
    font-size: 1.25rem;
    line-height: 1.4;
    padding: 0.5rem 0 0;
    animation: swal-title-fade-in 0.3s ease 0.2s both;
}

@keyframes swal-title-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.swal2-html-container.kids-swal-text {
    color: var(--kids-swal-muted);
    font-weight: 600;
    font-size: 0.96rem;
    line-height: 1.65;
    margin: 0.45rem 0 0;
    animation: swal-text-fade-in 0.3s ease 0.3s both;
}

@keyframes swal-text-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.swal2-actions {
    margin: 1.15rem auto 0;
    gap: 0.55rem;
    flex-direction: row-reverse;
    width: 100%;
    max-width: 100%;
}

.swal2-styled {
    margin: 0 !important;
    min-height: 50px;
    padding: 0.65rem 1.35rem !important;
    font-family: inherit !important;
    font-size: 0.94rem !important;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.swal2-styled:focus {
    box-shadow: 0 0 0 3px rgba(107, 151, 196, 0.22) !important;
}

.swal2-styled.kids-swal-confirm {
    border-radius: 16px !important;
    font-weight: 800 !important;
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--kids-swal-primary) 0%,
        var(--kids-swal-primary-light) 100%
    ) !important;
    border: none !important;
    box-shadow:
        0 4px 16px rgba(107, 151, 196, 0.4),
        0 3px 0 rgba(77, 122, 171, 0.4) inset;
    animation: swal-button-fade-in 0.3s ease 0.4s both;
}

.swal2-styled.kids-swal-confirm:hover {
    filter: brightness(1.08);
    transform: scale(1.03);
    box-shadow:
        0 6px 22px rgba(107, 151, 196, 0.48),
        0 3px 0 rgba(77, 122, 171, 0.4) inset;
}

.swal2-styled.kids-swal-confirm:active {
    transform: translateY(2px) scale(0.98);
}

@keyframes swal-button-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.swal2-styled.kids-swal-cancel {
    border-radius: 16px !important;
    font-weight: 700 !important;
    color: var(--kids-swal-muted) !important;
    background: #eef1f7 !important;
    border: 2px solid #d8deea !important;
    box-shadow: none !important;
    animation: swal-button-fade-in 0.3s ease 0.4s both;
}

.swal2-styled.kids-swal-cancel:hover {
    background: #e4e9f2 !important;
    border-color: #cbd5e1 !important;
    transform: scale(1.02);
}

/* آیکن‌ها هم‌خوان با رنگ‌بندی سایت - بزرگتر برای کودکان */
.swal2-icon {
    margin: 0.75rem auto 0.35rem;
    border-width: 3px;
    width: 6rem !important;
    height: 6rem !important;
    animation: swal-icon-bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes swal-icon-bounce-in {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.15) rotate(5deg);
    }
    70% {
        transform: scale(0.95) rotate(-2deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.swal2-icon.swal2-success {
    border-color: var(--kids-swal-success) !important;
    color: var(--kids-swal-success) !important;
}

.swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: var(--kids-swal-success) !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(107, 151, 196, 0.35) !important;
}

.swal2-icon.swal2-error {
    border-color: var(--kids-swal-error) !important;
    color: var(--kids-swal-error) !important;
}

.swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
    background-color: var(--kids-swal-error) !important;
}

.swal2-icon.swal2-warning {
    border-color: var(--kids-swal-warning) !important;
    color: var(--kids-swal-warning) !important;
}

.swal2-icon.swal2-info {
    border-color: var(--kids-swal-info) !important;
    color: var(--kids-swal-info) !important;
}

.swal2-timer-progress-bar {
    background: linear-gradient(
        90deg,
        var(--kids-swal-primary),
        var(--kids-swal-primary-light)
    ) !important;
}

/* توست — زیر هدر ثابت، خوانا روی پس‌زمینه روشن */
.swal2-container.kids-toast-container.swal2-top {
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: var(--kids-toast-top-offset, 5.75rem) !important;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    pointer-events: none;
}

.swal2-container.kids-toast-container .swal2-popup {
    pointer-events: auto;
}

.swal2-popup.swal2-toast.kids-store-toast {
    direction: rtl;
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    gap: 0.5rem;
    border: 2px solid rgba(47, 74, 107, 0.14) !important;
    border-radius: 1rem !important;
    box-shadow:
        0 10px 28px rgba(31, 51, 78, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.85) inset !important;
    background: #ffffff !important;
    padding: 0.7rem 1rem 0.7rem 0.9rem !important;
    min-width: min(22rem, calc(100vw - 2rem));
    max-width: min(32rem, calc(100vw - 2rem));
}

.swal2-popup.swal2-toast.kids-store-toast.kids-store-toast--success {
    border-color: rgba(107, 151, 196, 0.45) !important;
    background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%) !important;
}

.swal2-popup.swal2-toast.kids-store-toast.kids-store-toast--error {
    border-color: rgba(58, 99, 148, 0.5) !important;
    background: linear-gradient(180deg, #ffffff 0%, #eef3fa 100%) !important;
}

.swal2-popup.swal2-toast.kids-store-toast.kids-store-toast--warning {
    border-color: rgba(180, 120, 20, 0.45) !important;
    background: linear-gradient(180deg, #ffffff 0%, #fff9eb 100%) !important;
}

.swal2-popup.swal2-toast.kids-store-toast.kids-store-toast--info {
    border-color: rgba(107, 151, 196, 0.35) !important;
    background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%) !important;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-title {
    direction: rtl;
    margin: 0 0.5rem 0 0 !important;
    padding: 0 !important;
    font-weight: 800 !important;
    font-size: 0.92rem !important;
    line-height: 1.5 !important;
    color: #1a1d28 !important;
    text-align: right !important;
    flex: 1;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-timer-progress-bar {
    display: block !important;
    height: 3px !important;
    opacity: 0.85;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-icon {
    margin: 0 !important;
    width: 1.75rem !important;
    height: 1.75rem !important;
    min-width: 1.75rem !important;
    min-height: 1.75rem !important;
    border: none !important;
    border-radius: 9999px !important;
    flex-shrink: 0;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-icon.swal2-success {
    background: #6b97c4 !important;
    color: #fff !important;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: #fff !important;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-icon.swal2-success .swal2-success-ring {
    border: none !important;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-icon.swal2-error {
    background: #3a6394 !important;
    color: #fff !important;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
    background-color: #fff !important;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-icon-content {
    font-size: 0.85rem !important;
    line-height: 1 !important;
}

.swal2-popup.swal2-toast.kids-store-toast .swal2-html-container {
    display: none !important;
}

@media (max-width: 480px) {
    .swal2-popup.kids-swal-popup {
        padding: 1.1rem 1rem 1rem;
        border-radius: 18px;
    }

    .swal2-title.kids-swal-title {
        font-size: 1.05rem;
    }

    .swal2-actions {
        flex-direction: column-reverse;
    }

    .swal2-styled {
        width: 100% !important;
    }
}

/* Shared form UX (superadmin modals, parent panel, store) */
.form-label .req {
    color: #c53030;
    margin-inline-start: 0.15em;
    font-weight: 800;
}
.modal-form-message,
.inline-form-banner {
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: 0.86rem;
    line-height: 1.5;
}
.modal-form-message.error,
.inline-form-banner.error,
.form-message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #9b2c2c;
}
.modal-form-message.success,
.form-message.success {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}
.field-error {
    font-size: 0.8rem;
    color: #c53030;
    margin-top: 0.25rem;
}
.form-input.is-invalid {
    border-color: #c53030 !important;
    box-shadow: 0 0 0 1px rgba(197, 48, 48, 0.2);
}
