/**
 * Unified Notifications CSS
 * Single source of truth for all notification and alert styles across the entire application
 * Consistent design matching site theme (#522546 primary color)
 * 
 * @version 7.0
 * @author Da-awati Team
 */

/* ==========================================================
   CSS VARIABLES (Theme Integration)
========================================================== */

:root {
    /* Z-index - fallback if not defined elsewhere */
    --z-toast: 9999;
    
    /* Theme colors */
    --notification-theme-primary: #522546;
    --notification-theme-primary-dark: #3d1a33;
    --notification-theme-primary-light: #6B3A5F;
    
    /* Notification colors */
    --notification-success: #047857;
    --notification-success-dark: #065f46;
    --notification-error: #b91c1c;
    --notification-error-dark: #991b1b;
    --notification-warning: #b45309;
    --notification-warning-dark: #92400e;
    --notification-info: #522546;
    --notification-info-dark: #3d1a33;
    
    /* Text colors */
    --notification-text: #495057;
    --notification-text-light: #9ca3af;
    --notification-text-white: #ffffff;
    
    /* Background */
    --notification-bg: #ffffff;
    --notification-border: rgba(0, 0, 0, 0.04);
    
    /* Spacing */
    --notification-padding: 12px 16px;
    --notification-gap: 10px;
    --notification-margin: 8px;
    
    /* Sizing */
    --notification-max-width: 320px;
    --notification-min-width: 260px;
    --notification-border-radius: 12px;
    --notification-indicator-width: 3px;
    
    /* Icon paths */
    --notification-icon-success: url('../../../notification/icons/succ.svg');
    --notification-icon-error: url('../../../notification/icons/required.svg');
    --notification-icon-warning: url('../../../notification/icons/warning.svg');
    --notification-icon-info: url('../../../notification/icons/info.svg');
    
    /* Shadows */
    --notification-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    --notification-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ==========================================================
   BASE NOTIFICATION STYLES (Unified)
========================================================== */

/* All notification types inherit from this base */
.notification-base,
.notification-item,
.whatsapp-notification,
.invitation-alert-fixed,
.admin-message,
.alert-success,
.alert-danger,
.alert-warning,
.alert-info,
.error-message,
.error-message-red,
.success-message,
.info-message,
.warning-message,
.validation-error,
.update-success-message,
.newsletter-success-visible,
.newsletter-error-visible,
#statusMessages .error-message,
#statusMessages .success-message,
#statusMessages .info-message,
#statusMessages .warning-message,
#eventDetailsModal .error-message,
#eventDetailsModal .success-message,
#eventDetailsModal .info-message,
#eventDetailsModal .warning-message {
    /* Base styles */
    background: var(--notification-bg);
    border-radius: var(--notification-border-radius);
    box-shadow: var(--notification-shadow);
    padding: var(--notification-padding);
    font-size: 13px;
    line-height: 1.4;
    color: var(--notification-text);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: var(--notification-gap);
    transition: all 0.2s ease;
    border: 1px solid var(--notification-border);
    font-family: "Mulish", system-ui, sans-serif;
}

/* Indicator bar (left border) */
.notification-base::before,
.notification-item::before,
.whatsapp-notification::before,
.invitation-alert-fixed::before,
.admin-message::before,
.alert-success::before,
.alert-danger::before,
.alert-warning::before,
.alert-info::before,
.error-message::before,
.error-message-red::before,
.success-message::before,
.info-message::before,
.warning-message::before,
.validation-error::before,
.update-success-message::before,
.newsletter-success-visible::before,
.newsletter-error-visible::before,
#statusMessages .error-message::before,
#statusMessages .success-message::before,
#statusMessages .info-message::before,
#statusMessages .warning-message::before,
#eventDetailsModal .error-message::before,
#eventDetailsModal .success-message::before,
#eventDetailsModal .info-message::before,
#eventDetailsModal .warning-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--notification-indicator-width);
    background: linear-gradient(135deg, var(--notification-info) 0%, var(--notification-info-dark) 100%);
    border-radius: var(--notification-border-radius) 0 0 var(--notification-border-radius);
}

/* ==========================================================
   NOTIFICATION CONTAINER
========================================================== */

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast, 9999);
    pointer-events: none;
}

/* ==========================================================
   NOTIFICATION ITEM (Toast-style notifications)
========================================================== */

.notification-item {
    margin-bottom: var(--notification-margin);
    pointer-events: auto;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
    max-width: var(--notification-max-width);
    min-width: var(--notification-min-width);
    opacity: 0;
}

.notification-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--notification-shadow-hover);
}

.notification-item-hidden {
    transform: translateX(400px);
    opacity: 0;
}

.notification-item-visible {
    transform: translateX(0);
    opacity: 1;
}

.notification-item-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.95;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 1px var(--notification-theme-primary)) drop-shadow(0 0 0.5px var(--notification-theme-primary));
}

/* Success icon */
.notification-item.success .notification-item-icon,
.success-message .notification-item-icon,
.update-success-message .notification-item-icon,
.newsletter-success-visible .notification-item-icon,
#statusMessages .success-message .notification-item-icon,
#eventDetailsModal .success-message .notification-item-icon {
    background-color: var(--notification-success);
    mask-image: var(--notification-icon-success);
    -webkit-mask-image: var(--notification-icon-success);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    background-image: none;
    filter: drop-shadow(0 0 1.5px var(--notification-success)) drop-shadow(0 0 0.8px var(--notification-success-dark));
}

