/**
 * Made to Fit - Alert & Notification Styling System
 *
 * Comprehensive notification system with consistent styling, animations,
 * and accessibility features across all user interactions.
 *
 * @package Made_To_Fit
 * @subpackage WooCommerce
 * @version 1.0.0
 * @author BMAD Developer
 * @date 2025-11-24
 */

/* ====================================================================
   CSS CUSTOM PROPERTIES
   ==================================================================== */

:root {
    /* Alert colors - aligned with Made To Fit brand palette */
    --mtf-alert-success-bg: #f0f9f4;
    --mtf-alert-success-border: #28a745;
    --mtf-alert-success-text: #155724;
    --mtf-alert-success-icon: #28a745;

    --mtf-alert-error-bg: #fef5f5;
    --mtf-alert-error-border: #dc3545;
    --mtf-alert-error-text: #721c24;
    --mtf-alert-error-icon: #dc3545;

    --mtf-alert-warning-bg: #fffbf0;
    --mtf-alert-warning-border: #ffc107;
    --mtf-alert-warning-text: #856404;
    --mtf-alert-warning-icon: #ffc107;

    --mtf-alert-info-bg: #f0f8ff;
    --mtf-alert-info-border: #17a2b8;
    --mtf-alert-info-text: #0c5460;
    --mtf-alert-info-icon: #17a2b8;

    /* Base alert styling */
    --mtf-alert-bg: #ffffff;
    --mtf-alert-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --mtf-alert-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.2);
    --mtf-alert-radius: 8px;
    --mtf-alert-padding: 16px;
    --mtf-alert-max-width: 400px;
    --mtf-alert-min-height: 60px;
    --mtf-alert-z-index: 999999; /* Højere end header for at være helt øverst */

    /* Typography */
    --mtf-alert-font-size: 15px;
    --mtf-alert-line-height: 1.4;
    --mtf-alert-font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mtf-alert-font-weight: 400;

    /* Spacing */
    --mtf-alert-gap: 12px;
    --mtf-alert-icon-size: 24px;
    --mtf-alert-close-size: 32px;

    /* Animation */
    --mtf-alert-transition-duration: 0.3s;
    --mtf-alert-transition-easing: ease-out;
    --mtf-alert-slide-distance: 420px;
}

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

.mtf-notification-container {
    position: fixed;
    z-index: var(--mtf-alert-z-index);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: var(--mtf-alert-gap);
    max-width: var(--mtf-alert-max-width);
}

/* Position modifiers - HELT ØVERST over header */
.mtf-notification-container--top-right {
    top: 10px;
    right: 20px;
}

