/* ===== 基礎設置 ===== */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #00d4ff;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --danger-color: #e74c3c;
    --deep-blue: #1a237e;
    --darker-blue: #121858;
    --surface-color: #283593;
    --card-bg: #303f9f;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --sidebar-width: 250px;
}

/* 深色主題 */
.dark-theme {
    --background-color: #1a1a1a;
    --surface-color: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--deep-blue);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* 應用容器 */
.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* 側邊欄 */
.sidebar {
    background: var(--darker-blue);
    padding: 1.5rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.5s ease-out;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.brand i {
    color: var(--primary-color);
}

/* 導航鏈接 */
.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

.nav-link.active {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
    animation: glowBorder 2s infinite;
}

/* 用戶資料 */
.user-profile {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-info {
    width: 100%;
}

.user-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 1px;
}

/* 移除舊的頭像相關樣式 */
.user-profile img {
    display: none;
}

/* 登出按鈕樣式優化 */
.logout-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(45deg, var(--danger-color), #c0392b);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.logout-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
}

.logout-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.2),
        transparent
    );
    animation: shine 2s infinite;
}

/* 登出按鈕圖標動畫 */
.logout-btn i {
    transition: transform 0.3s ease;
}

.logout-btn:hover i {
    transform: translateX(3px) rotate(360deg);
}

/* 登出確認動畫 */
.logout-btn.confirming {
    animation: shake 0.5s ease-in-out;
}

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

/* 主要內容區 */
.main-content {
    padding: 2rem;
}

/* 頂部欄 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.breadcrumb {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.top-actions {
    display: flex;
    gap: 1rem;
}

.notification-btn, .theme-toggle {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    animation: pulse 2s infinite;
}

/* 內容網格 */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
    animation-delay: 0.3s;
}

/* 統計卡片 */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    animation: fadeIn 0.5s ease-out;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.stat-trend {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    position: relative;
    overflow: hidden;
}

.stat-trend.positive {
    color: var(--success-color);
}

.stat-trend.negative {
    color: var(--danger-color);
}

.stat-trend::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.1),
        transparent
    );
    animation: shine 2s infinite;
}

/* 監控面板 */
.monitor-panel {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.monitor-panel:hover {
    box-shadow: 0 0 20px rgba(67, 97, 238, 0.3);
}

.monitor-panel h2 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.monitor-item {
    text-align: center;
}

.monitor-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: center;
}

/* 監控圖表樣式更新 */
.monitor-chart {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 1rem auto;
}

.progress-ring {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.progress-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary-color) calc(var(--progress) * 1%),
        rgba(255, 255, 255, 0.1) calc(var(--progress) * 1%)
    );
    position: relative;
}

.progress-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: var(--surface-color);
    border-radius: 50%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 活動列表 */
.recent-activities {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.recent-activities:hover {
    box-shadow: 0 0 20px rgba(67, 97, 238, 0.3);
}

.recent-activities h2 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    animation: fadeIn 0.5s ease-out;
    transition: all 0.3s ease;
}

.activity-item:hover {
    background: rgba(255,255,255,0.05);
    transform: translateX(10px);
}

.activity-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 0.5rem;
    position: relative;
}

.activity-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: pulse 2s infinite;
    background: inherit;
    opacity: 0.5;
}

.activity-dot.warning { background: var(--warning-color); }
.activity-dot.success { background: var(--success-color); }

.activity-content {
    flex: 1;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.activity-header time {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }
}

/* 動畫關鍵幀定義 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

@keyframes glowBorder {
    0% { box-shadow: 0 0 5px var(--accent-color); }
    50% { box-shadow: 0 0 20px var(--accent-color); }
    100% { box-shadow: 0 0 5px var(--accent-color); }
}

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

/* 載入動畫 */
.content-grid {
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
    animation-delay: 0.3s;
}

/* 懸停效果 */
.monitor-item:hover .progress-ring {
    transform: scale(1.1);
}

/* 主題切換按鈕動畫 */
.theme-toggle:hover {
    transform: rotate(180deg);
}

/* 卡片容器 */
.monitor-panel, .recent-activities {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.monitor-panel:hover, .recent-activities:hover {
    box-shadow: 0 0 20px rgba(67, 97, 238, 0.3);
}

/* 載入動畫 */
.content-grid {
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
    animation-delay: 0.3s;
}

/* 懸停效果 */
.monitor-item:hover .progress-ring {
    transform: scale(1.1);
}

.stat-trend {
    position: relative;
    overflow: hidden;
}

.stat-trend::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.1),
        transparent
    );
    animation: shine 2s infinite;
}

/* 登入提示彈出視窗 */
.login-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.login-alert.show {
    opacity: 1;
    visibility: visible;
}

.alert-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--border-color);
}

.login-alert.show .alert-content {
    transform: translateY(0);
}

.alert-icon {
    font-size: 3rem;
    color: var(--warning-color);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.alert-message h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.alert-message p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.alert-button {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.alert-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.alert-button:active {
    transform: translateY(0);
}

/* 添加動畫效果 */
@keyframes slideIn {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-content {
    animation: slideIn 0.5s ease forwards;
}

/* 系統登出按鈕 */
.system-logout-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.indicator-dot {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
}

/* 登出模態框 */
.logout-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.logout-modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 15px;
    width: 70%;
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.modal-header i {
    font-size: 2rem;
    color: var(--accent-color);
}

/* 系統狀態 */
.system-status {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    animation: statusFadeIn 0.5s ease forwards;
    opacity: 0;
}

.status-item:nth-child(1) { animation-delay: 0.2s; }
.status-item:nth-child(2) { animation-delay: 0.4s; }
.status-item:nth-child(3) { animation-delay: 0.6s; }

.status-item i {
    color: var(--accent-color);
    animation: spin 2s linear infinite;
}

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

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

/* 進度條容器樣式更新 */
.progress-container {
    margin-top: 1.5rem;
    padding: 0.8rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    transition: width 3s linear;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent);
    animation: progressShine 1.5s linear infinite;
}

/* 移除舊的進度文字樣式 */
/* .progress-text {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
} */

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

/* 訪客專區樣式 */
.visitor-section {
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* 裝飾背景圖案 */
.visitor-section::before {
    content: '訪客';
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 120px;
    opacity: 0.03;
    font-weight: 900;
    transform: rotate(-15deg);
    color: var(--text-primary);
    pointer-events: none;
}

/* 功能卡片容器 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

/* 功能卡片樣式 */
.feature-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 卡片裝飾圖案 */
.feature-card::after {
    content: '\f007';  /* FontAwesome 用戶圖標 */
    font-family: 'Font Awesome 5 Free';
    position: absolute;
    bottom: -15px;
    right: -15px;
    font-size: 80px;
    opacity: 0.05;
    transform: rotate(15deg);
    color: var(--text-primary);
}

.feature-card:nth-child(2)::after {
    content: '\f075';  /* 評論圖標 */
}

.feature-card:nth-child(3)::after {
    content: '\f129';  /* 信息圖標 */
}

/* 卡片懸停效果 */
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.feature-card:hover::after {
    opacity: 0.08;
    transform: rotate(0deg) scale(1.1);
    transition: all 0.3s ease;
}

/* 功能標題 */
.feature-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.feature-title i {
    color: var(--accent-color);
    font-size: 1.4rem;
}

/* 功能列表 */
.feature-details ul {
    list-style: none;
    padding: 0;
}

.feature-details li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.feature-details li::before {
    content: '\f00c';  /* FontAwesome 勾選圖標 */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-size: 0.9rem;
}

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

.feature-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; } 