/* Error icon */
.notification-item.error .notification-item-icon,
.error-message .notification-item-icon,
.error-message-red .notification-item-icon,
.validation-error .notification-item-icon,
.newsletter-error-visible .notification-item-icon,
#statusMessages .error-message .notification-item-icon,
#eventDetailsModal .error-message .notification-item-icon {
    background-color: var(--notification-error);
    mask-image: var(--notification-icon-error);
    -webkit-mask-image: var(--notification-icon-error);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    background-image: none;
    filter: drop-shadow(0 0 1.5px var(--notification-error)) drop-shadow(0 0 0.8px var(--notification-error-dark));
}

/* Warning icon */
.notification-item.warning .notification-item-icon,
.warning-message .notification-item-icon,
#statusMessages .warning-message .notification-item-icon,
#eventDetailsModal .warning-message .notification-item-icon {
    background-color: var(--notification-warning);
    mask-image: var(--notification-icon-warning);
    -webkit-mask-image: var(--notification-icon-warning);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    background-image: none;
    filter: drop-shadow(0 0 1.5px var(--notification-warning)) drop-shadow(0 0 0.8px var(--notification-warning-dark));
}

/* Info icon */
.notification-item.info .notification-item-icon,
.info-message .notification-item-icon,
#statusMessages .info-message .notification-item-icon,
#eventDetailsModal .info-message .notification-item-icon {
    background-color: var(--notification-info);
    mask-image: var(--notification-icon-info);
    -webkit-mask-image: var(--notification-icon-info);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    background-image: none;
    filter: drop-shadow(0 0 1.5px var(--notification-info)) drop-shadow(0 0 0.8px var(--notification-info-dark));
}

/* Fallback for inline SVG (if still used) */
.notification-item-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--notification-text);
    stroke-width: 2;
    fill: none;
    transition: stroke 0.2s ease;
}

.notification-item-content {
    flex: 1;
    word-wrap: break-word;
    font-weight: 400;
    letter-spacing: 0.01em;
    font-size: 13px;
}

.notification-item-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    color: var(--notification-text-light);
    flex-shrink: 0;
}

.notification-item-close:hover {
    background: rgba(82, 37, 70, 0.08);
    color: var(--notification-text);
    transform: rotate(90deg);
}

/* ==========================================================
   NOTIFICATION TYPES (Color Variants)
========================================================== */

/* Success (Green) */
.notification-item.success::before,
.whatsapp-notification-success::before,
.admin-message.success::before,
.alert-success::before,
.success-message::before,
.update-success-message::before,
.newsletter-success-visible::before,
#statusMessages .success-message::before,
#eventDetailsModal .success-message::before {
    background: linear-gradient(135deg, var(--notification-success) 0%, var(--notification-success-dark) 100%);
}

/* Error (Red) */
.notification-item.error::before,
.whatsapp-notification-error::before,
.admin-message.error::before,
.alert-danger::before,
.error-message::before,
.error-message-red::before,
.validation-error::before,
.newsletter-error-visible::before,
#statusMessages .error-message::before,
#eventDetailsModal .error-message::before {
    background: linear-gradient(135deg, var(--notification-error) 0%, var(--notification-error-dark) 100%);
}

/* Warning (Orange) */
.notification-item.warning::before,
.admin-message.warning::before,
.alert-warning::before,
.warning-message::before,
#statusMessages .warning-message::before,
#eventDetailsModal .warning-message::before {
    background: linear-gradient(135deg, var(--notification-warning) 0%, var(--notification-warning-dark) 100%);
}

/* Info (Theme Primary) */
.notification-item.info::before,
.admin-message.info::before,
.alert-info::before,
.info-message::before,
#statusMessages .info-message::before,
#eventDetailsModal .info-message::before {
    background: linear-gradient(135deg, var(--notification-info) 0%, var(--notification-info-dark) 100%);
}

/* ==========================================================
   SPECIFIC NOTIFICATION COMPONENTS
========================================================== */

/* WhatsApp & Invitation Alerts */
.whatsapp-notification,
.invitation-alert-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast, 9999);
    max-width: var(--notification-max-width);
    min-width: var(--notification-min-width);
}

.whatsapp-notification {
    animation: slideInRight 0.3s ease-out;
}

/* NOTE: @keyframes slideInRight is defined in animations.css */

/* Admin Messages */
.admin-message {
    margin-bottom: 10px;
}

/* Error Messages */
.error-message,
.error-message-red {
    justify-content: center;
    text-align: center;
}

.error-message-red {
    color: var(--notification-error);
}

/* Validation & Update Messages */
.validation-error,
.update-success-message {
    margin: var(--notification-margin) 0;
}

/* ==========================================================
   NEWSLETTER STATES
========================================================== */

.newsletter-error-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

.newsletter-success-visible,
.newsletter-error-visible {
    width: 100% !important;
    margin-bottom: var(--notification-margin) !important;
    text-align: center !important;
    z-index: 10 !important;
}

/* ==========================================================
   STATUS MESSAGES CONTAINER
========================================================== */

#statusMessages {
    margin-bottom: 16px !important;
}

/* ==========================================================
   STATUS BADGES (Inline status indicators)
========================================================== */

.status-badge {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    display: inline-block;
    background: var(--notification-bg);
    border: 1px solid var(--notification-border);
    color: var(--notification-text);
}

/* ==========================================================
   RESPONSIVE BEHAVIOR
========================================================== */

@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .notification-item,
    .whatsapp-notification,
    .invitation-alert-fixed {
        max-width: 100%;
        min-width: auto;
    }
}
