/**
 * PopupManager Styles
 * Système de notifications et popups
 */

/* ============================================
   POPUP OVERLAY
   ============================================ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.popup-overlay.show {
    opacity: 1;
}

/* ============================================
   POPUP CONTAINER
   ============================================ */
.popup-container {
    background: var(--card-bg, #1e293b);
    border-radius: 16px;
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.popup-overlay.show .popup-container {
    transform: scale(1) translateY(0);
}

/* ============================================
   POPUP CONTENT
   ============================================ */
.popup-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.popup-title {
    color: var(--text-primary, #fff);
    margin: 0 0 0.75rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.popup-message {
    color: var(--text-primary, #e2e8f0);
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    line-height: 1.5;
}

/* ============================================
   POPUP ACTIONS
   ============================================ */
.popup-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.popup-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    min-width: 100px;
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.popup-btn:active {
    transform: translateY(0);
}

.popup-btn-secondary {
    background: var(--btn-secondary-bg, #334155);
    color: var(--text-primary, #fff);
}

/* ============================================
   POPUP CLOSE BUTTON
   ============================================ */
.popup-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.popup-close:hover {
    color: var(--text-primary, #fff);
    transform: scale(1.1);
}

/* ============================================
   POPUP MUTE OPTION
   ============================================ */
.popup-mute-option {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #334155);
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    font-size: 0.875rem;
}

.popup-mute-option:hover {
    color: var(--text-primary, #94a3b8);
}

.popup-mute-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ============================================
   POPUP TYPES
   ============================================ */

/* Success */
.popup-success {
    border: 2px solid #10b981;
}
.popup-success .popup-icon {
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.5));
}
.popup-success .popup-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

/* Achievement */
.popup-achievement {
    border: 2px solid #f59e0b;
    background: linear-gradient(180deg, var(--card-bg, #1e293b) 0%, rgba(245, 158, 11, 0.1) 100%);
}
.popup-achievement .popup-icon {
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.6));
    animation: achievement-bounce 0.6s ease-out;
}
.popup-achievement .popup-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

@keyframes achievement-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Unlock */
.popup-unlock {
    border: 2px solid #8b5cf6;
    background: linear-gradient(180deg, var(--card-bg, #1e293b) 0%, rgba(139, 92, 246, 0.1) 100%);
}
.popup-unlock .popup-icon {
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.5));
}
.popup-unlock .popup-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

/* Info */
.popup-info {
    border: 2px solid #3b82f6;
}
.popup-info .popup-icon {
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}
.popup-info .popup-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

/* Warning */
.popup-warning {
    border: 2px solid #ef4444;
}
.popup-warning .popup-icon {
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
}
.popup-warning .popup-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* Complete */
.popup-complete {
    border: 2px solid #2dd4bf;
    background: linear-gradient(180deg, var(--card-bg, #1e293b) 0%, rgba(45, 212, 191, 0.1) 100%);
}
.popup-complete .popup-icon {
    filter: drop-shadow(0 0 10px rgba(45, 212, 191, 0.5));
    animation: complete-sparkle 1s ease-out;
}
.popup-complete .popup-btn {
    background: linear-gradient(135deg, #2dd4bf, #14b8a6);
    color: #0f172a;
}

@keyframes complete-sparkle {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* Guide */
.popup-guide {
    border: 2px solid #06b6d4;
}
.popup-guide .popup-icon {
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.5));
}
.popup-guide .popup-btn {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
}

/* ============================================
   HISTORY BUTTON
   ============================================ */
.popup-history-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg, #1e293b);
    border: 2px solid var(--border-color, #334155);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.popup-history-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.popup-history-icon {
    font-size: 1.5rem;
}

.popup-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ============================================
   HISTORY PANEL
   ============================================ */
.popup-history-panel {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: 320px;
    max-height: 400px;
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.popup-history-panel.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.popup-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color, #334155);
}

.popup-history-header h3 {
    margin: 0;
    color: var(--text-primary, #fff);
    font-size: 1rem;
}

.popup-history-header .popup-close {
    position: static;
    font-size: 1.25rem;
}

.popup-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.popup-history-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.popup-history-item:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.05));
}

.popup-history-item.unread {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
}

.popup-history-item .popup-history-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.popup-history-content {
    flex: 1;
    min-width: 0;
}

.popup-history-content strong {
    display: block;
    color: var(--text-primary, #fff);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-history-content p {
    margin: 0;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-history-content small {
    color: var(--text-muted, #64748b);
    font-size: 0.7rem;
}

.popup-history-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary, #64748b);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .popup-container {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .popup-icon {
        font-size: 2.5rem;
    }
    
    .popup-title {
        font-size: 1.25rem;
    }
    
    .popup-message {
        font-size: 0.9rem;
    }
    
    .popup-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
        width: 100%;
    }
    
    .popup-actions {
        flex-direction: column;
    }
    
    .popup-history-panel {
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        bottom: 4.5rem;
    }
    
    .popup-history-btn {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}