/* styles.css */
/* ==================== 1. 全域變數與重設 ==================== */
:root {
    --bg-dark: #090d16;
    --card-bg: rgba(17, 25, 40, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --glass-glow: rgba(59, 130, 246, 0.15);
    
    --neon-blue: #3b82f6;
    --neon-green: #10b981;
    --neon-yellow: #f59e0b;
    --neon-red: #ef4444;
    
    --text-main: #f3f4f6;
    --text-dim: #9ca3af;
    --text-dark: #1f2937;
    
    --font-primary: 'Outfit', 'Noto Sans TC', sans-serif;
    --sidebar-width: 250px;
    --transition-fast: 0.25s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    font-family: var(--font-primary);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* 炫光背景 */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.2;
}

.orb-1 {
    top: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background-color: var(--neon-blue);
    animation: pulse 12s infinite alternate;
}

.orb-2 {
    bottom: -10%;
    left: -10%;
    width: 35vw;
    height: 35vw;
    background-color: var(--neon-green);
    animation: pulse 10s infinite alternate-reverse;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.15; }
    100% { transform: scale(1.2); opacity: 0.25; }
}

/* ==================== 2. 頂部狀態列 ==================== */
.top-bar {
    height: 60px;
    background: rgba(10, 15, 30, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.top-bar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.top-bar .logo i {
    color: var(--neon-blue);
    font-size: 20px;
}

.top-bar .logo small {
    font-size: 11px;
    color: var(--neon-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: 20px;
    margin-left: 8px;
}

.pulse-icon {
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    30% { transform: scale(1.1); }
    60% { transform: scale(1); }
}

.status-indicators {
    display: flex;
    gap: 15px;
}

.indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

#firebaseStatusBtn {
    cursor: pointer;
    transition: var(--transition-fast);
}

#firebaseStatusBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.status-dot.connected  { background-color: var(--neon-green);  box-shadow: 0 0 8px var(--neon-green); }
.status-dot.disconnected { background-color: var(--neon-red);  box-shadow: 0 0 8px var(--neon-red); }
.status-dot.online  { background-color: var(--neon-green);  box-shadow: 0 0 8px var(--neon-green); }
.status-dot.offline { background-color: var(--neon-red);    box-shadow: 0 0 8px var(--neon-red); }
.status-dot.cloud   { background-color: #f59e0b;            box-shadow: 0 0 8px #f59e0b; animation: cloudPulse 2s infinite; }

/* ==================== 3. 主要布局與側邊欄 ==================== */
.app-layout {
    display: flex;
    padding-top: 60px;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 15, 30, 0.4);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--card-border);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    z-index: 90;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition-fast);
}

.nav-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--neon-blue);
    font-weight: 600;
}

.nav-footer {
    margin-top: auto;
}

.config-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-dim);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-weight: 500;
    transition: var(--transition-fast);
}

.config-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* ==================== 4. 主內容區域與卡片 ==================== */
.content-area {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    width: calc(100% - var(--sidebar-width));
    box-sizing: border-box;
    margin-bottom: 60px; /* 為手機端底部導覽列預留 */
}

@media (min-width: 769px) {
    .content-area {
        margin-bottom: 0;
    }
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    margin-bottom: 24px;
}

.glass-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.station-badge {
    font-size: 11px;
    color: var(--neon-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
    font-weight: normal;
}

/* ==================== 5. 儀表板設計 ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
    .chart-card {
        grid-column: 1 / -1;  /* 趨勢圖橫跨兩欄，填滿整行 */
    }
}

.gauge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gauge-card h3 {
    align-self: flex-start;
}

.gauge-container {
    margin: 20px 0;
    position: relative;
    width: 240px;
    height: 240px;
}

.gauge-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 180deg, #10b981 0deg, #f59e0b 160deg, #ef4444 260deg, #ef4444 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px; /* 外環寬度 */
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
    transition: box-shadow 0.5s ease;
}

