/* ===== MODAL COMPONENT STYLES ===== */

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--backdrop-overlay);
    backdrop-filter: var(--backdrop-blur-sm);
    -webkit-backdrop-filter: var(--backdrop-blur-sm);
    z-index: var(--z-90);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-100);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    overflow: hidden;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

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

.modal-lg {
    max-width: 700px;
}

.modal-xl {
    max-width: 900px;
}

.modal-fullscreen {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4) var(--spacing-6);
    border-bottom: 1px solid var(--border-primary);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: var(--text-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--accent-red);
}

/* Modal Body */
.modal-body {
    padding: var(--spacing-6);
    overflow-y: auto;
    flex: 1;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-3);
    padding: var(--spacing-4) var(--spacing-6);
    border-top: 1px solid var(--border-primary);
}

/* Modal Positions */
.modal-top {
    top: 0;
    transform: translate(-50%, 0) scale(0.95);
}

.modal-top.active {
    transform: translate(-50%, 0) scale(1);
}

.modal-bottom {
    top: auto;
    bottom: 0;
    transform: translate(-50%, 0) scale(0.95);
}

.modal-bottom.active {
    transform: translate(-50%, 0) scale(1);
}

.modal-left {
    top: 0;
    left: 0;
    transform: translate(0, 0) scale(0.95);
    height: 100vh;
    max-height: 100vh;
    width: 300px;
    border-radius: 0;
}

.modal-left.active {
    transform: translate(0, 0) scale(1);
}

.modal-right {
    top: 0;
    left: auto;
    right: 0;
    transform: translate(0, 0) scale(0.95);
    height: 100vh;
    max-height: 100vh;
    width: 300px;
    border-radius: 0;
}

.modal-right.active {
    transform: translate(0, 0) scale(1);
}

/* Modal with Tabs */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.modal-tab {
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.modal-tab:hover {
    color: var(--text-primary);
}

.modal-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* Modal with Steps */
.modal-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4) var(--spacing-6);
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.modal-step {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    position: relative;
    flex: 1;
    text-align: center;
}

.modal-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -50%;
    width: 100%;
    height: 1px;
    background: var(--border-primary);
    z-index: var(--z-0);
}

.modal-step-number {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    z-index: var(--z-10);
}

.modal-step.active {
    color: var(--text-primary);
}

.modal-step.active .modal-step-number {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.modal-step.completed .modal-step-number {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
}

.modal-step.completed:not(:last-child)::after {
    background: var(--accent-green);
}

/* Modal Loading State */
.modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary-50);
    backdrop-filter: var(--backdrop-blur-sm);
    -webkit-backdrop-filter: var(--backdrop-blur-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-110);
}

.modal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--accent-blue);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

/* Responsive Styles */
@media (max-width: 576px) {
    .modal {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--spacing-4);
    }
    
    .modal-footer {
        flex-direction: column;
        gap: var(--spacing-2);
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}