/* ============================================
   Republic Financial - Modal Component Library
   ============================================ */

/* Modal Overlay */
.modal-overlay-factsheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-all);
    padding: var(--space-4);
}

[data-theme="dark"] .modal-overlay-factsheet {
    background: rgba(0, 0, 0, 0.8);
}

.modal-overlay-factsheet.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal-factsheet {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.9);
    opacity: 0;
    transition: var(--transition-all);
}

.modal-overlay-factsheet.active .modal-factsheet {
    transform: scale(1);
    opacity: 1;
}

/* Modal Sizes */
.modal-factsheet.modal-sm {
    max-width: 400px;
}

.modal-factsheet.modal-lg {
    max-width: 900px;
}

.modal-factsheet.modal-xl {
    max-width: 1200px;
}

.modal-factsheet.modal-fullscreen {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
}

/* Modal Header */
.modal-header-factsheet {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title-factsheet {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0;
}

.modal-close-factsheet {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-all);
}

.modal-close-factsheet:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Modal Body */
.modal-body-factsheet {
    padding: var(--space-5);
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.modal-factsheet.modal-fullscreen .modal-body-factsheet {
    max-height: calc(100vh - 140px);
}

/* Modal Footer */
.modal-footer-factsheet {
    padding: var(--space-5);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}

.modal-footer-factsheet.centered {
    justify-content: center;
}

.modal-footer-factsheet.space-between {
    justify-content: space-between;
}

/* Alert Modals */
.modal-alert-factsheet {
    text-align: center;
}

.modal-alert-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: var(--text-3xl);
}

.modal-alert-icon.success {
    background: color-mix(in srgb, var(--color-success) 15%, var(--bg-card));
    color: var(--color-success);
}

.modal-alert-icon.warning {
    background: color-mix(in srgb, var(--color-warning) 15%, var(--bg-card));
    color: var(--color-warning);
}

.modal-alert-icon.error {
    background: color-mix(in srgb, var(--color-danger) 15%, var(--bg-card));
    color: var(--color-danger);
}

.modal-alert-icon.info {
    background: color-mix(in srgb, var(--color-info) 15%, var(--bg-card));
    color: var(--color-info);
}

.modal-alert-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.modal-alert-message {
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

/* Confirm Modal */
.modal-confirm-factsheet .modal-body-factsheet {
    padding: var(--space-6);
}

.modal-confirm-message {
    font-size: var(--text-base);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

/* Upload Modal */
.modal-upload-factsheet {
    max-width: 700px;
}

.upload-dropzone {
    border: 2px dashed var(--border-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    background: var(--bg-muted);
    transition: var(--transition-all);
    cursor: pointer;
}

.upload-dropzone:hover {
    border-color: var(--brand-primary);
    background: var(--bg-hover);
}

.upload-dropzone.dragging {
    border-color: var(--brand-primary);
    background: color-mix(in srgb, var(--brand-primary) 10%, var(--bg-card));
}

.upload-icon {
    font-size: var(--text-4xl);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.upload-text {
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.upload-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Progress Modal */
.modal-progress-factsheet {
    min-width: 400px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.progress-label {
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.progress-percentage {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--brand-primary);
}

.progress-bar-container {
    height: 8px;
    background: var(--bg-muted);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.progress-bar-fill {
    height: 100%;
    background: var(--brand-primary);
    transition: width 0.3s ease;
}

/* Modal Animations */
@keyframes modalSlideIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(50px);
        opacity: 0;
    }
}

.modal-factsheet.slide-in {
    animation: modalSlideIn 0.3s ease;
}

.modal-factsheet.slide-out {
    animation: modalSlideOut 0.3s ease;
}

/* Side Modal */
.modal-side-factsheet {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100%;
    background: var(--bg-card);
    box-shadow: var(--shadow-2xl);
    transform: translateX(100%);
    transition: var(--transition-all);
    z-index: 1001;
    overflow-y: auto;
}

.modal-side-factsheet.active {
    transform: translateX(0);
}

.modal-side-factsheet .modal-header-factsheet {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast-factsheet {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-3) var(--space-4);
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transform: translateX(calc(100% + var(--space-4)));
    transition: var(--transition-all);
    pointer-events: auto;
}

.toast-factsheet.show {
    transform: translateX(0);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-icon.success {
    background: color-mix(in srgb, var(--color-success) 15%, var(--bg-card));
    color: var(--color-success);
}

.toast-icon.error {
    background: color-mix(in srgb, var(--color-danger) 15%, var(--bg-card));
    color: var(--color-danger);
}

.toast-icon.warning {
    background: color-mix(in srgb, var(--color-warning) 15%, var(--bg-card));
    color: var(--color-warning);
}

.toast-icon.info {
    background: color-mix(in srgb, var(--color-info) 15%, var(--bg-card));
    color: var(--color-info);
}

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-1);
}

.toast-close:hover {
    color: var(--text-primary);
}