/* Enhanced Message Container */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 420px;
    pointer-events: none;
}

.message {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.4s ease-out;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: all var(--transition-normal);
}

.message.show {
    opacity: 1;
    transform: translateX(0);
}

.message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    opacity: 0.9;
    z-index: -1;
}

.message.success {
    background: rgba(212, 237, 218, 0.95);
    color: #155724;
    border: 1px solid #c3e6cb;
    border-left: 4px solid var(--success-color);
}

.message.error {
    background: rgba(248, 215, 218, 0.95);
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-left: 4px solid var(--danger-color);
}

.message.info {
    background: rgba(209, 236, 241, 0.95);
    color: #0c5460;
    border: 1px solid #bee5eb;
    border-left: 4px solid var(--info-color);
}

.message.warning {
    background: rgba(255, 243, 205, 0.95);
    color: #856404;
    border: 1px solid #ffeaa7;
    border-left: 4px solid var(--warning-color);
}

/* Message Content Structure */
.message-content {
    position: relative;
    z-index: 1;
    padding-right: 30px; /* Space for close button */
}

.message-text {
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
}

.message-details {
    font-size: var(--font-size-sm);
    opacity: 0.9;
    margin-top: var(--spacing-xs);
    white-space: pre-line;
    line-height: 1.3;
}

.message-error-code {
    font-size: var(--font-size-xs);
    font-family: monospace;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-xs);
    display: inline-block;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    flex-wrap: wrap;
}

/* Message Progress Bar */
.message-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.message-progress-bar {
    height: 100%;
    background: currentColor;
    width: 100%;
    transform: translateX(-100%);
    animation: progress-countdown linear;
}

/* Message Close Button */
.message-close {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity var(--transition-normal);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    z-index: 2;
}

.message-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

.message-close:focus {
    outline: 2px solid currentColor;
    outline-offset: 1px;
    opacity: 1;
}

/* Message Animations */
.message.dismissing {
    animation: slideOut 0.3s ease-in forwards;
}

.message.duplicate-flash {
    animation: duplicateFlash 0.5s ease-in-out;
}

/* Priority-based styling */
.message[data-priority="critical"] {
    border-width: 2px;
    box-shadow: var(--shadow-xl), 0 0 20px rgba(220, 53, 69, 0.2);
    animation: slideIn 0.4s ease-out, criticalPulse 2s ease-in-out infinite;
}
