/**
 * BeezWoo Toast Notifications Styles
 * 
 * Multiple themes: modern, minimal, material, glass
 * 
 * @package BeezWoo
 * @since 2.3.4
 */

/* Container */
.beezwoo-toast-container {
    --toast-radius: 12px;
    --toast-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 40px);
}

/* Position overrides - these are applied via JS but we have safe defaults */
.beezwoo-toast-container[data-position="top-left"] { top: 20px; right: auto; left: 20px; }
.beezwoo-toast-container[data-position="top-center"] { top: 20px; right: auto; left: 50%; transform: translateX(-50%); }
.beezwoo-toast-container[data-position="bottom-right"] { top: auto; bottom: 20px; right: 20px; }
.beezwoo-toast-container[data-position="bottom-left"] { top: auto; bottom: 20px; right: auto; left: 20px; }
.beezwoo-toast-container[data-position="bottom-center"] { top: auto; bottom: 20px; right: auto; left: 50%; transform: translateX(-50%); }

/* No shadow variant */
.beezwoo-toast-container.no-shadow {
    --toast-shadow: none;
}

/* Position variants */
.beezwoo-toast-container[data-position^="top"] {
    flex-direction: column;
}

.beezwoo-toast-container[data-position^="bottom"] {
    flex-direction: column-reverse;
}

/* Toast base */
.beezwoo-toast {
    --toast-color: #3b82f6;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-radius: var(--toast-radius, 12px);
    box-shadow: var(--toast-shadow);
    pointer-events: auto;
    overflow: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animations based on position */
.beezwoo-toast-container[data-position*="right"] .beezwoo-toast {
    transform: translateX(100%);
}

.beezwoo-toast-container[data-position*="left"] .beezwoo-toast {
    transform: translateX(-100%);
}

.beezwoo-toast-container[data-position*="center"] .beezwoo-toast {
    transform: translateY(-20px);
}

.beezwoo-toast-container[data-position^="bottom"] .beezwoo-toast {
    transform: translateY(100%);
}

/* Visible state - must have higher specificity than position-based transforms */
.beezwoo-toast-container .beezwoo-toast.is-visible {
    opacity: 1;
    transform: translateX(0) translateY(0) !important;
}

/* Hiding state */
.beezwoo-toast-container .beezwoo-toast.is-hiding {
    opacity: 0;
    transform: scale(0.9) !important;
}

/* Animation variants */
.beezwoo-toast[data-animation="fade"] {
    transform: none !important;
}

.beezwoo-toast-container .beezwoo-toast[data-animation="fade"].is-visible {
    transform: none !important;
}

.beezwoo-toast-container .beezwoo-toast[data-animation="bounce"].is-visible {
    animation: toastBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: none !important;
}

@keyframes toastBounce {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.beezwoo-toast[data-animation="none"] {
    transform: none !important;
    transition: opacity 0.15s;
}

/* Icon */
.beezwoo-toast__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--toast-color);
    color: #fff;
}

.beezwoo-toast__icon svg {
    width: 14px;
    height: 14px;
}

/* Content */
.beezwoo-toast__content {
    flex: 1;
    min-width: 0;
}

.beezwoo-toast__title {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.beezwoo-toast__message {
    font-size: 13px;
    color: #4a4a4a;
    line-height: 1.4;
    word-break: break-word;
}

/* Action button */
.beezwoo-toast__action {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--toast-color);
    color: #fff !important;
    font-size: 12px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s;
}

.beezwoo-toast__action:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Close button */
.beezwoo-toast__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #999;
    transition: all 0.2s;
    margin: -4px -4px -4px 0;
}

.beezwoo-toast__close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.beezwoo-toast__close svg {
    width: 16px;
    height: 16px;
}

