/* 系統儀表板樣式 */

:root {
    --primary-color: #4B0082;
    --primary-light: #6A0DAD;
    --primary-dark: #380062;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #f44336;
    --text-dark: #333;
    --text-muted: #666;
    --border-color: #ddd;
    --shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 頁面標題與日期篩選器 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.date-filter {
    display: flex;
    align-items: center;
}

.date-filter label {
    margin-right: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.date-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
}

/* 數據卡片區域 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.stat-icon {
    margin-right: 1rem;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-dark);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.8rem;
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.stat-change.positive {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.stat-change.negative {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

/* 卡片顏色 */
.users .stat-icon {
    background-color: var(--primary-color);
}

.agents .stat-icon {
    background-color: var(--success-color);
}

.conversations .stat-icon {
    background-color: var(--warning-color);
}

.storage .stat-icon {
    background-color: var(--danger-color);
}

/* 圖表區域 */
.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-action-btn {
    background: none;
    border: none;
    font-size: 0.85rem;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.chart-action-btn:hover {
    background-color: rgba(75, 0, 130, 0.1); /* 使用rgba表示透明效果 */
    color: var(--primary-color);
}

.chart-action-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.chart-body {
    padding: 1.5rem;
    min-height: 250px;
}

/* 最近活動表格 */
.recent-activity {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
}

.view-all {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.9rem;
    cursor: pointer;
}

.table-container {
    overflow-x: auto;
}

.activity-table {
    width: 100%;
    border-collapse: collapse;
}

.activity-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.activity-table td {
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

.activity-table tbody tr:last-child td {
    border-bottom: none;
}

.activity-table tbody tr:hover {
    background-color: rgba(75, 0, 130, 0.1); /* 使用rgba表示透明效果 */
}

/* 用戶列和狀態標籤 */
.user-cell {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    margin-right: 0.8rem;
}

.user-avatar.small {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
}

.user-name {
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 1rem;
}

.status-badge.success {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.status-badge.warning {
    background-color: rgba(255, 152, 0, 0.1);
    color: var(--warning-color);
}

.status-badge.error {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

/* 模擬圖表 */
.chart-placeholder {
    width: 100%;
    height: 250px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.line-chart {
    width: 100%;
    height: 100%;
    position: relative;
}

.chart-line {
    position: absolute;
    left: 10%;
    bottom: 30%;
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, #4B0082 0%, #6A5ACD 50%, #9370DB 100%);
}

.chart-point {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, 50%);
}

.pie-chart {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(
        #4caf50 0% 35%,
        #2196f3 35% 60%,
        #ff9800 60% 80%,
        #9c27b0 80% 95%,
        #f44336 95% 100%
    );
    position: relative;
    margin: 0 auto 1rem;
}

.pie-slice {
    position: absolute;
    width: 100%;
    height: 100%;
    clip-path: conic-gradient(from calc(var(--percentage) * 3.6deg), transparent 0);
    background-color: var(--color);
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-left: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-dark);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 0.5rem;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .page-header,
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .chart-actions {
        margin-top: 0.5rem;
    }
    
    .view-all {
        margin-top: 0.5rem;
    }
}
