﻿/* ============================================
   ADVANCED TOAST LIBRARY v2.0 - FIXED
   Production Ready - Full Feature Set
   ============================================ */

/* ===== ROOT VARIABLES ===== */
:root {
    --toast-success: #00b894;
    --toast-success-light: #00d2a0;
    --toast-error: #ff6b6b;
    --toast-error-light: #ff4757;
    --toast-warning: #fdcb6e;
    --toast-warning-light: #f9ca24;
    --toast-info: #0984e3;
    --toast-info-light: #74b9ff;
    --toast-dark: #2d3436;
    --toast-dark-light: #636e72;
    --toast-primary: #6c5ce7;
    --toast-primary-light: #a29bfe;
    --toast-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    --toast-shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.25);
    --toast-radius: 12px;
    --toast-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --toast-transition: 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== CONTAINER - FIXED VISIBILITY ===== */
.toast-container {
    position: fixed !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    max-width: 420px !important;
    width: 100% !important;
    padding: 12px !important;
    pointer-events: none !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
}

    .toast-container * {
        pointer-events: auto !important;
        box-sizing: border-box !important;
    }

/* Container Positions */
.toast-container-top-right {
    top: 20px !important;
    right: 20px !important;
    align-items: flex-end !important;
}

.toast-container-top-left {
    top: 20px !important;
    left: 20px !important;
    align-items: flex-start !important;
}

.toast-container-top-center {
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    align-items: center !important;
}

.toast-container-bottom-right {
    bottom: 20px !important;
    right: 20px !important;
    align-items: flex-end !important;
}

.toast-container-bottom-left {
    bottom: 20px !important;
    left: 20px !important;
    align-items: flex-start !important;
}

.toast-container-bottom-center {
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    align-items: center !important;
}

.toast-container-center {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 480px !important;
    align-items: center !important;
}

