/* ========== POPUP SYSTEM ========== */
/* Lightweight modal dialogs using CSS variables */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-overlay);
    backdrop-filter: blur(2px);
}

.popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popup);
    z-index: var(--z-modal);
    min-width: 300px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.popup-error {
    border-top: 4px solid var(--color-danger);
}

.popup-data-incomplete {
    border-top: 4px solid var(--color-warning);
}

.popup-spinner {
    border-top: 4px solid var(--color-accent);
}

.popup-regular {
    border-top: 4px solid var(--color-accent);
}

/* Header */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.popup-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Body */
.popup-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
    color: var(--color-text-primary);
}

.popup-body p {
    margin: 0 0 var(--spacing-md) 0;
}

.popup-body p:last-child {
    margin-bottom: 0;
}

/* Footer */
.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--color-border-light);
}

.popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-family: inherit;
    line-height: 1.5;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.popup-btn.regular, .popup-btn.neutral {
    background: var(--color-neutral);
    color: white;
    border: 1px solid var(--color-neutral);
}
.popup-btn.regular:hover, .popup-btn.neutral:hover {
    background: var(--color-neutral-hover);
    border-color: var(--color-neutral-hover);
}
.popup-btn.positive, .popup-btn.success {
    background: var(--color-success);
    color: white;
}
.popup-btn.positive:hover, .popup-btn.success:hover {
    background: var(--color-success-hover);
}
.popup-btn.negative, .popup-btn.danger {
    background: var(--color-danger);
    color: white;
}
.popup-btn.negative:hover, .popup-btn.danger:hover {
    background: var(--color-danger-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .popup {
        min-width: 280px;
        max-width: 95vw;
    }

    .popup-header,
    .popup-body,
    .popup-footer {
        padding: var(--spacing-md);
    }

    .popup-footer {
        flex-direction: column;
    }

    .popup-btn {
        width: 100%;
    }
}