/**
 * Modal System Styles
 * Custom branded modals to replace browser alert() and confirm()
 */

/* Modal Container */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* UX Modal Backdrop */
.ux-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: all;
}

.ux-modal-backdrop--active {
    opacity: 1;
}

/* UX Modal */
.ux-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ux-modal--active {
    transform: scale(1);
    opacity: 1;
}

/* UX Modal Header */
.ux-modal__header {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ux-modal__title {
    margin: 0;
    font-size: 1.25rem;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ux-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.ux-modal__close:hover {
    background: #f8f9fa;
    color: #1a1a1a;
}

/* Modal Icon */
.ux-modal__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 600;
}

.ux-modal__icon--success {
    background: #28a745;
    color: white;
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ux-modal__icon--error {
    background: #dc3545;
    color: white;
}

.ux-modal__icon--warning {
    background: #ffc107;
    color: #1a1a1a;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* Modal Body */
.ux-modal__body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    color: #495057;
    line-height: 1.6;
}

/* Modal Footer */
.ux-modal__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Modal Types */
.ux-modal--success .ux-modal__header {
    background: #f0fdf4;
    border-bottom-color: #86efac;
}

.ux-modal--danger .ux-modal__header {
    background: #fef2f2;
    border-bottom-color: #fecaca;
}

.ux-modal--danger .ux-modal__title {
    color: #dc2626;
}

.ux-modal--warning .ux-modal__header {
    background: #fffbeb;
    border-bottom-color: #fde68a;
}

.ux-modal--warning .ux-modal__title {
    color: #d97706;
}

/* Progress Modal */
.ux-modal--progress .ux-modal__body {
    text-align: center;
}

.ux-modal__progress-message {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.ux-modal__progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.ux-modal__progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3a3a7c, #5a5aa0);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.ux-modal__progress-percent {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

/* Button Styles (specific to modals) */
.ux-modal .btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ux-modal .btn-primary {
    background: var(--color-primary);
    color: white;
}

.ux-modal .btn-primary:hover {
    background: #366a94;
}

.ux-modal .btn-secondary {
    background: #6c757d;
    color: white;
}

.ux-modal .btn-secondary:hover {
    background: #5a6268;
}

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

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

.ux-modal .btn-success {
    background: #28a745;
    color: white;
}

.ux-modal .btn-success:hover {
    background: #218838;
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
    .ux-modal {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }

    .ux-modal__header,
    .ux-modal__body,
    .ux-modal__footer {
        padding: 1rem;
    }

    .ux-modal__footer {
        flex-direction: column-reverse;
    }

    .ux-modal__footer .btn {
        width: 100%;
    }
}
