/**
 * Vime Toast Styles
 *
 * Estilos para o sistema global de notificacoes toast.
 *
 * @package Vime_WooCommerce_Widgets
 * @since 1.8.0
 */

/* ==========================================================================
   CSS Variables (Defaults)
   ========================================================================== */

:root {
    --vime-toast-bg: #ffffff;
    --vime-toast-bg-tint: rgba(16, 185, 129, 0.04);
    --vime-toast-text: #111827;
    --vime-toast-text-secondary: #6b7280;
    --vime-toast-accent: #10b981;
    --vime-toast-width: 320px;
    --vime-toast-radius: 8px;
    --vime-toast-duration: 4000ms;
    --vime-toast-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --vime-toast-z-index: 999999;
}

/* ==========================================================================
   Container
   ========================================================================== */

.vime-toast-container {
    position: fixed;
    z-index: var(--vime-toast-z-index);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
    padding: 16px;
    pointer-events: none;
    box-sizing: border-box;
}

/* Positions */
.vime-toast-container--top-right {
    top: 16px;
    right: 16px;
}

.vime-toast-container--top-left {
    top: 16px;
    left: 16px;
}

.vime-toast-container--top-center {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
}

.vime-toast-container--bottom-right {
    bottom: 16px;
    right: 16px;
}

.vime-toast-container--bottom-left {
    bottom: 16px;
    left: 16px;
}

.vime-toast-container--bottom-center {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}

/* ==========================================================================
   Toast Element
   ========================================================================== */

.vime-toast {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: var(--vime-toast-width);
    max-width: 100%;
    background-color: var(--vime-toast-bg);
    background-image: linear-gradient(var(--vime-toast-bg-tint), var(--vime-toast-bg-tint));
    color: var(--vime-toast-text);
    border-radius: var(--vime-toast-radius);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--vime-toast-shadow);
    overflow: hidden;
    pointer-events: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    position: relative;
    text-align: left !important;
}

/* Toast Body */
.vime-toast__body {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 8px;
    padding: 10px 30px 10px 10px;
    position: relative;
    width: 100% !important;
    box-sizing: border-box;
    text-align: left !important;
}

/* Icon */
.vime-toast__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: var(--vime-toast-accent);
}

.vime-toast__icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Content */
.vime-toast__content {
    flex: 1;
    min-width: 0;
    text-align: left !important;
}

/* Title */
.vime-toast__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--vime-toast-text);
    margin: 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left !important;
}

/* Description/Message */
.vime-toast__message {
    font-size: 13px;
    font-weight: 400;
    color: var(--vime-toast-text);
    margin: 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left !important;
}

/* When both title and message exist */
.vime-toast__title + .vime-toast__message {
    font-size: 12px;
    color: var(--vime-toast-text-secondary);
    margin-top: 2px;
}

/* Close Button - Reset Elementor button styles */
.vime-toast__close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    max-width: 20px;
    max-height: 20px;
    padding: 0 !important;
    margin: 0;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-width: 0 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    color: #9ca3af !important;
    cursor: pointer;
    opacity: 1;
    transition: color 0.15s ease;
    text-transform: none;
    font-weight: normal;
    font-size: 16px;
    letter-spacing: normal;
    line-height: 1;
    text-decoration: none;
}

.vime-toast__close:hover,
.vime-toast__close:focus,
.vime-toast__close:active {
    opacity: 1;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none;
    text-decoration: none;
    color: #374151 !important;
}

.vime-toast__close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
}

/* Actions */
.vime-toast__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Reset all button/link styles from themes (Hello Elementor, etc) */
.vime-toast__button,
.vime-toast__button.button,
.vime-toast__button.wp-element-button,
a.vime-toast__button,
button.vime-toast__button {
    display: inline !important;
    align-items: initial !important;
    justify-content: initial !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    background-color: transparent !important;
    color: var(--vime-toast-accent) !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: opacity 0.2s ease !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: inherit !important;
    min-width: auto !important;
    min-height: auto !important;
    height: auto !important;
    width: auto !important;
}

.vime-toast__button:hover,
.vime-toast__button:focus,
.vime-toast__button:active,
.vime-toast__button.button:hover,
.vime-toast__button.wp-element-button:hover,
a.vime-toast__button:hover,
button.vime-toast__button:hover {
    opacity: 0.8 !important;
    background: none !important;
    background-color: transparent !important;
    color: var(--vime-toast-accent) !important;
    border: none !important;
    box-shadow: none !important;
    text-decoration: underline !important;
    transform: none !important;
    outline: none !important;
}

/* Progress Bar */
.vime-toast__progress-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.vime-toast__progress {
    height: 100%;
    background-color: var(--vime-toast-accent);
    width: 100%;
    animation: vime-toast-progress var(--vime-toast-duration) linear forwards;
    transform-origin: left;
    opacity: 0.8;
}

.vime-toast--paused .vime-toast__progress {
    animation-play-state: paused;
}

@keyframes vime-toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* ==========================================================================
   Toast Types (Color Variations)
   ========================================================================== */

/*
 * Note: Colors are now dynamically set via JavaScript using ColorUtils.
 * The JavaScript generates bg/text/border from a single base color with opacity.
 * These type classes are kept for semantic purposes but don't set colors.
 * Colors are applied inline via CSS custom properties.
 */