/* 溫度狀態顏色樣式 */
.gauge-ring.normal {
    background: conic-gradient(from 180deg, #10b981 0deg, #10b981 360deg);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}
.gauge-ring.warning {
    background: conic-gradient(from 180deg, #f59e0b 0deg, #f59e0b 360deg);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.25);
}
.gauge-ring.danger {
    background: conic-gradient(from 180deg, #ef4444 0deg, #ef4444 360deg);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.4);
    animation: redPulse 2s infinite alternate;
}

@keyframes redPulse {
    0% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }
    100% { box-shadow: 0 0 40px rgba(239, 68, 68, 0.6); }
}

.gauge-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid var(--card-border);
}

.gauge-inner .temp-val {
    font-size: 58px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-main);
    letter-spacing: -1px;
}

.gauge-inner .temp-unit {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dim);
    margin-top: 2px;
}

.gauge-inner .temp-status {
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.gauge-inner .temp-status.normal { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.gauge-inner .temp-status.warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.gauge-inner .temp-status.danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.obs-time-text {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 概況資訊卡 */
.status-card .info-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 24px;
}

.info-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.info-item label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.info-item .val {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
}

.heartbeat-detail {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.hb-icon-container {
    width: 50px;
    height: 50px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--neon-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.hb-icon-container.online {
    color: var(--neon-green);
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.hb-icon-container.offline {
    color: var(--neon-red);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.hb-icon-container.cloud {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    animation: cloudPulse 2s infinite;
}

#hbPulseIcon.pulsing {
    animation: heartPulse 1.2s infinite;
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    15% { transform: scale(1.25); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
    60% { transform: scale(1); }
}

.hb-info h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.hb-info p {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.hb-info .badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.hb-info .badge.online  { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.hb-info .badge.offline { background-color: rgba(239, 68, 68, 0.2);   color: #f87171; }
.hb-info .badge.cloud   { background-color: rgba(245, 158, 11, 0.2);  color: #fbbf24; font-weight: 700; }

@keyframes cloudPulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.5; }
    100% { opacity: 1; }
}

.fast-tools h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-dim);
}

.fast-tools h4 small {
    font-weight: normal;
}

.btn-group {
    display: flex;
    gap: 12px;
}

.tool-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ==================== 6. 表單與設定 ==================== */
.hmi-form {
    max-width: 600px;
}

.auth-section {
    background: rgba(239, 68, 68, 0.08);
    border: 1px dashed rgba(239, 68, 68, 0.3);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.auth-notice {
    font-size: 14px;
    margin-bottom: 15px;
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-input-group {
    display: flex;
    gap: 10px;
}

.auth-input-group input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 14px;
}

.auth-input-group input:focus {
    border-color: var(--neon-blue);
    outline: none;
}

.settings-content.locked {
    opacity: 0.3;
    pointer-events: none;
    user-select: none;
    filter: blur(2px);
}

.form-group {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
}

.form-group label .range-val {
    color: var(--neon-blue);
    font-size: 18px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.hmi-form select, .hmi-form input[type="password"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 14px;
    outline: none;
}

.hmi-form select:focus, .hmi-form input:focus {
    border-color: var(--neon-blue);
}

/* 滑桿樣式 */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--neon-blue);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* 按鈕樣式 */
.btn-primary {
    background: var(--neon-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-primary);
    font-size: 14px;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.btn-primary.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-primary);
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-save {
    background: var(--neon-green);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-primary);
    font-size: 14px;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-save:hover {
    background: #059669;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin: 0;
}

/* ==================== 7. 表格設計 ==================== */
.table-scroll-container {
    width: 100%;
    overflow-x: auto;
}

.hmi-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 750px;
    text-align: left;
}

.hmi-table th {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 2px solid var(--card-border);
    padding: 14px 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dim);
}

.hmi-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    font-size: 14px;
    vertical-align: middle;
}

.hmi-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

.badge-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.hmi-table .badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
}

.hmi-table .badge.normal  { background: rgba(100, 116, 139, 0.18); color: #94a3b8; }
.hmi-table .badge.success { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.hmi-table .badge.warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.hmi-table .badge.danger  { background: rgba(239, 68, 68, 0.2);   color: #f87171; }

.header-actions {
    display: flex;
    gap: 12px;
}

.header-actions input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-family: var(--font-primary);
    font-size: 13px;
}

.header-actions input:focus {
    border-color: var(--neon-blue);
    outline: none;
}

/* ==================== 8. 側滑抽屜與 Modal 彈窗 ==================== */
/* 側滑抽屜 Drawer */
.config-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: rgba(10, 15, 30, 0.9);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--card-border);
    z-index: 200;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
}

.config-drawer.open {
    right: 0;
}

.config-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 190;
    display: none;
}

.config-drawer-overlay.open {
    display: block;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 14px;
}

.drawer-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-drawer-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
}

.drawer-tip {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 20px;
}

.config-drawer textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    color: white;
    width: 100%;
    height: 250px;
    padding: 12px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    resize: none;
    outline: none;
}

