/* Enhanced Reusable Notification System */
.popup-message {
    position: fixed;
    top: 20px;
    right: 20px;
    display: none;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    color: white;
    z-index: 1055;
    min-width: 350px;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 400;
    line-height: 1.5;
}

.popup-message .popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.popup-message .popup-title {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.popup-message .popup-title i {
    font-size: 1.2rem;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.popup-message .popup-content {
    font-size: 0.95rem;
    line-height: 1.4;
    opacity: 0.95;
    margin-left: 1.7rem; /* Align with title text */
}

.popup-message .close-button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 1rem;
}

.popup-message .close-button:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: scale(1.1);
}

.popup-message.show {
    display: block;
    animation: slideInBounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.popup-message.hide {
    animation: slideOut 0.3s ease-in forwards;
}

/* Enhanced color scheme aligned with app theme */
.popup-message.success { 
    /* Aligned with app theme - using dark green as primary success color */
    background: linear-gradient(135deg, #2F4728 0%, #3d5a34 100%);
    border-color: rgba(47, 71, 40, 0.3);
    box-shadow: 0 8px 32px rgba(47, 71, 40, 0.2);
}

.popup-message.success .popup-title i {
    color: #90EE90; /* Light green icon for contrast */
}

.popup-message.error { 
    /* International standard red for errors (ISO 3864-1) */
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: rgba(220, 53, 69, 0.3);
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.2);
}

.popup-message.error .popup-title i {
    color: #FFB6C1; /* Light red icon for contrast */
}

.popup-message.warning { 
    /* International standard amber/orange for warnings (ISO 3864-1) */
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    border-color: rgba(255, 140, 0, 0.3);
    color: white;
    box-shadow: 0 8px 32px rgba(255, 140, 0, 0.2);
}

.popup-message.warning .popup-title i {
    color: #FFFFE0; /* Light yellow icon for contrast */
}

.popup-message.warning .close-button {
    color: rgba(255, 255, 255, 0.8);
}

.popup-message.warning .close-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.popup-message.info { 
    /* International standard blue for information */
    background: linear-gradient(135deg, #0066cc 0%, #004d99 100%);
    border-color: rgba(0, 102, 204, 0.3);
    box-shadow: 0 8px 32px rgba(0, 102, 204, 0.2);
}

.popup-message.info .popup-title i {
    color: #ADD8E6; /* Light blue icon for contrast */
}

.popup-message.notice { 
    /* Neutral color for general notices */
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border-color: rgba(108, 117, 125, 0.3);
    box-shadow: 0 8px 32px rgba(108, 117, 125, 0.2);
}

.popup-message.notice .popup-title i {
    color: #D3D3D3; /* Light gray icon for contrast */
}

/* Enhanced animations */
@keyframes slideInBounce {
    0% {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
    60% {
        transform: translateX(-10%) scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOut {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}

/* Progress bar for auto-dismiss */
.popup-message .progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 0 0 12px 12px;
    animation: progressCountdown 4s linear forwards;
}

@keyframes progressCountdown {
    from { width: 100%; }
    to { width: 0%; }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .popup-message {
        right: 10px;
        left: 10px;
        min-width: unset;
        max-width: unset;
        top: 10px;
    }
    
    @keyframes slideInBounce {
        0% {
            transform: translateY(-100%) scale(0.8);
            opacity: 0;
        }
        60% {
            transform: translateY(10%) scale(1.05);
            opacity: 0.9;
        }
        100% {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
    }
    
    @keyframes slideOut {
        0% {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
        100% {
            transform: translateY(-100%) scale(0.9);
            opacity: 0;
        }
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .popup-message {
        border-color: rgba(255,255,255,0.2);
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    .popup-message {
        border-width: 2px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .popup-message.show {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .popup-message.hide {
        animation: none;
        opacity: 0;
    }
    
    .popup-message .progress-bar {
        animation: none;
    }
    
    .close-button:hover {
        transform: none;
    }
}