/* Progress bar */
.beezwoo-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.beezwoo-toast__progress-bar {
    height: 100%;
    background: var(--toast-color);
    animation: toastProgress linear forwards;
    animation-play-state: paused;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Type colors */
.beezwoo-toast--success { --toast-color: #10b981; }
.beezwoo-toast--error { --toast-color: #ef4444; }
.beezwoo-toast--warning { --toast-color: #f59e0b; }
.beezwoo-toast--info { --toast-color: #3b82f6; }

/* ============================================
   THEME: Minimal
   ============================================ */
.beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left: 4px solid var(--toast-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast__icon {
    background: transparent;
    color: var(--toast-color);
    width: 20px;
    height: 20px;
}

.beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast__icon svg {
    width: 20px;
    height: 20px;
}

.beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast__progress {
    height: 2px;
}

/* ============================================
   THEME: Material
   ============================================ */
.beezwoo-toast-container[data-theme="material"] .beezwoo-toast {
    background: #323232;
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14), 0 1px 18px 0 rgba(0,0,0,.12);
}

.beezwoo-toast-container[data-theme="material"] .beezwoo-toast__icon {
    background: transparent;
    color: var(--toast-color);
}

.beezwoo-toast-container[data-theme="material"] .beezwoo-toast__title {
    color: #fff;
}

.beezwoo-toast-container[data-theme="material"] .beezwoo-toast__message {
    color: rgba(255, 255, 255, 0.85);
}

.beezwoo-toast-container[data-theme="material"] .beezwoo-toast__close {
    color: rgba(255, 255, 255, 0.6);
}

.beezwoo-toast-container[data-theme="material"] .beezwoo-toast__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.beezwoo-toast-container[data-theme="material"] .beezwoo-toast__action {
    background: transparent;
    color: var(--toast-color) !important;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.beezwoo-toast-container[data-theme="material"] .beezwoo-toast__progress {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   THEME: Glass
   ============================================ */
.beezwoo-toast-container[data-theme="glass"] .beezwoo-toast {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.beezwoo-toast-container[data-theme="glass"] .beezwoo-toast__icon {
    background: linear-gradient(135deg, var(--toast-color), color-mix(in srgb, var(--toast-color) 70%, black));
}

.beezwoo-toast-container[data-theme="glass"] .beezwoo-toast__progress {
    background: rgba(0, 0, 0, 0.05);
}

.beezwoo-toast-container[data-theme="glass"] .beezwoo-toast__progress-bar {
    background: linear-gradient(90deg, var(--toast-color), color-mix(in srgb, var(--toast-color) 70%, white));
}

/* ============================================
   Type-specific backgrounds (for glass/modern)
   ============================================ */
.beezwoo-toast-container[data-theme="modern"] .beezwoo-toast--success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
}

.beezwoo-toast-container[data-theme="modern"] .beezwoo-toast--error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
}

.beezwoo-toast-container[data-theme="modern"] .beezwoo-toast--warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
}

.beezwoo-toast-container[data-theme="modern"] .beezwoo-toast--info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
}

.beezwoo-toast-container[data-theme="modern"] .beezwoo-toast {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ============================================
   Mobile responsive
   ============================================ */
@media (max-width: 480px) {
    .beezwoo-toast-container {
        max-width: calc(100% - 20px);
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
    }
    
    .beezwoo-toast-container[data-position*="right"],
    .beezwoo-toast-container[data-position*="left"],
    .beezwoo-toast-container[data-position*="center"] {
        left: 10px !important;
        right: 10px !important;
    }
    
    .beezwoo-toast {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .beezwoo-toast__icon {
        width: 22px;
        height: 22px;
    }
    
    .beezwoo-toast__icon svg {
        width: 12px;
        height: 12px;
    }
    
    .beezwoo-toast__message {
        font-size: 12px;
    }
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .beezwoo-toast-container[data-position^="bottom"] {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .beezwoo-toast {
        transition: opacity 0.15s;
        transform: none !important;
    }
    
    .beezwoo-toast__progress-bar {
        animation: none !important;
        width: 0 !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .beezwoo-toast-container[data-theme="modern"] .beezwoo-toast,
    .beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast {
        background: #1f2937;
        border-color: #374151;
    }
    
    .beezwoo-toast-container[data-theme="modern"] .beezwoo-toast__title,
    .beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast__title {
        color: #f9fafb;
    }
    
    .beezwoo-toast-container[data-theme="modern"] .beezwoo-toast__message,
    .beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast__message {
        color: #d1d5db;
    }
    
    .beezwoo-toast-container[data-theme="modern"] .beezwoo-toast__close,
    .beezwoo-toast-container[data-theme="minimal"] .beezwoo-toast__close {
        color: #9ca3af;
    }
    
    .beezwoo-toast-container[data-theme="glass"] .beezwoo-toast {
        background: rgba(31, 41, 55, 0.85);
        border-color: rgba(55, 65, 81, 0.5);
    }
    
    .beezwoo-toast-container[data-theme="glass"] .beezwoo-toast__title {
        color: #f9fafb;
    }
    
    .beezwoo-toast-container[data-theme="glass"] .beezwoo-toast__message {
        color: #d1d5db;
    }
}

/* Print: hide toasts */
@media print {
    .beezwoo-toast-container {
        display: none !important;
    }
}