/* ===== TOAST - FIXED VISIBILITY ===== */
.toast {
    position: relative !important;
    padding: 16px 20px !important;
    border-radius: var(--toast-radius) !important;
    color: #fff !important;
    font-family: var(--toast-font) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    box-shadow: var(--toast-shadow) !important;
    animation: toastSlideIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 14px !important;
    min-height: 56px !important;
    width: 100% !important;
    overflow: hidden !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    transition: all var(--toast-transition) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

    .toast:hover {
        transform: translateY(-2px) scale(1.01) !important;
        box-shadow: var(--toast-shadow-hover) !important;
    }

/* Toast Types */
.toast-success {
    background: linear-gradient(135deg, var(--toast-success), #00a884) !important;
    border-left: 4px solid var(--toast-success-light) !important;
}

.toast-error {
    background: linear-gradient(135deg, var(--toast-error), #ee5a24) !important;
    border-left: 4px solid var(--toast-error-light) !important;
}

.toast-warning {
    background: linear-gradient(135deg, var(--toast-warning), #f39c12) !important;
    border-left: 4px solid var(--toast-warning-light) !important;
    color: #2d3436 !important;
}

    .toast-warning .toast-close {
        color: #2d3436 !important;
    }

.toast-info {
    background: linear-gradient(135deg, var(--toast-info), #0652DD) !important;
    border-left: 4px solid var(--toast-info-light) !important;
}

.toast-dark {
    background: linear-gradient(135deg, var(--toast-dark), #1a1a2e) !important;
    border-left: 4px solid var(--toast-dark-light) !important;
}

.toast-primary {
    background: linear-gradient(135deg, var(--toast-primary), #4834d4) !important;
    border-left: 4px solid var(--toast-primary-light) !important;
}

/* ===== TOAST ICON ===== */
.toast-icon-wrapper {
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.2) !important;
    font-size: 18px !important;
    margin-top: 2px !important;
    transition: all var(--toast-transition) !important;
}

.toast:hover .toast-icon-wrapper {
    transform: scale(1.1) !important;
}

/* ===== TOAST CONTENT ===== */
.toast-content {
    flex: 1 !important;
    min-width: 0 !important;
}

.toast-title {
    display: block !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    margin-bottom: 2px !important;
    letter-spacing: 0.3px !important;
}

.toast-message {
    display: block !important;
    font-size: 14px !important;
    opacity: 0.95 !important;
    word-break: break-word !important;
}

    .toast-message:not(:first-child) {
        margin-top: 2px !important;
    }

    .toast-message a {
        color: inherit !important;
        text-decoration: underline !important;
        opacity: 0.9 !important;
    }

        .toast-message a:hover {
            opacity: 1 !important;
        }

/* ===== TOAST ACTIONS ===== */
.toast-actions {
    display: flex !important;
    gap: 8px !important;
    margin-top: 10px !important;
    flex-wrap: wrap !important;
}

.toast-btn {
    padding: 5px 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: inherit !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    text-decoration: none !important;
    font-family: inherit !important;
    letter-spacing: 0.3px !important;
}

    .toast-btn:hover {
        background: rgba(255, 255, 255, 0.25) !important;
        transform: scale(1.04) !important;
        border-color: rgba(255, 255, 255, 0.4) !important;
    }

.toast-btn-primary {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

    .toast-btn-primary:hover {
        background: rgba(255, 255, 255, 0.35) !important;
    }

/* ===== TOAST CLOSE ===== */
.toast-close {
    flex-shrink: 0 !important;
    background: none !important;
    border: none !important;
    color: inherit !important;
    font-size: 24px !important;
    cursor: pointer !important;
    opacity: 0.5 !important;
    transition: all 0.3s ease !important;
    padding: 0 4px !important;
    line-height: 1 !important;
    margin-top: -4px !important;
    font-weight: 300 !important;
}

    .toast-close:hover {
        opacity: 1 !important;
        transform: rotate(90deg) scale(1.1) !important;
    }

/* ===== TOAST PROGRESS ===== */
.toast-progress {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 3px !important;
    background: rgba(255, 255, 255, 0.4) !important;
    border-radius: 0 0 var(--toast-radius) var(--toast-radius) !important;
    width: 100% !important;
    transform-origin: left !important;
}

.toast-progress-animated {
    animation: toastProgress linear forwards !important;
}

/* ===== TOAST VARIANTS ===== */

/* Compact */
.toast-compact {
    padding: 12px 16px !important;
    min-height: 44px !important;
    font-size: 13px !important;
}

    .toast-compact .toast-icon-wrapper {
        width: 28px !important;
        height: 28px !important;
        font-size: 15px !important;
    }

    .toast-compact .toast-title {
        font-size: 14px !important;
    }

    .toast-compact .toast-message {
        font-size: 13px !important;
    }

/* No Icon */
.toast-no-icon .toast-icon-wrapper {
    display: none !important;
}

/* Rounded */
.toast-rounded {
    border-radius: 50px !important;
}

    .toast-rounded .toast-progress {
        border-radius: 0 0 50px 50px !important;
    }

/* Shadowless */
.toast-no-shadow {
    box-shadow: none !important;
}

    .toast-no-shadow:hover {
        box-shadow: none !important;
        transform: none !important;
    }

/* ===== ANIMATIONS ===== */

/* Slide In */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(60px) scale(0.92);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Slide Out */
@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(60px) scale(0.92);
    }
}

/* Fade In */
@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fade Out */
@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Bounce In */
@keyframes toastBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* Progress */
@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Toast States */
.toast-hide {
    animation: toastSlideOut 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}

.toast-hide-fade {
    animation: toastFadeOut 0.3s ease forwards !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 576px) {
    .toast-container {
        max-width: 100% !important;
        padding: 8px !important;
        width: calc(100% - 16px) !important;
    }

    .toast-container-top-right,
    .toast-container-top-left,
    .toast-container-top-center {
        top: 8px !important;
        left: 8px !important;
        right: 8px !important;
        transform: none !important;
    }

    .toast-container-bottom-right,
    .toast-container-bottom-left,
    .toast-container-bottom-center {
        bottom: 8px !important;
        left: 8px !important;
        right: 8px !important;
        transform: none !important;
    }

    .toast-container-center {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        padding: 16px !important;
    }

    .toast {
        padding: 14px 16px !important;
        font-size: 13px !important;
        min-height: 48px !important;
        border-radius: 10px !important;
    }

    .toast-icon-wrapper {
        width: 30px !important;
        height: 30px !important;
        font-size: 16px !important;
    }

    .toast-title {
        font-size: 14px !important;
    }

    .toast-close {
        font-size: 20px !important;
    }

    .toast-actions {
        gap: 6px !important;
    }

    .toast-btn {
        padding: 4px 12px !important;
        font-size: 11px !important;
    }

    .toast-compact {
        padding: 10px 14px !important;
        min-height: 40px !important;
    }

        .toast-compact .toast-icon-wrapper {
            width: 24px !important;
            height: 24px !important;
            font-size: 13px !important;
        }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
    .toast {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    }

    .toast-warning {
        background: linear-gradient(135deg, #fdcb6e, #f39c12) !important;
    }
}

/* ===== PRINT ===== */
@media print {
    .toast-container {
        display: none !important;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .toast {
        animation-duration: 0.01ms !important;
    }

    .toast-progress-animated {
        animation-duration: 0.01ms !important;
    }

    .toast-hide {
        animation-duration: 0.01ms !important;
    }
}
