/* 主要問題和優化建議：
1. .dashboard-card 定義重複
2. .status-badge 定義重複
3. 媒體查詢分散
4. 一些顏色定義不一致



建議的修改結構： */

/* 基礎樣式 */

/* 平滑過渡效果 */
.table td,
.badge,
.wifi-info,
.wifi-info i,
.status-badge,
.font-weight-bold {
    transition: all 0.3s ease-in-out;
}

/* 數值變化時的過渡效果 */
.current-cell,
.power-cell,
.energy-cell {
    transition: color 0.3s ease-in-out;
}

/* 狀態變化的過渡效果 */
.status-badge {
    transition: background-color 0.3s ease-in-out,
                color 0.3s ease-in-out,
                box-shadow 0.3s ease-in-out;
}

/* WiFi 狀態變化的過渡效果 */
.wifi-info {
    transition: color 0.3s ease-in-out,
                background-color 0.3s ease-in-out;
}

/* 提高效能 */
.dashboard-card {
    backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
}

/* 減少重繪範圍 */
.table td {
    transform: translateZ(0);
    will-change: contents;
}


body {
    background-color: #121212;
    color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 導航欄樣式 */
.navbar {
    background-color: #1a1a1a !important;
    padding: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 頁首區域 */
.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.navbar-logo {
    height: 60px;
    width: auto;
    margin-bottom: 0.5rem;
}

h1 {
    color: #f8f9fa;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0.5rem 0;
    text-align: center;
}

.last-update {
    color: #adb5bd;
    font-size: 1rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* 布局容器 */
.row {
    margin-bottom: 1.5rem;
}

#monitoring-section {
    padding-bottom: 2rem;
}

/* 卡片樣式 */
.dashboard-card {
    background-color: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    margin-bottom: 0;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.card-header {
    background-color: #2d2d2d;
    border-bottom: 1px solid #343a40;
    color: #f8f9fa;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

/* WiFi 信息 */
.wifi-info {
    font-size: 0.85rem;
    color: #adb5bd;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wifi-info i {
    font-size: 1rem;
}

.wifi-strength-excellent i { color: #28a745 !important; }
.wifi-strength-good i { color: #17a2b8 !important; }
.wifi-strength-fair i { color: #ffc107 !important; }
.wifi-strength-poor i { color: #dc3545 !important; }

/* 表格樣式 */
.table-responsive {
    margin: 0;
}

.table {
    color: #f8f9fa;
    margin-bottom: 0;
}

/* 表頭樣式 */
.table thead.thead-light th {
    background-color: #1a1a1a !important;
    color: #f8f9fa !important;
    border-color: #f8f7f7 !important;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: middle;
    padding: 1rem;
}

/* 表格圖標 */
.table thead th i {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    display: block;
    transition: transform 0.2s ease;
}

.table thead th i.fas.fa-plug { color: #3b82f6 !important; }
.table thead th i.fas.fa-power-off { color: #10b981 !important; }
.table thead th i.fas.fa-bolt { color: #ffc107 !important; }
.table thead th i.fas.fa-fire { color: #f97316 !important; }
.table thead th i.fas.fa-battery-full { color: #06b6d4 !important; }
.table thead th i.fas.fa-clock { color: #8b5cf6 !important; }

.table thead th:hover i {
    transform: scale(1.1);
}

/* 表格內容 */
.table tbody tr {
    border-color: #343a40;
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #262626;
}

.table td {
    padding: 0.5rem;
    vertical-align: middle;
}

/* 狀態標籤 */
.status-badge {
    font-size: 0.9rem;
    padding: 0.5em 1em;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.badge-success {
    background-color: #059669;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    animation: pulse-success 2s infinite;
}

.badge-danger {
    background-color: #dc2626;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

/* 文字樣式 */
.device-name {
    font-weight: 500;
    color: #f8f9fa;
}

.datetime {
    color: #d1d5db;
    font-size: 0.9rem;
}

.font-weight-bold {
    font-family: 'Consolas', monospace;
}

/* 電力數據顏色 */
.text-danger { color: #dc3545 !important; }
.text-warning { color: #ffc107 !important; }
.text-success { color: #28a745 !important; }

/* 頁尾樣式 */
.footer {
    background-color: #1a1a1a;
    color: #adb5bd;
    padding: 1rem 0;
    margin-top: auto;
}

/* 載入動畫 */
.loading {
    position: relative;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2rem;
    height: 2rem;
    margin: -1rem 0 0 -1rem;
    border: 3px solid #2d2d2d;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 動畫 */
@keyframes pulse-success {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem 0;
    }

    .navbar-logo {
        height: 50px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .last-update {
        font-size: 0.9rem;
    }

    .row {
        margin-bottom: 1rem;
    }

    #monitoring-section {
        padding-bottom: 1rem;
    }

    .table thead th {
        font-size: 0.8rem;
    }

    .table td {
        font-size: 0.9rem;
    }

    .table th .fas {
        font-size: 1rem;
    }

    .status-badge {
        font-size: 0.8rem;
        padding: 0.4em 0.8em;
    }
}