﻿/**
 * 全域通知系統樣式 V2.0
 * 
 * 功能特色：
 * - 現代化設計語言
 * - 流暢動畫效果
 * - 響應式佈局
 * - 暗色主題支援
 * - Tocas UI 整合
 * - 無障礙設計
 * 
 * 相容性：支援現代瀏覽器及 IE11+
 * 
 * @version 2.0.0
 * @author GitHub Copilot
 */

/* ===== 核心容器樣式 ===== */
.notification-container {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 40px);
    overflow: visible;
}

/* ===== 通知項目基礎樣式 ===== */
.notification-item {
    pointer-events: auto;
    border-radius: 8px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateX(100%);
    transition: all 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-width: 300px;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* 顯示狀態 */
.notification-item.show {
    opacity: 1;
    transform: translateX(0);
}

/* 隱藏狀態 */
.notification-item.hide {
    opacity: 0;
    transform: translateX(100%);
    transition: all 300ms cubic-bezier(0.55, 0.06, 0.68, 0.19);
}

/* 懸停效果 */
.notification-item:hover {
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* ===== 內容區域樣式 ===== */
.notification-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px;
    gap: 12px;
    min-height: 48px;
}

.notification-message-area {
    display: flex;
    align-items: flex-start;
    flex: 1;
    gap: 12px;
}

.notification-icon {
    font-size: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    opacity: 0.9;
}

.notification-text {
    flex: 1;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.notification-message {
    flex: 1;
    min-width: 0;
}

/* ===== 計數徽章樣式 ===== */
.notification-count {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    animation: badge-appear 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-width: 20px;
    text-align: center;
}

/* ===== 關閉按鈕樣式 ===== */
.notification-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 6px;
    margin: -6px -6px -6px 6px;
    opacity: 0.7;
    transition: all 0.2s ease;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0px;
    height: 0px;
    position: absolute;
    right: 24px;
    font-size: 14px;
}

.notification-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.notification-close:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.95);
}

.notification-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ===== 進度條樣式 ===== */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    transition: width linear;
    border-radius: 0 0 8px 8px;
}


/* ===== 動畫效果 ===== */
@keyframes badge-appear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% { 
        transform: translateX(0); 
    }
    25% { 
        transform: translateX(-3px); 
    }
    75% { 
        transform: translateX(3px); 
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.15),
            0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 
            0 8px 20px rgba(0, 0, 0, 0.2),
            0 4px 8px rgba(0, 0, 0, 0.15),
            0 0 20px rgba(255, 255, 255, 0.1);
    }
}

.notification-item.shake {
    animation: shake 0.5s ease-in-out;
}

.notification-item.pulse {
    animation: pulse-glow 1s ease-in-out;
}

/* ===== 滑入動畫變體 ===== */
.notification-container[data-position="top-left"] .notification-item,
.notification-container[data-position="bottom-left"] .notification-item {
    transform: translateX(-100%);
}

.notification-container[data-position="top-left"] .notification-item.show,
.notification-container[data-position="bottom-left"] .notification-item.show {
    transform: translateX(0);
}

.notification-container[data-position="top-center"] .notification-item,
.notification-container[data-position="bottom-center"] .notification-item {
    transform: translateY(-100%);
}

.notification-container[data-position="top-center"] .notification-item.show,
.notification-container[data-position="bottom-center"] .notification-item.show {
    transform: translateY(0);
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
    .notification-container {
        left: 16px !important;
        right: 16px !important;
        transform: none !important;
        max-width: none !important;
    }
    
    .notification-item {
        min-width: auto !important;
        max-width: none !important;
        margin: 0;
    }

    .notification-content {
        padding: 14px;
        gap: 10px;
    }

    .notification-message-area {
        gap: 10px;
    }

    .notification-icon {
        font-size: 16px;
    }

    .notification-text {
        font-size: 13px;
    }

    .notification-close {
        width: 24px;
        height: 24px;
        padding: 4px;
        margin: -4px -4px -4px 4px;
    }
}

@media (max-width: 480px) {
    .notification-container {
        left: 12px !important;
        right: 12px !important;
    }

    .notification-content {
        padding: 12px;
        gap: 8px;
    }

    .notification-text {
        font-size: 12px;
        line-height: 1.4;
    }

    .notification-count {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* ===== 減少動畫偏好支援 ===== */
@media (prefers-reduced-motion: reduce) {
    .notification-item,
    .notification-close,
    .notification-count,
    .notification-progress {
        transition: none !important;
        animation: none !important;
    }

    .notification-item.show {
        opacity: 1;
        transform: none;
    }

    .notification-item.hide {
        opacity: 0;
        transform: none;
    }
}

/* ===== 暗色主題支援 ===== */
@media (prefers-color-scheme: dark) {
   
    
    .notification-item:hover {
        box-shadow: 
            0 8px 20px rgba(0, 0, 0, 0.5),
            0 4px 8px rgba(0, 0, 0, 0.4);
    }


    .notification-close:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .notification-progress {
        background: rgba(255, 255, 255, 0.3);
    }
}

/* ===== 焦點可見性增強 ===== */
.notification-item:focus-within {
    outline: 2px solid var(--ts-primary-500, #3b82f6);
    outline-offset: 2px;
}

/* ===== 自訂變數支援 ===== */
:root {
    --notification-border-radius: 8px;
    --notification-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --notification-spacing: 10px;
    --notification-max-width: 500px;
    --notification-min-width: 300px;
}

/* ===== 印刷樣式 ===== */
@media print {
    .notification-container {
        display: none !important;
    }
}
