/* --- Modal Backdrop --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    /* Optimizado: el blur es pesado, reducimos la complejidad de la transición */
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    /* Transiciones específicas son más fluidas que 'all' */
    transition: opacity 0.3s ease, visibility 0.3s ease, backdrop-filter 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    /* El blur se aplica dinámicamente desde JS, pero aquí definimos la transición */
}

/* --- Modal Content Box --- */
.modal-box {
    background: #ffffff;
    border-radius: 7px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    padding: 2rem;
    /* Cambiamos el scale inicial para un efecto más natural */
    transform: scale(0.95) translateY(10px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal Sizes */
.modal-box.modal-sm {
    max-width: 350px;
}

.modal-box.modal-lg {
    max-width: 800px;
}

.modal-box.modal-full {
    max-width: 95%;
    height: 95vh;
}

/* Close Button */
.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: #4b5563;
    transition: background 0.2s, transform 0.2s, color 0.2s;
}

.modal-close-btn:hover {
    background: #e5e7eb;
    color: #111827;
    transform: rotate(90deg);
}

/* Typography */
.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.75rem;
}

.modal-description {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Action Buttons Container */
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Default Action Button Styles */
.modal-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 7px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.modal-btn-primary {
    background: #111827;
    color: white;
}

.modal-btn-primary:hover {
    background: #000000;
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.modal-btn-secondary:hover {
    background: #e5e7eb;
}

.modal-btn-danger {
    background: #ef4444;
    color: white;
}

.modal-btn-danger:hover {
    background: #dc2626;
}

/* Dark Theme Support */
.modal-box.dark {
    background: var(--darkColor);
    color: #f9fafb;
}

.modal-box.dark .modal-title {
    color: #ffffff;
}

.modal-box.dark .modal-description {
    color: #9ca3af;
}

.modal-box.dark .modal-close-btn {
    background: #161d27;
    color: #9ca3af;
}