/* User Popup System - Matches User Panel Design */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* High z-index to be on top of everything */
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: rgba(11, 77, 184, 0.95);
    /* Deep blue with high opacity */
    border: 1px solid rgba(142, 219, 255, 0.3);
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    max-width: 360px;
    /* Slightly narrower for mobile feel */
    max-height: 90vh;
    overflow-y: auto;
    display: grid;
    gap: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: scaleIn 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    font-family: var(--ui-font, "IRYekan", sans-serif);
    color: #ffffff;
    direction: rtl;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
}

.modal-close {
    background: transparent;
    border: none;
    color: rgba(142, 219, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.modal-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(142, 219, 255, 0.3);
    border-radius: 12px;
    padding: 12px;
    font-family: inherit;
    font-size: 1rem;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.modal-input:focus {
    border-color: #3fd0ff;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.modal-btn {
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-btn:active {
    transform: scale(0.98);
}

.modal-btn.primary {
    background: linear-gradient(135deg,
            rgba(63, 208, 255, 0.95) 0%,
            rgba(11, 77, 184, 0.9) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(11, 77, 184, 0.3);
}

.modal-btn.danger {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.5);
    color: #ff6b6b;
}

.modal-btn.secondary {
    background: rgba(142, 219, 255, 0.1);
    color: rgba(142, 219, 255, 0.9);
}

.modal-btn.full-width {
    grid-column: 1 / -1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Variant styles */
.modal.is-error {
    border-color: rgba(255, 107, 107, 0.5);
}

.modal.is-error .modal-title {
    color: #ff6b6b;
}

.modal.is-success {
    border-color: rgba(77, 227, 161, 0.5);
}

.modal.is-success .modal-title {
    color: #4de3a1;
}