/**
 * WooCommerce Notifications & Messages Styles
 * Handles all WooCommerce notification types (success, error, info, notice)
 */

@import '../variables.css';

/* === WOOCOMMERCE NOTICES === */

/* Main notice container */
.woocommerce-notices-wrapper {
    margin-bottom: var(--spacing-4);
}

/* Base notice styling */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.wc-block-components-notice-banner {
    position: relative;
    padding: var(--spacing-4) var(--spacing-6);
    margin-bottom: var(--spacing-4);
    border-left: 4px solid;
    font-size: var(--font-size-base);
    line-height: 1.5;
    animation: slideInDown 0.3s ease-out;
}

/* Success messages (green) */
.woocommerce-message {
    background-color: #f0f9f4;
    border-left-color: #10b981;
    color: #065f46;
}

.woocommerce-message::before {
    content: "✓";
    position: absolute;
    left: var(--spacing-4);
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: #10b981;
    font-size: var(--font-size-lg);
}

/* Info messages (blue) */
.woocommerce-info {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.woocommerce-info::before {
    content: "ℹ";
    position: absolute;
    left: var(--spacing-4);
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: #3b82f6;
    font-size: var(--font-size-lg);
}

/* Error messages (red) */
.woocommerce-error {
    background-color: #fef2f2;
    border-left-color: #ef4444;
    color: #b91c1c;
}

.woocommerce-error::before {
    content: "⚠";
    position: absolute;
    left: var(--spacing-4);
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: #ef4444;
    font-size: var(--font-size-lg);
}

/* Notice messages (yellow/orange) */
.woocommerce-notice,
.wc-block-components-notice-banner {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
    color: #92400e;
}

.woocommerce-notice::before,
.wc-block-components-notice-banner::before {
    content: "⚡";
    position: absolute;
    left: var(--spacing-4);
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: #f59e0b;
    font-size: var(--font-size-lg);
}

/* Adjust padding for messages with icons */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.woocommerce-notice {
    padding-left: calc(var(--spacing-6) + var(--spacing-8));
}

/* Links in notices */
.woocommerce-message a,
.woocommerce-info a,
.woocommerce-error a,
.woocommerce-notice a {
    color: inherit;
    text-decoration: underline;
    font-weight: var(--font-weight-medium);
}

.woocommerce-message a:hover,
.woocommerce-info a:hover,
.woocommerce-error a:hover,
.woocommerce-notice a:hover {
    text-decoration: none;
}

/* === CART SPECIFIC NOTICES === */

/* Cart notices container */
.woocommerce-cart .woocommerce-notices-wrapper {
    margin-bottom: var(--spacing-6);
}

/* Quantity update success */
.woocommerce-cart .woocommerce-message[role="alert"] {
    background-color: #ecfdf5;
    border-left-color: #059669;
    color: #047857;
}

/* Item removal undo notice */
.woocommerce-cart .woocommerce-message .restore-item {
    display: inline-block;
    margin-left: var(--spacing-2);
    padding: var(--spacing-1) var(--spacing-3);
    background-color: #059669;
    color: white;
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: background-color 0.2s;
}

.woocommerce-cart .woocommerce-message .restore-item:hover {
    background-color: #047857;
    color: white;
}

/* === CHECKOUT NOTICES === */

/* Checkout error messages */
.woocommerce-checkout .woocommerce-error {
    margin-bottom: var(--spacing-6);
}

.woocommerce-checkout .woocommerce-error ul {
    margin: 0;
    padding-left: var(--spacing-4);
    list-style-type: disc;
}

.woocommerce-checkout .woocommerce-error li {
    margin-bottom: var(--spacing-1);
}

/* === ACCOUNT PAGE NOTICES === */

/* Account form notices */
.woocommerce-account .woocommerce-message,
.woocommerce-account .woocommerce-error {
    margin-bottom: var(--spacing-6);
}

/* === SHOP PAGE NOTICES === */

/* Add to cart success notice */
.woocommerce-shop .woocommerce-message,
.woocommerce-archive .woocommerce-message {
    position: fixed;
    top: var(--spacing-4);
    right: var(--spacing-4);
    z-index: 1000;
    max-width: 400px;
    margin: 0;
    animation: slideInRight 0.3s ease-out;
}

/* Auto-hide animation for shop notices */
.woocommerce-shop .woocommerce-message.auto-hide,
.woocommerce-archive .woocommerce-message.auto-hide {
    animation: slideInRight 0.3s ease-out, fadeOut 0.5s ease-out 3s forwards;
}

/* === LOADING STATES === */

/* Notice with loading spinner */
.woocommerce-notice.loading::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid #f59e0b;
    border-top: 2px solid transparent;
    animation: spin 1s linear infinite;
}

/* === ANIMATIONS === */

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* === CLOSE BUTTON === */

/* Add close button to notices */
.woocommerce-message .notice-dismiss,
.woocommerce-info .notice-dismiss,
.woocommerce-error .notice-dismiss,
.woocommerce-notice .notice-dismiss {
    position: absolute;
    top: var(--spacing-2);
    right: var(--spacing-2);
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: var(--spacing-1);
    line-height: 1;
    transition: opacity 0.2s;
}

.woocommerce-message .notice-dismiss:hover,
.woocommerce-info .notice-dismiss:hover,
.woocommerce-error .notice-dismiss:hover,
.woocommerce-notice .notice-dismiss:hover {
    opacity: 1;
}

/* === MOBILE RESPONSIVENESS === */

@media (max-width: 768px) {
    .woocommerce-message,
    .woocommerce-info,
    .woocommerce-error,
    .woocommerce-notice {
        padding: var(--spacing-3) var(--spacing-4);
        padding-left: calc(var(--spacing-4) + var(--spacing-6));
        font-size: var(--font-size-sm);
        margin-bottom: var(--spacing-3);
    }

    /* Mobile shop notices */
    .woocommerce-shop .woocommerce-message,
    .woocommerce-archive .woocommerce-message {
        position: static;
        max-width: none;
        margin-bottom: var(--spacing-4);
        animation: slideInDown 0.3s ease-out;
    }

    /* Icons for mobile */
    .woocommerce-message::before,
    .woocommerce-info::before,
    .woocommerce-error::before,
    .woocommerce-notice::before {
        font-size: var(--font-size-base);
        left: var(--spacing-3);
    }
}

/* === SLOVENIAN TRANSLATIONS === */

/* Custom styling for Slovenian-specific notices */
.woocommerce-message[data-lang="si"],
.woocommerce-info[data-lang="si"],
.woocommerce-error[data-lang="si"],
.woocommerce-notice[data-lang="si"] {
    font-family: var(--font-tertiary);
}

/* === ACCESSIBILITY === */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .woocommerce-message,
    .woocommerce-info,
    .woocommerce-error,
    .woocommerce-notice {
        border-width: 2px;
        border-style: solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .woocommerce-message,
    .woocommerce-info,
    .woocommerce-error,
    .woocommerce-notice {
        animation: none;
    }
}

/* Focus styles for notices with links */
.woocommerce-message:focus-within,
.woocommerce-info:focus-within,
.woocommerce-error:focus-within,
.woocommerce-notice:focus-within {
    outline: none;
}