﻿/* ==================================================
   CUSTOM MODAL
   هماهنگ با قالب custom-education-theme
   - Design: glass + blur + accent gradient
   - Layout: دست‌نخورده (همون ساختار قبلی)
   ================================================== */

:root {
    --modal-bg: var(--glass-container-bg);
    --modal-text: var(--text-primary);
    --modal-header-bg: var(--accent-glow-05);
    --modal-footer-bg: var(--accent-glow-05);
    --modal-border: 1px solid var(--glass-border);
    --modal-shadow: var(--glass-shadow-hover);
    --modal-overlay: rgba(var(--accent-3-rgb), 0.5);
    --modal-overlay-blur: blur(8px);
    --modal-close-color: var(--text-secondary);
    --modal-close-hover: var(--accent);
}

[data-theme="dark"] {
    --modal-bg: var(--glass-container-bg);
    --modal-text: var(--text-primary);
    --modal-header-bg: var(--accent-glow-08);
    --modal-footer-bg: var(--accent-glow-08);
    --modal-border: 1px solid var(--glass-border);
    --modal-shadow: var(--glass-shadow-hover);
    --modal-overlay: rgba(var(--accent-3-rgb), 0.75);
    --modal-close-color: var(--text-secondary);
    --modal-close-hover: var(--accent);
}

.custom-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--modal-overlay);
    backdrop-filter: var(--modal-overlay-blur);
    -webkit-backdrop-filter: var(--modal-overlay-blur);
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    opacity: 0;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}

    .custom-modal.custom-modal-visible {
        opacity: 1;
    }

.custom-modal-content {
    background-color: var(--modal-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    color: var(--modal-text);
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
    width: 90%;
    max-height: 90vh;
    border: var(--modal-border);
    box-shadow: var(--modal-shadow);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal-visible .custom-modal-content {
    transform: scale(1);
}

.custom-modal-sm {
    max-width: 400px;
}

.custom-modal-md {
    max-width: 600px;
}

.custom-modal-lg {
    max-width: 800px;
}

.custom-modal-xl {
    max-width: 1000px;
}

.custom-modal-xxl {
    max-width: 1200px;
}

.custom-modal-header {
    background-color: var(--modal-header-bg);
    color: var(--modal-text);
    padding: 20px 24px;
    position: relative;
    border-bottom: var(--modal-border);
}

.custom-modal-footer {
    background-color: var(--modal-footer-bg);
    color: var(--modal-text);
    padding: 20px 24px;
    position: relative;
    border-top: var(--modal-border);
}

.custom-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.custom-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex-grow: 1;
    color: var(--text-primary);
}

/* ============ CLOSE BUTTON ============ */
.custom-modal-header .custom-modal-close-btn {
    color: var(--modal-close-color);
    font-size: 26px;
    font-weight: 700;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 24px;
    transition: var(--transition);
    line-height: 1;
    border: none;
    background: none;
    padding: 0;
    z-index: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

[dir="rtl"] .custom-modal-header .custom-modal-close-btn {
    right: auto;
    left: 24px;
}

.custom-modal-header .custom-modal-close-btn:hover,
.custom-modal-header .custom-modal-close-btn:focus {
    color: #fff;
    background: var(--accent-gradient);
    text-decoration: none;
    transform: translateY(-50%) rotate(90deg);
    box-shadow: 0 6px 18px var(--accent-glow-35);
}

/* ============ FULLSCREEN ============ */
.custom-modal-fullscreen {
    padding: 0 !important;
}

    .custom-modal-fullscreen .custom-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        transform: scale(1);
    }

/* ============ VIBRATE ============ */
.custom-modal-content.custom-modal-vibrate {
    animation: custom-modal-vibrate 0.3s ease-out;
}

/* ============ ANIMATIONS ============ */
.custom-modal[animation="top"] .custom-modal-content {
    transform: translateY(-50px) scale(0.95);
}

.custom-modal[animation="bottom"] .custom-modal-content {
    transform: translateY(50px) scale(0.95);
}

.custom-modal[animation="left"] .custom-modal-content {
    transform: translateX(-50px) scale(0.95);
}

.custom-modal[animation="right"] .custom-modal-content {
    transform: translateX(50px) scale(0.95);
}

.custom-modal[animation="center"] .custom-modal-content {
    transform: scale(0.95);
}

.custom-modal.custom-modal-visible[animation="top"] .custom-modal-content,
.custom-modal.custom-modal-visible[animation="bottom"] .custom-modal-content,
.custom-modal.custom-modal-visible[animation="left"] .custom-modal-content,
.custom-modal.custom-modal-visible[animation="right"] .custom-modal-content,
.custom-modal.custom-modal-visible[animation="center"] .custom-modal-content {
    transform: translate(0) scale(1);
}

/* ============ OVERLAY VARIANTS ============ */
.custom-modal[overlay="default"] {
    background-color: var(--modal-overlay);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.custom-modal[overlay="blur"] {
    background-color: var(--modal-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.custom-modal[overlay="none"] {
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.custom-modal-content.custom-modal-overflow-show,
.custom-modal-content.custom-modal-overflow-show .custom-modal-body {
    overflow: unset !important;
    max-height: unset !important;
}

/* ============ VIBRATE KEYFRAMES ============ */
@keyframes custom-modal-vibrate {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    50% {
        transform: translateX(8px);
    }

    75% {
        transform: translateX(-4px);
    }
}
