/* ========================================
   Q北 Toast 通知系統
   角落滑入式通知，用於輕量級回饋
   Q北 頭像凸出框外，更有角色感
   ======================================== */

/* Toast 容器 - 正下方居中 */
.qbei-toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

/* 單個 Toast - 為凸出頭像留空間 */
.qbei-toast {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #fffbf0 0%, #fef3c7 100%);
    border: 3px solid #b45309;
    border-radius: 20px;
    padding: 16px 20px 16px 72px; /* 左側留空給頭像 */
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.25),
        0 4px 12px rgba(180, 83, 9, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    animation: qbei-toast-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    max-width: 360px;
    min-width: 280px;
}

.qbei-toast.hiding {
    animation: qbei-toast-out 0.3s ease forwards;
}

@keyframes qbei-toast-in {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    60% {
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes qbei-toast-out {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
}

/* Q北 頭像 - 凸出框外！ */
.qbei-toast-avatar {
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.qbei-toast:hover .qbei-toast-avatar {
    transform: translateY(-50%) scale(1.1);
}

.qbei-toast-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 台詞文字 - 毛筆風格 */
.qbei-toast-text {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.05rem;
    line-height: 1.5;
    color: #451a03;
    font-weight: 500;
    flex: 1;
}

/* 特殊狀態：成功（綠色光暈） */
.qbei-toast.success {
    border-color: #16a34a;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(34, 197, 94, 0.3);
}

/* 特殊狀態：已存在（藍色） */
.qbei-toast.info {
    border-color: #2563eb;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(59, 130, 246, 0.2);
}

/* 特殊狀態：忙碌（琥珀色） */
.qbei-toast.busy {
    border-color: #d97706;
}

/* 特殊狀態：移除成功（爽快綠） */
.qbei-toast.remove {
    border-color: #059669;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(16, 185, 129, 0.3);
}

.qbei-toast.remove .qbei-toast-text {
    color: #065f46;
}

/* 特殊狀態：錯誤（紅色） */
.qbei-toast.error {
    border-color: #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.qbei-toast.error .qbei-toast-text {
    color: #991b1b;
}

/* 深色模式 */
[data-theme="dark"] .qbei-toast {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #b45309;
}

[data-theme="dark"] .qbei-toast-text {
    color: #fef3c7;
}

[data-theme="dark"] .qbei-toast.remove {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
}

[data-theme="dark"] .qbei-toast.remove .qbei-toast-text {
    color: #d1fae5;
}

/* 手機版 */
@media (max-width: 767px) {
    .qbei-toast-container {
        bottom: 90px; /* 避開底部導航 */
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    
    .qbei-toast {
        max-width: calc(100vw - 60px);
        min-width: 240px;
        padding: 14px 16px 14px 60px;
    }
    
    .qbei-toast-avatar {
        width: 56px;
        height: 56px;
        left: -16px;
    }
    
    .qbei-toast-text {
        font-size: 0.95rem;
    }
}
