/* ===== CUSTOM POPUP SYSTEM ===== */
.custom-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn 0.3s ease;
}

.custom-popup-overlay.show {
    display: flex;
}

.custom-popup {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary-gold);
    animation: slideUp 0.3s ease;
    transform-origin: center center;
}

.custom-popup-header {
    background: linear-gradient(135deg, var(--primary-gold), var(--secondary-gold));
    color: var(--white);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.custom-popup-icon {
    font-size: var(--font-size-xl);
}

.custom-popup-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-heading);
    flex: 1;
}

.custom-popup-body {
    padding: var(--space-5);
    text-align: center;
}

.custom-popup-message {
    font-size: var(--font-size-base);
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: var(--space-4);
}

.custom-popup-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--silver);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-base);
    margin-bottom: var(--space-4);
    transition: var(--transition-fast);
}

.custom-popup-input:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px var(--gold-10);
}

.custom-popup-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.custom-popup-actions .btn {
    flex: 1;
    justify-content: center;
    padding: var(--space-3);
}

/* Tipos de popup */
.custom-popup.alert {
    border-color: var(--info-color);
}

.custom-popup.alert .custom-popup-header {
    background: linear-gradient(135deg, var(--info-color), #5bc0de);
}

.custom-popup.success {
    border-color: var(--success-color);
}

.custom-popup.success .custom-popup-header {
    background: linear-gradient(135deg, var(--success-color), #5cb85c);
}

.custom-popup.warning {
    border-color: var(--warning-color);
}

.custom-popup.warning .custom-popup-header {
    background: linear-gradient(135deg, var(--warning-color), #f0ad4e);
}

.custom-popup.error {
    border-color: var(--danger-color);
}

.custom-popup.error .custom-popup-header {
    background: linear-gradient(135deg, var(--danger-color), #d9534f);
}

.custom-popup.confirm {
    border-color: var(--primary-gold);
}

/* Loading popup */
.custom-popup.loading .custom-popup-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.custom-popup.loading .custom-popup-message {
    margin-bottom: 0;
}

.loading-spinner-popup {
    width: 40px;
    height: 40px;
    border: 3px solid var(--platinum);
    border-top: 3px solid var(--primary-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Toast notification */
.custom-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 4000;
    max-width: 350px;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    display: none;
    align-items: center;
    gap: var(--space-3);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
}

.custom-toast.show {
    display: flex;
}

.custom-toast.success {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.05);
}

.custom-toast.error {
    border-color: var(--danger-color);
    background: rgba(220, 53, 69, 0.05);
}

.custom-toast.warning {
    border-color: var(--warning-color);
    background: rgba(255, 193, 7, 0.05);
}

.custom-toast.info {
    border-color: var(--info-color);
    background: rgba(23, 162, 184, 0.05);
}

.custom-toast-icon {
    font-size: var(--font-size-lg);
}

.custom-toast.success .custom-toast-icon {
    color: var(--success-color);
}

.custom-toast.error .custom-toast-icon {
    color: var(--danger-color);
}

.custom-toast.warning .custom-toast-icon {
    color: var(--warning-color);
}

.custom-toast.info .custom-toast-icon {
    color: var(--info-color);
}

.custom-toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-dark);
}

.custom-toast-close {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-toast-close:hover {
    background: var(--platinum);
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 480px) {
    .custom-popup {
        max-width: 100%;
    }
    
    .custom-popup-actions {
        flex-direction: column;
    }
    
    .custom-toast {
        left: var(--space-3);
        right: var(--space-3);
        max-width: 100%;
    }
}