.vime-toast--success,
.vime-toast--error,
.vime-toast--warning,
.vime-toast--info {
    /* Colors set dynamically via JS */
}

/* ==========================================================================
   Animations - Slide
   ========================================================================== */

/* Slide Enter - Right positions */
.vime-toast-container--top-right .vime-toast--slide-enter,
.vime-toast-container--bottom-right .vime-toast--slide-enter {
    animation: vime-toast-slide-in-right 0.3s ease-out forwards;
}

/* Slide Enter - Left positions */
.vime-toast-container--top-left .vime-toast--slide-enter,
.vime-toast-container--bottom-left .vime-toast--slide-enter {
    animation: vime-toast-slide-in-left 0.3s ease-out forwards;
}

/* Slide Enter - Center positions */
.vime-toast-container--top-center .vime-toast--slide-enter {
    animation: vime-toast-slide-in-top 0.3s ease-out forwards;
}

.vime-toast-container--bottom-center .vime-toast--slide-enter {
    animation: vime-toast-slide-in-bottom 0.3s ease-out forwards;
}

/* Slide Exit - Right positions */
.vime-toast-container--top-right .vime-toast--slide-exit,
.vime-toast-container--bottom-right .vime-toast--slide-exit {
    animation: vime-toast-slide-out-right 0.3s ease-in forwards;
}

/* Slide Exit - Left positions */
.vime-toast-container--top-left .vime-toast--slide-exit,
.vime-toast-container--bottom-left .vime-toast--slide-exit {
    animation: vime-toast-slide-out-left 0.3s ease-in forwards;
}

/* Slide Exit - Center positions */
.vime-toast-container--top-center .vime-toast--slide-exit {
    animation: vime-toast-slide-out-top 0.3s ease-in forwards;
}

.vime-toast-container--bottom-center .vime-toast--slide-exit {
    animation: vime-toast-slide-out-bottom 0.3s ease-in forwards;
}

@keyframes vime-toast-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes vime-toast-slide-out-right {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes vime-toast-slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes vime-toast-slide-out-left {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

@keyframes vime-toast-slide-in-top {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes vime-toast-slide-out-top {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

@keyframes vime-toast-slide-in-bottom {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes vime-toast-slide-out-bottom {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(100%);
    }
}

/* ==========================================================================
   Animations - Fade
   ========================================================================== */

.vime-toast--fade-enter {
    animation: vime-toast-fade-in 0.3s ease-out forwards;
}

.vime-toast--fade-exit {
    animation: vime-toast-fade-out 0.3s ease-in forwards;
}

@keyframes vime-toast-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes vime-toast-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ==========================================================================
   Animations - Bounce
   ========================================================================== */

.vime-toast--bounce-enter {
    animation: vime-toast-bounce-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.vime-toast--bounce-exit {
    animation: vime-toast-bounce-out 0.3s ease-in forwards;
}

@keyframes vime-toast-bounce-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes vime-toast-bounce-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 480px) {
    .vime-toast-container {
        padding: 12px;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }

    .vime-toast-container--top-right,
    .vime-toast-container--top-left,
    .vime-toast-container--top-center {
        top: 0;
    }

    .vime-toast-container--bottom-right,
    .vime-toast-container--bottom-left,
    .vime-toast-container--bottom-center {
        bottom: 0;
    }

    .vime-toast {
        width: 100%;
        max-width: none;
        border-radius: 0;
        border-left-width: 0;
        border-bottom: 4px solid var(--vime-toast-border);
    }

    /* Override slide animations for mobile */
    .vime-toast--slide-enter {
        animation: vime-toast-slide-in-top 0.3s ease-out forwards !important;
    }

    .vime-toast--slide-exit {
        animation: vime-toast-slide-out-top 0.3s ease-in forwards !important;
    }

    .vime-toast-container--bottom-right .vime-toast--slide-enter,
    .vime-toast-container--bottom-left .vime-toast--slide-enter,
    .vime-toast-container--bottom-center .vime-toast--slide-enter {
        animation: vime-toast-slide-in-bottom 0.3s ease-out forwards !important;
    }

    .vime-toast-container--bottom-right .vime-toast--slide-exit,
    .vime-toast-container--bottom-left .vime-toast--slide-exit,
    .vime-toast-container--bottom-center .vime-toast--slide-exit {
        animation: vime-toast-slide-out-bottom 0.3s ease-in forwards !important;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

/*
 * Note: Dark mode color adjustments are handled by the JavaScript ColorUtils.
 * The dynamic color generation uses opacity-based backgrounds that work
 * well in both light and dark modes. No additional CSS overrides needed.
 */

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .vime-toast,
    .vime-toast__progress {
        animation: none !important;
        transition: none !important;
    }

    .vime-toast--slide-enter,
    .vime-toast--fade-enter,
    .vime-toast--bounce-enter {
        opacity: 1 !important;
        transform: none !important;
    }

    .vime-toast--slide-exit,
    .vime-toast--fade-exit,
    .vime-toast--bounce-exit {
        opacity: 0 !important;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .vime-toast-container {
        display: none !important;
    }
}
