/**
 * HUSHIKO Video Toast Styles
 *
 * Sticky toast notifications for video generation progress
 * with magical animations matching the HUSHIKO design system.
 *
 * @version 1.0.0
 * @date 2025-12-12
 */

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

.video-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    pointer-events: none;
}

.video-toast-container > * {
    pointer-events: auto;
}

/* ===========================
   Toast Base
   =========================== */

.video-toast {
    background: var(--bg-card, #ffffff);
    border-radius: 16px;
    box-shadow:
        0 10px 40px rgba(107, 91, 149, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 1.25rem;
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(155, 135, 217, 0.15);
}

.video-toast.visible {
    opacity: 1;
    transform: translateX(0);
}

.video-toast.dismissing {
    opacity: 0;
    transform: translateX(120%);
}

.video-toast.minimized {
    padding: 0.75rem 1rem;
}

.video-toast.minimized .video-toast-progress,
.video-toast.minimized .video-toast-footer,
.video-toast.minimized .video-toast-subtitle {
    display: none;
}

.video-toast.minimized .video-toast-header {
    margin-bottom: 0;
}

/* Dark mode */
[data-theme="dark"] .video-toast {
    background: var(--bg-card, #1a1a2e);
    border-color: rgba(155, 135, 217, 0.2);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===========================
   Header
   =========================== */

.video-toast-header {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.video-toast-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-toast-icon.generating {
    background: linear-gradient(135deg, rgba(155, 135, 217, 0.15), rgba(255, 159, 102, 0.15));
}

.video-toast-icon.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.15));
    color: #10B981;
}

.video-toast-icon.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(248, 113, 113, 0.15));
    color: #EF4444;
}

.video-toast-content {
    flex: 1;
    min-width: 0;
}

.video-toast-title {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.video-toast-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary, #666);
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .video-toast-title {
    color: var(--text-primary, #f0f0f0);
}

[data-theme="dark"] .video-toast-subtitle {
    color: var(--text-secondary, #aaa);
}

/* ===========================
   Close/Minimize Buttons
   =========================== */

.video-toast-close,
.video-toast-minimize {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #999);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.video-toast-close:hover,
.video-toast-minimize:hover {
    background: rgba(155, 135, 217, 0.1);
    color: var(--text-primary, #333);
}

[data-theme="dark"] .video-toast-close:hover,
[data-theme="dark"] .video-toast-minimize:hover {
    background: rgba(155, 135, 217, 0.2);
    color: var(--text-primary, #f0f0f0);
}

/* ===========================
   Progress Bar
   =========================== */

.video-toast-progress {
    margin-bottom: 0.875rem;
}

.video-toast-progress-bar {
    height: 8px;
    background: var(--bg-secondary, #f0f0f0);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .video-toast-progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

.video-toast-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9B87D9, #FF9F66);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.video-toast-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.video-toast-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
}

.video-toast-progress-label {
    color: var(--text-secondary, #666);
}

.video-toast-progress-percent {
    font-weight: 600;
    color: #9B87D9;
}

[data-theme="dark"] .video-toast-progress-label {
    color: var(--text-secondary, #aaa);
}

/* ===========================
   Footer
   =========================== */

.video-toast-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.video-toast-hint {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted, #999);
}

.video-toast-hint svg {
    opacity: 0.7;
}

.video-toast-time {
    color: #9B87D9;
    font-weight: 500;
}

[data-theme="dark"] .video-toast-hint {
    color: var(--text-muted, #777);
}

/* ===========================
   Action Buttons
   =========================== */

.video-toast-actions {
    display: flex;
    gap: 0.625rem;
    margin-top: 0.75rem;
}

.video-toast-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.video-toast-btn.primary {
    background: linear-gradient(135deg, #9B87D9, #8B77C9);
    color: white;
}

.video-toast-btn.primary:hover {
    background: linear-gradient(135deg, #8B77C9, #7B67B9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(155, 135, 217, 0.3);
}

.video-toast-btn.secondary {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-secondary, #666);
}

.video-toast-btn.secondary:hover {
    background: var(--bg-hover, #eee);
}

[data-theme="dark"] .video-toast-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #aaa);
}

[data-theme="dark"] .video-toast-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ===========================
   Spinner Animation
   =========================== */

.video-toast-spinner {
    width: 24px;
    height: 24px;
    animation: spin 1.2s linear infinite;
}

.video-toast-spinner circle {
    fill: none;
    stroke: #9B87D9;
    stroke-dasharray: 50;
    stroke-dashoffset: 0;
    stroke-linecap: round;
}

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

/* ===========================
   Success State
   =========================== */

.video-toast.success .video-toast-icon svg {
    animation: checkPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes checkPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===========================
   Error State
   =========================== */

.video-toast.error .video-toast-icon svg {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

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

@media (max-width: 640px) {
    .video-toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: none;
    }

    .video-toast {
        padding: 1rem;
    }

    .video-toast-header {
        gap: 0.75rem;
    }

    .video-toast-icon {
        width: 36px;
        height: 36px;
    }

    .video-toast-title {
        font-size: 0.875rem;
    }

    .video-toast-subtitle {
        font-size: 0.75rem;
    }

    .video-toast-actions {
        flex-direction: column;
    }

    .video-toast-btn {
        width: 100%;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .video-toast,
    .video-toast-progress-fill,
    .video-toast-spinner,
    .video-toast.success .video-toast-icon svg,
    .video-toast.error .video-toast-icon svg {
        animation: none;
        transition: opacity 0.1s ease;
    }

    .video-toast-progress-fill::after {
        display: none;
    }
}

/* ===========================
   Focus States
   =========================== */

.video-toast-btn:focus-visible,
.video-toast-close:focus-visible,
.video-toast-minimize:focus-visible {
    outline: 2px solid #9B87D9;
    outline-offset: 2px;
}
