/**
 * Global Popup System Styles for Comi - Open Media Hub
 * Clean, modern popup design with animations
 */

/* Popup Overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.popup-show {
    opacity: 1;
}

/* Popup Container */
.popup-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.popup-show .popup-container {
    transform: scale(1) translateY(0);
}

/* Popup Header */
.popup-header {
    display: flex;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.popup-icon {
    margin-right: 12px;
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.popup-title {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.popup-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Popup Body */
.popup-body {
    padding: 16px 24px 24px;
}

.popup-message {
    margin: 0;
    color: #374151;
    line-height: 1.5;
    font-size: 14px;
}

/* Popup Footer */
.popup-footer {
    padding: 0 24px 24px;
}

.popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Popup Buttons */
.popup-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    min-width: 80px;
}

.popup-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.popup-btn-primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.popup-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.popup-btn-primary:focus {
    outline-color: #3b82f6;
}

.popup-btn-secondary {
    background: #f9fafb;
    color: #374151;
    border-color: #d1d5db;
}

.popup-btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.popup-btn-secondary:focus {
    outline-color: #6b7280;
}

.popup-btn-warning {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.popup-btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

.popup-btn-warning:focus {
    outline-color: #fbbf24;
}

.popup-btn-danger {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

.popup-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.popup-btn-danger:focus {
    outline-color: #ef4444;
}

/* Popup Type Styles */
.popup-info .popup-icon {
    background: #dbeafe;
    color: #2563eb;
}

.popup-success .popup-icon {
    background: #dcfce7;
    color: #16a34a;
}

.popup-warning .popup-icon {
    background: #fef3c7;
    color: #d97706;
}

.popup-error .popup-icon {
    background: #fee2e2;
    color: #dc2626;
}

.popup-confirm .popup-icon {
    background: #e0e7ff;
    color: #6366f1;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .popup-container {
        width: 95%;
        margin: 20px;
    }
    
    .popup-header {
        padding: 16px 20px 12px;
    }
    
    .popup-body {
        padding: 12px 20px 20px;
    }
    
    .popup-footer {
        padding: 0 20px 20px;
    }
    
    .popup-buttons {
        flex-direction: column-reverse;
    }
    
    .popup-btn {
        width: 100%;
        justify-content: center;
    }
    
    .popup-title {
        font-size: 16px;
    }
    
    .popup-message {
        font-size: 14px;
    }
}

/* Animation for different popup types */
.popup-info .popup-container {
    border-top: 4px solid #2563eb;
}

.popup-success .popup-container {
    border-top: 4px solid #16a34a;
}

.popup-warning .popup-container {
    border-top: 4px solid #d97706;
}

.popup-error .popup-container {
    border-top: 4px solid #dc2626;
}

.popup-confirm .popup-container {
    border-top: 4px solid #6366f1;
}

/* Loading state for buttons */
.popup-btn.loading {
    position: relative;
    color: transparent;
}

.popup-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .popup-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .popup-header {
        border-bottom-color: #374151;
    }
    
    .popup-title {
        color: #f9fafb;
    }
    
    .popup-message {
        color: #d1d5db;
    }
    
    .popup-close {
        color: #9ca3af;
    }
    
    .popup-close:hover {
        background: #374151;
        color: #f3f4f6;
    }
    
    .popup-btn-secondary {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .popup-btn-secondary:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
}
