/**
 * Alert Messages Styling
 * Centralized alert/notification styles for consistent UX
 * Issue #2 Fix: Centered alerts below navbar, no overlapping
 */

/* Alert Container - Fixed positioning below navbar */
.alert-container {
    position: fixed;
    top: 100px; /* Below navbar (navbar is ~90px + padding) */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1015; /* Below navbar (1020) but above content */
    width: 90%;
    max-width: 600px;
    pointer-events: none; /* Allow clicks through container */
}

.alert-container .alert {
    pointer-events: all; /* Re-enable clicks on alert itself */
    margin-bottom: 1rem;
}

/* Base Alert Styles */
.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    font-size: 1rem;
    animation: slideDown 0.3s ease-out;
}

/* Alert Content Layout */
.alert-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0; /* Allow flex item to shrink */
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-message {
    flex: 1;
    min-width: 0; /* Allow text to wrap */
    text-align: center; /* Center the message text */
}

.alert-message ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style-type: disc;
    text-align: right; /* Right-align list items in RTL */
}

.alert-message ul li {
    margin: 0.25rem 0;
}

/* Close Button Styling */
.alert .btn-close {
    flex-shrink: 0;
    opacity: 0.8;
    filter: brightness(0) invert(1); /* White close button */
    padding: 0.5rem;
}

.alert .btn-close:hover {
    opacity: 1;
}

/* RTL/LTR Spacing - Works for both old and new alert structures */
[dir="ltr"] .alert .btn-close {
    margin-left: 1rem;
    margin-right: 0;
}

[dir="rtl"] .alert .btn-close {
    margin-left: 1rem;
    margin-right: 0;
}

[dir="rtl"] .alert-content {
    flex-direction: row-reverse; /* Reverse order: close button, message, icon */
}

[dir="rtl"] .alert-message ul {
    padding-left: 0;
    padding-right: 1.5rem;
}

/* Alert Type Variants */
.alert-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.alert-success .alert-icon {
    color: #d1fae5;
}

.alert-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.alert-danger .alert-icon {
    color: #fecaca;
}

.alert-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.alert-warning .alert-icon {
    color: #fef3c7;
}

.alert-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.alert-info .alert-icon {
    color: #dbeafe;
}

/* Animation */
@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Fade out animation for dismissal */
.alert.fade {
    transition: opacity 0.3s ease-out;
}

/* Static positioning for inline alerts (not fixed) */
.alert-static {
    position: static;
    width: 100%;
    max-width: 100%;
    transform: none;
    margin-bottom: 1.5rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .alert-container {
        width: 95%;
        top: 80px; /* Adjust for mobile navbar */
    }

    .alert {
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
    }

    .alert-icon {
        font-size: 1.1rem;
    }

    .alert .btn-close {
        margin-left: 0.5rem;
        padding: 0.375rem;
    }

    [dir="rtl"] .alert .btn-close {
        margin-right: 0.5rem;
    }
}

@media (max-width: 480px) {
    .alert-container {
        width: 100%;
        left: 0;
        transform: none;
        padding: 0 0.5rem;
    }

    .alert {
        border-radius: 8px;
    }
}

/* Print Styles */
@media print {
    .alert-container {
        position: static;
        transform: none;
    }
}
