/* 裝置管�?設�?�?? */

.device-management {
    margin-bottom: 2rem;
}

.device-management .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e0e0;
}

.device-management .section-description {
    font-size: 0.9rem;
    color: #333;
    /* �?#666 ?�為深色以�?高可見度 */
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

/* ?��?裝置?��??� */
.current-device-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.current-device-section .form-group {
    margin-bottom: 0;
}

/* 裝置?�表?� */
.device-list-section {
    margin-bottom: 1.5rem;
}

.section-subheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-subheader h5 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.device-list {
    display: flex;
    gap: 1rem;
    /* grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); */
}

/* 裝置?��? */
.device-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.3s ease;
}

.device-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.device-card.selected {
    border-color: #28a745;
    background: #f0fff4;
}

.device-info {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.device-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #4db8a8 0%, #3a9d8f 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.device-details {
    flex: 1;
}

.device-details h6 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

.device-details p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
    color: #666;
}

.device-id {
    font-family: 'Courier New', monospace;
    color: #888;
}

.device-type {
    color: #007bff;
}

.device-desc {
    font-style: italic;
    color: #999;
}

/* 裝置?��??��? */
.device-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.device-actions .badge {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

.device-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* 空�???*/
.device-list .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.device-list .empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ddd;
}

.device-list .empty-state p {
    margin: 0.5rem 0;
}

/* 裝置測試?� */
.device-test-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.device-test-section h5 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #333;
}

.test-result {
    margin-top: 1rem;
}

/* 彈�?�?? */
.modal-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h5 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* 表單�?? */
.modal-body .form-group {
    margin-bottom: 1.25rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.modal-body .form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s ease;
}

.modal-body .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.modal-body .form-control[readonly] {
    background: #f5f5f5;
    color: #666;
}

.modal-body .form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #666;
}

/* ?�示訊息 */
.settings-alerts {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert .close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.alert .close:hover {
    opacity: 1;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

/* ?�畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ?��?�?? */
.btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4db8a8;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #00926b;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-outline-primary {
    background: transparent;
    color: #007bff;
    border: 1px solid #007bff;
}

.btn-outline-primary:hover:not(:disabled) {
    background: #007bff;
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-outline-danger:hover:not(:disabled) {
    background: #dc3545;
    color: white;
}

/* Badge �?? */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 3px;
}

.badge-success {
    background: #28a745;
    color: white;
}

/* ?��?式設�?*/
@media (max-width: 768px) {
    .device-list {
        grid-template-columns: 1fr;
    }

    .device-card {
        flex-direction: column;
    }

    .device-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #e0e0e0;
    }

    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }
}

/* �ƾڦ����]�w�� */
.data-collection-settings {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.data-collection-settings h5 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.data-collection-settings .form-group {
    margin-bottom: 1.25rem;
}

.data-collection-settings .form-group:last-of-type {
    margin-bottom: 1.5rem;
}

.data-collection-settings label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
}

.data-collection-settings .form-control {
    width: 100%;
    max-width: 300px;
}

.data-collection-settings .form-text {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #666;
}

.data-collection-settings .btn {
    margin-top: 0.5rem;
}

/* �˸m�ҥ�/���Τ������s */
.toggle-device-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.toggle-device-btn.active {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.toggle-device-btn.inactive {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* ���Ϊ��˸m�d�� */
.device-card.device-disabled {
    opacity: 0.6;
    background: #f5f5f5;
}

.device-card.device-disabled .device-icon {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}