﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    min-height: 100vh;
    color: #333;
}

.navbar {
    background: rgba(255,255,255,0.95);
    padding: 1.5rem 2rem;
    margin: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    text-decoration: none;
    flex: 1;
}

.navbar-status {
    color: #64748b;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sound-control-btn {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid #667eea;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
}

    .sound-control-btn:hover {
        transform: scale(1.1);
        background: rgba(102, 126, 234, 0.2);
    }

    .sound-control-btn.muted {
        background: rgba(255, 0, 0, 0.1);
        border-color: #dc2626;
        color: #dc2626;
    }

        .sound-control-btn.muted:hover {
            background: rgba(255, 0, 0, 0.2);
        }

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 2rem;
}

    .navbar-nav a {
        color: #64748b;
        text-decoration: none;
        padding: 0.5rem 1rem;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }

        .navbar-nav a:hover, .navbar-nav a.active {
            background-color: #f1f5f9;
            color: #2c3e50;
        }

.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1000;
}

.connected {
    background: #10b981;
    color: white;
}

.disconnected {
    background: #ef4444;
    color: white;
}

.main {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 2rem;
}

.alert {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: white;
    border-left: 4px solid #ef4444;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 300px;
    margin-top: 60px;
}

    .alert.show {
        transform: translateX(0);
    }

.alert-title {
    font-weight: 600;
    color: #ef4444;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.85rem;
    color: #6b7280;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

    .stat-card:hover {
        transform: translateY(-3px);
    }

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #64748b;
    font-size: 0.9rem;
}

.fault {
    color: #ef4444;
}

.repair {
    color: #f59e0b;
}

.pending {
    color: #8b5cf6;
}

.normal {
    color: #10b981;
}

.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.card-header {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 1.5rem;
}

.fault-table {
    width: 100%;
    border-collapse: collapse;
}

    .fault-table th, .fault-table td {
        padding: 0.75rem;
        text-align: left;
        border-bottom: 1px solid #f1f5f9;
    }

    .fault-table th {
        background: #f8fafc;
        font-size: 0.8rem;
        color: #6b7280;
        text-transform: uppercase;
    }

    .fault-table tr:hover {
        background: #f9fafb;
    }

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-fault {
    background: #fef2f2;
    color: #dc2626;
}

.status-repair {
    background: #fefbf2;
    color: #d97706;
}

.status-pending {
    background: #faf5ff;
    color: #7c3aed;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

    .btn-primary:hover {
        background: #2563eb;
    }

.btn-danger {
    background: #ef4444;
    color: white;
}

    .btn-danger:hover {
        background: #dc2626;
    }

@media (max-width: 768px) {
    .main {
        padding: 0 1rem;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .navbar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .navbar-status {
        font-size: 0.8rem;
    }

    .navbar-nav {
        gap: 1rem;
    }
}

.test-controls {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

    .test-controls h3 {
        margin-bottom: 1rem;
        color: #2c3e50;
    }

    .test-controls .btn {
        position: relative;
        padding-left: 2.5rem;
    }

        .test-controls .btn::before {
            content: '';
            position: absolute;
            left: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            width: 12px;
            height: 12px;
            border-radius: 2px;
        }

    .test-controls .btn-primary::before {
        background-color: rgba(59, 130, 246, 0.3);
    }

    .test-controls .btn-danger::before {
        background-color: rgba(239, 68, 68, 0.3);
    }

    .test-controls .btn-success::before {
        background-color: rgba(34, 197, 94, 0.3);
    }

/* ===== 自定義 Modal 視窗樣式 ===== */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease;
}

    .custom-modal.show {
        display: flex;
        align-items: center;
        justify-content: center;
    }

.modal-container {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: translateY(-20px);
    animation: modalSlideIn 0.3s ease forwards;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

    .modal-close:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }

.modal-body {
    padding: 0;
    max-height: calc(85vh - 140px);
    overflow-y: auto;
}

.modal-content {
    padding: 2rem;
}

.modal-loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

    .modal-loading .spinner {
        display: inline-block;
        width: 40px;
        height: 40px;
        border: 4px solid #e5e7eb;
        border-top: 4px solid #667eea;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 1rem;
    }

/* Modal 內的表格樣式 */
.modal-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

    .modal-table th,
    .modal-table td {
        padding: 12px 16px;
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
    }

    .modal-table th {
        background: #f9fafb;
        font-weight: 600;
        color: #374151;
        position: sticky;
        top: 0;
    }

    .modal-table tr:hover {
        background: #f8fafc;
    }

.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-card {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

/* 狀態標籤 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-fault {
    background: #fef2f2;
    color: #dc2626;
}

.status-repair {
    background: #fef3c7;
    color: #d97706;
}

.status-pending {
    background: #eff6ff;
    color: #2563eb;
}

.status-offline {
    background: #f3f4f6;
    color: #6b7280;
}

/* 動畫效果 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 90vh;
        margin: 1rem;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-info-grid {
        grid-template-columns: 1fr;
    }

    .modal-table th,
    .modal-table td {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
}

/* 統計區塊點擊效果增強 */
.stat-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    }

    .stat-card:active {
        transform: translateY(-2px);
    }


/* 操作按鈕樣式 */
.btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 1px;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

    .btn-warning:hover {
        background-color: #d97706;
        transform: translateY(-1px);
    }

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

    .btn-primary:hover {
        background-color: #2563eb;
        transform: translateY(-1px);
    }

.btn-success {
    background-color: #10b981;
    color: white;
}

    .btn-success:hover {
        background-color: #059669;
        transform: translateY(-1px);
    }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}