/* ========================================
   高級感優化樣式 - Premium Enhancement
   ======================================== */

/* 全局優化 */
:root {
    --premium-gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --premium-gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --premium-gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --premium-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --premium-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --premium-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --premium-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
    --premium-border-radius: 16px;
    --premium-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 頁面背景優化 - 添加微妙紋理 */
body {
    background: 
        radial-gradient(circle at 20% 30%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(118, 75, 162, 0.03) 0%, transparent 50%),
        #f5f7fa;
    backdrop-filter: blur(100px);
}

/* 側邊欄優化 */
.hamburger-sidebar,
.sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
    border-right: 1px solid rgba(102, 126, 234, 0.08);
}

/* Logo 容器增強 */
.logo-container,
.sidebar-header {
    position: relative;
    overflow: hidden;
}

.logo-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.05) 0%, transparent 70%);
    animation: float 8s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(10px, 10px) rotate(180deg); }
}

/* 菜單項目優化 */
.menu-item,
.nav-item {
    position: relative;
    overflow: hidden;
    transition: var(--premium-transition);
    border-radius: 12px;
}

.menu-item::before,
.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s;
}

.menu-item:hover::before,
.nav-item:hover::before {
    left: 100%;
}

.menu-item:hover,
.nav-item:hover {
    transform: translateX(4px);
    box-shadow: var(--premium-shadow-md);
}

.menu-item.active,
.nav-item.active {
    background: var(--premium-gradient-1);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transform: translateX(4px);
}

/* 卡片優化 */
.stat-card,
.dashboard-section,
.card,
.chat-message {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border-radius: var(--premium-border-radius);
    box-shadow: var(--premium-shadow-md);
    border: 1px solid rgba(102, 126, 234, 0.08);
    transition: var(--premium-transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before,
.dashboard-section::before,
.card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--premium-gradient-1);
    border-radius: var(--premium-border-radius);
    opacity: 0;
    transition: opacity 0.4s;
    z-index: -1;
}

.stat-card:hover,
.dashboard-section:hover,
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--premium-shadow-xl);
}

.stat-card:hover::before,
.dashboard-section:hover::before,
.card:hover::before {
    opacity: 0.1;
}

/* 統計圖標優化 */
.stat-icon {
    background: var(--premium-gradient-1);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
    transition: var(--premium-transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.35);
}

/* 按鈕優化 */
.quick-action-btn,
.action-btn,
button[type="submit"],
.google-btn {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    transition: var(--premium-transition);
    border: none;
    border-radius: 12px;
}

.quick-action-btn::after,
.action-btn::after,
button[type="submit"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.quick-action-btn:hover,
.action-btn:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
}

.quick-action-btn:active::after,
.action-btn:active::after,
button[type="submit"]:active::after {
    width: 300px;
    height: 300px;
}

/* 輸入框優化 */
input[type="text"],
input[type="email"],
textarea,
.chat-input-field {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border: 2px solid rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    transition: var(--premium-transition);
    box-shadow: var(--premium-shadow-sm);
}

input:focus,
textarea:focus,
.chat-input-field:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* 聊天消息優化 */
.user-message {
    background: var(--premium-gradient-1);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.ai-message {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: var(--premium-shadow-md);
    border: 1px solid rgba(102, 126, 234, 0.08);
}

/* 頭部導航優化 */
.dashboard-header,
.chat-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

/* 圖表容器優化 */
.chart-container {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border-radius: var(--premium-border-radius);
    padding: 24px;
    box-shadow: var(--premium-shadow-sm);
}

/* 徽章優化 */
.menu-badge,
.badge,
.stat-change {
    background: var(--premium-gradient-1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    transition: var(--premium-transition);
}

.menu-badge:hover,
.badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

/* 載入動畫優化 */
.spinner,
.loading-spinner {
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-top: 4px solid #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* 滾動條優化 */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--premium-gradient-1);
    border-radius: 10px;
    border: 2px solid #fafbfc;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* 文字選擇優化 */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: #1a1a1a;
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: #1a1a1a;
}

/* 標題優化 */
h1, h2, h3, h4, h5, h6 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* 鏈接優化 */
a {
    position: relative;
    transition: var(--premium-transition);
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--premium-gradient-1);
    transition: width 0.3s;
}

a:hover::after {
    width: 100%;
}

/* 工具提示優化 */
[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
    box-shadow: var(--premium-shadow-lg);
    z-index: 1000;
}

/* 漢堡菜單按鈕優化 */
.hamburger-btn {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    box-shadow: var(--premium-shadow-md);
    border: 1px solid rgba(102, 126, 234, 0.08);
    transition: var(--premium-transition);
}

.hamburger-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--premium-shadow-lg);
}

.hamburger-btn:active {
    transform: scale(0.95);
}

/* 用戶頭像優化 */
.user-avatar,
.avatar {
    border: 3px solid transparent;
    background: linear-gradient(white, white) padding-box,
                var(--premium-gradient-1) border-box;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transition: var(--premium-transition);
}

.user-avatar:hover,
.avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.3);
}

/* 搜索框優化 */
.search-input,
input[type="search"] {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border: 2px solid rgba(102, 126, 234, 0.1);
    box-shadow: var(--premium-shadow-sm);
    transition: var(--premium-transition);
}

.search-input:focus,
input[type="search"]:focus {
    background: #ffffff;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* 動畫效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* 應用淡入動畫 */
.stat-card,
.dashboard-section,
.chat-message {
    animation: fadeInUp 0.6s ease-out;
}

/* 響應式優化 */
@media (max-width: 768px) {
    :root {
        --premium-border-radius: 12px;
    }
    
    .stat-card,
    .dashboard-section {
        box-shadow: var(--premium-shadow-sm);
    }
    
    .stat-card:hover,
    .dashboard-section:hover {
        transform: translateY(-2px);
        box-shadow: var(--premium-shadow-md);
    }
}

/* 玻璃效果 (Glassmorphism) */
.glass-effect {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 霓虹效果 */
.neon-glow {
    box-shadow: 
        0 0 5px rgba(102, 126, 234, 0.5),
        0 0 10px rgba(102, 126, 234, 0.4),
        0 0 20px rgba(102, 126, 234, 0.3),
        0 0 40px rgba(102, 126, 234, 0.2);
}

/* 微交互優化 */
button,
.clickable {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

button:active,
.clickable:active {
    transform: scale(0.98);
}

/* 品牌 Logo 圖片優化 */
.brand-logo-image {
    filter: drop-shadow(0 8px 24px rgba(102, 126, 234, 0.15));
    transition: var(--premium-transition);
}

.brand-logo-image:hover {
    filter: drop-shadow(0 12px 32px rgba(102, 126, 234, 0.25));
    transform: translateY(-4px) scale(1.02);
}
