:root {
    --modal-bg: rgba(255, 255, 255, 0.95);
    --modal-text: #1a1a1a;
    --modal-header-bg: rgba(0, 0, 0, 0.03);
    --modal-footer-bg: rgba(0, 0, 0, 0.03);
    --modal-border: 1px solid rgba(0, 0, 0, 0.1);
    --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --modal-overlay-blur: none;
    --modal-close-color: #666;
    --modal-close-hover: #000;
}

[data-theme="dark"] {
    --modal-bg: rgba(26, 26, 26, 0.95);
    --modal-text: #ffffff;
    --modal-header-bg: rgba(255, 255, 255, 0.05);
    --modal-footer-bg: rgba(255, 255, 255, 0.05);
    --modal-border: 1px solid rgba(255, 255, 255, 0.1);
    --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --modal-close-color: #999;
    --modal-close-hover: #fff;
}

.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);
    color: var(--modal-text);
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    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: 600;
}

.custom-modal-body {
    padding: 10px;
    overflow-y: auto;
    flex-grow: 1;
}

.custom-modal-header .custom-modal-close-btn {
    color: var(--modal-close-color);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 24px;
    transition: color 0.2s ease;
    line-height: 1;
    border: none;
    background: none;
    padding: 0;
    z-index: 1;
}

[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: var(--modal-close-hover);
    text-decoration: none;
}

.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);
    }

.custom-modal-content.custom-modal-vibrate {
    animation: custom-modal-vibrate 0.3s ease-out;
}

.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);
}

.custom-modal[overlay="default"] {
    background-color: var(--modal-overlay);
    backdrop-filter: none;
}

.custom-modal[overlay="blur"] {
    background-color: var(--modal-overlay);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(10px);
}

.custom-modal[overlay="none"] {
    background-color: transparent;
    backdrop-filter: none;
}

@keyframes custom-modal-vibrate {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    50% {
        transform: translateX(8px);
    }

    75% {
        transform: translateX(-4px);
    }
}