.config-drawer textarea:focus {
    border-color: var(--neon-blue);
}

/* Modal 彈窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.glass-modal {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(24px);
    width: 90%;
    max-width: 450px;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    transform: translateY(-20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .glass-modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
}

.modal-overlay input[type="text"], .modal-overlay input[type="email"] {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
    color: white;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-family: var(--font-primary);
    outline: none;
}

.modal-overlay input:focus {
    border-color: var(--neon-blue);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.form-group.flex-row {
    flex-direction: row;
    align-items: center;
}

/* ==================== 9. 手機端適配與底部導覽 ==================== */
/* 底部導覽列 (預設隱藏，手機端顯示) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--card-border);
    z-index: 100;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .content-area {
        margin-left: 0;
        padding: 16px;
        width: 100%;
    }
    
    .top-bar {
        padding: 0 12px;
        height: 50px;
    }
    
    .top-bar .logo {
        font-size: 15px;
        gap: 6px;
    }
    
    .top-bar .logo small {
        display: none;
    }
    
    .status-indicators {
        gap: 8px;
    }
    
    .indicator {
        padding: 4px 8px;
        font-size: 11px;
        gap: 4px;
    }
    
    .app-layout {
        padding-top: 50px;
    }
    
    .glass-card {
        padding: 16px;
    }
    
    .auth-input-group {
        flex-direction: column;
    }
    
    .auth-input-group button {
        width: 100%;
    }
    
    .glass-modal {
        padding: 16px;
        width: 95%;
    }
    
    .config-drawer {
        width: 100%;
        max-width: 320px;
    }
    
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    .bottom-nav .nav-item {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
        padding: 8px;
        margin-bottom: 0;
        flex: 1;
        border-radius: 0;
        background: none !important;
        border: none !important;
    }
    
    .bottom-nav .nav-item i {
        font-size: 20px;
    }
    
    .bottom-nav .nav-item.active {
        color: var(--neon-blue);
    }
    
    .bottom-nav .nav-item span {
        display: block;
    }
}

/* ==================== 10. Toast 通知 ==================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
}

@media (max-width: 768px) {
    .toast-container {
        bottom: 80px; /* 手機端上移以防被底部導覽列遮擋 */
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid var(--neon-blue);
}

.toast.success { border-left-color: var(--neon-green); }
.toast.error { border-left-color: var(--neon-red); }

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* 一些 UI 開關 Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--card-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--neon-blue);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* ==================== 10. 溫度變化趨勢圖 (Chart) ==================== */
.chart-card {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chart-modes {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 4px;
    border-radius: 8px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.mode-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    color: var(--text-main);
    background: var(--neon-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* 歷史篩選列 */
.chart-filter-row {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    padding: 15px;
    border-radius: 10px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
}

.filter-group input[type="date"] {
    background: rgba(10, 15, 30, 0.6);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-fast);
}

.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.filter-group input[type="date"]:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.btn-query {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: var(--text-main);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 35px;
    transition: var(--transition-fast);
}

.btn-query:hover {
    background: var(--neon-blue);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.chart-loader {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--neon-blue);
    height: 35px;
    font-weight: 600;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

@media (max-width: 900px) {
    .chart-container {
        height: 260px;
    }
    .chart-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group {
        width: 100%;
    }
    .btn-query {
        width: 100%;
        justify-content: center;
    }
}