.mtf-notification-container--top-center {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.mtf-notification-container--top-left {
    top: 10px;
    left: 20px;
}

.mtf-notification-container--bottom-right {
    bottom: 20px;
    right: 20px;
}

.mtf-notification-container--bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.mtf-notification-container--bottom-left {
    bottom: 20px;
    left: 20px;
}

/* ====================================================================
   BASE NOTIFICATION CARD
   ==================================================================== */

.mtf-notification {
    background: var(--mtf-alert-bg);
    border-radius: var(--mtf-alert-radius);
    box-shadow: var(--mtf-alert-shadow);
    min-height: var(--mtf-alert-min-height);
    padding: var(--mtf-alert-padding);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    pointer-events: auto;
    border-left: 4px solid transparent;
    transition: box-shadow var(--mtf-alert-transition-duration) var(--mtf-alert-transition-easing),
                transform var(--mtf-alert-transition-duration) var(--mtf-alert-transition-easing);
    font-family: var(--mtf-alert-font-family);
    font-size: var(--mtf-alert-font-size);
    line-height: var(--mtf-alert-line-height);
    font-weight: var(--mtf-alert-font-weight);
    width: 100%;
    max-width: var(--mtf-alert-max-width);
}

.mtf-notification:hover {
    box-shadow: var(--mtf-alert-shadow-hover);
}

.mtf-notification:focus-within {
    outline: 2px solid var(--mtf-alert-info-border);
    outline-offset: 2px;
}

/* ====================================================================
   NOTIFICATION TYPE VARIANTS
   ==================================================================== */

/* Success notification */
.mtf-notification--success {
    background: var(--mtf-alert-success-bg);
    border-left-color: var(--mtf-alert-success-border);
}

.mtf-notification--success .mtf-notification__icon {
    color: var(--mtf-alert-success-icon);
}

.mtf-notification--success .mtf-notification__message {
    color: var(--mtf-alert-success-text);
}

/* Error notification */
.mtf-notification--error {
    background: var(--mtf-alert-error-bg);
    border-left-color: var(--mtf-alert-error-border);
}

.mtf-notification--error .mtf-notification__icon {
    color: var(--mtf-alert-error-icon);
}

.mtf-notification--error .mtf-notification__message {
    color: var(--mtf-alert-error-text);
}

/* Warning notification */
.mtf-notification--warning {
    background: var(--mtf-alert-warning-bg);
    border-left-color: var(--mtf-alert-warning-border);
}

.mtf-notification--warning .mtf-notification__icon {
    color: var(--mtf-alert-warning-icon);
}

.mtf-notification--warning .mtf-notification__message {
    color: var(--mtf-alert-warning-text);
}

/* Info notification */
.mtf-notification--info {
    background: var(--mtf-alert-info-bg);
    border-left-color: var(--mtf-alert-info-border);
}

.mtf-notification--info .mtf-notification__icon {
    color: var(--mtf-alert-info-icon);
}

.mtf-notification--info .mtf-notification__message {
    color: var(--mtf-alert-info-text);
}

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

/* Icon container */
.mtf-notification__icon {
    flex-shrink: 0;
    width: var(--mtf-alert-icon-size);
    height: var(--mtf-alert-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtf-notification__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Message content */
.mtf-notification__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mtf-notification__message {
    margin: 0;
    font-size: var(--mtf-alert-font-size);
    line-height: var(--mtf-alert-line-height);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Close button */
.mtf-notification__close {
    flex-shrink: 0;
    width: var(--mtf-alert-close-size);
    height: var(--mtf-alert-close-size);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    color: currentColor;
    opacity: 0.6;
    padding: 0;
    margin: -4px -4px -4px 0;
}

.mtf-notification__close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    opacity: 1;
}

.mtf-notification__close:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    opacity: 1;
}

.mtf-notification__close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Progress bar for auto-dismiss */
.mtf-notification__progress {
    position: absolute;
    bottom: 0;
    left: 4px;
    right: 4px;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 4px 4px;
    overflow: hidden;
}

.mtf-notification__progress-bar {
    height: 100%;
    background: currentColor;
    transform-origin: left center;
    transition: transform linear;
}

/* ====================================================================
   ANIMATIONS
   ==================================================================== */

/* Slide in from right (for top-right and bottom-right positions) */
@keyframes mtfNotificationSlideInRight {
    from {
        transform: translateX(var(--mtf-alert-slide-distance));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide out to right */
@keyframes mtfNotificationSlideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(var(--mtf-alert-slide-distance));
        opacity: 0;
    }
}

/* Slide in from left (for top-left and bottom-left positions) */
@keyframes mtfNotificationSlideInLeft {
    from {
        transform: translateX(calc(-1 * var(--mtf-alert-slide-distance)));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide out to left */
@keyframes mtfNotificationSlideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(calc(-1 * var(--mtf-alert-slide-distance)));
        opacity: 0;
    }
}

/* Fade in (for center positions) */
@keyframes mtfNotificationFadeIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* Animation state classes */
.mtf-notification-enter {
    animation: mtfNotificationSlideInRight var(--mtf-alert-transition-duration) var(--mtf-alert-transition-easing);
}

.mtf-notification-exit {
    animation: mtfNotificationSlideOutRight 0.2s ease-in;
}

/* Position-specific animations */
.mtf-notification-container--top-left .mtf-notification-enter,
.mtf-notification-container--bottom-left .mtf-notification-enter {
    animation-name: mtfNotificationSlideInLeft;
}

.mtf-notification-container--top-left .mtf-notification-exit,
.mtf-notification-container--bottom-left .mtf-notification-exit {
    animation-name: mtfNotificationSlideOutLeft;
}

.mtf-notification-container--top-center .mtf-notification-enter,
.mtf-notification-container--bottom-center .mtf-notification-enter {
    animation-name: mtfNotificationFadeIn;
}

.mtf-notification-container--top-center .mtf-notification-exit,
.mtf-notification-container--bottom-center .mtf-notification-exit {
    animation-name: mtfNotificationFadeOut;
}

/* ====================================================================
   ACCESSIBILITY
   ==================================================================== */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mtf-notification {
        transition: none;
    }

    .mtf-notification-enter,
    .mtf-notification-exit {
        animation: none;
    }

    .mtf-notification-enter {
        opacity: 1;
        transform: none;
    }

    .mtf-notification-exit {
        opacity: 0;
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mtf-notification {
        border: 2px solid currentColor;
    }

    .mtf-notification--success {
        background: #fff;
        border-color: var(--mtf-alert-success-border);
    }

    .mtf-notification--error {
        background: #fff;
        border-color: var(--mtf-alert-error-border);
    }

    .mtf-notification--warning {
        background: #fff;
        border-color: var(--mtf-alert-warning-border);
    }

    .mtf-notification--info {
        background: #fff;
        border-color: var(--mtf-alert-info-border);
    }
}

/* Screen reader only text */
.mtf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ====================================================================
   RESPONSIVE DESIGN
   ==================================================================== */

/* Tablet and below */
@media (max-width: 768px) {
    :root {
        --mtf-alert-max-width: 90vw;
    }

    .mtf-notification-container {
        max-width: 90vw;
    }

    /* Move all positions to top-center on mobile for better UX */
    .mtf-notification-container--top-right,
    .mtf-notification-container--top-left,
    .mtf-notification-container--bottom-right,
    .mtf-notification-container--bottom-left,
    .mtf-notification-container--bottom-center {
        top: 10px;
        bottom: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .mtf-notification {
        font-size: 14px;
        padding: 14px;
    }

    .mtf-notification__close {
        width: 40px;
        height: 40px;
    }
}

/* Mobile small screens */
@media (max-width: 480px) {
    :root {
        --mtf-alert-max-width: 95vw;
        --mtf-alert-padding: 12px;
    }

    .mtf-notification-container {
        top: 5px;
        left: 2.5vw;
        right: 2.5vw;
        transform: none;
        max-width: 95vw;
    }

    .mtf-notification {
        font-size: 13px;
        padding: 12px;
    }
}

/* ====================================================================
   UTILITY CLASSES
   ==================================================================== */

/* Hide notification (for programmatic control) */
.mtf-notification--hidden {
    display: none;
}

/* Paused auto-dismiss (when hovering) */
.mtf-notification--paused .mtf-notification__progress-bar {
    animation-play-state: paused;
}

/* Dismissing state */
.mtf-notification--dismissing {
    pointer-events: none;
}

/* ====================================================================
   PRINT STYLES
   ==================================================================== */

@media print {
    .mtf-notification-container,
    .mtf-notification {
        display: none;
    }
}
