/**
 * Toast 通知系統樣式
 * 用於替換 alert() 提供更好的使用者體驗
 */

/* Toast 容器 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

/* Toast 項目 */
.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    display: flex;
    align-items: start;
    gap: 12px;
    min-width: 300px;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

/* Toast 消失動畫 */
.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

/* Toast 圖標 */
.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

/* Toast 內容 */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.toast-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.toast-message {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin: 0;
    white-space: pre-line;
}

/* Toast 關閉按鈕 */
.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #333;
}

/* Toast 進度條 */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
    transform-origin: left;
}

/* Toast 類型 */
.toast.success {
    border-left: 4px solid #4caf50;
}

.toast.success .toast-icon {
    color: #4caf50;
}

.toast.success .toast-progress {
    background: #4caf50;
}

.toast.error {
    border-left: 4px solid #f44336;
}

.toast.error .toast-icon {
    color: #f44336;
}

.toast.error .toast-progress {
    background: #f44336;
}

.toast.warning {
    border-left: 4px solid #ff9800;
}

.toast.warning .toast-icon {
    color: #ff9800;
}

.toast.warning .toast-progress {
    background: #ff9800;
}

.toast.info {
    border-left: 4px solid #2196f3;
}

.toast.info .toast-icon {
    color: #2196f3;
}

.toast.info .toast-progress {
    background: #2196f3;
}

/* 動畫 */
@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

@keyframes progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}
