/* static/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

nav {
    background: #333;
    color: white;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 1rem;
}

.nav-links a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Cập nhật flash-message để sử dụng các category */
.flash-message {
    padding: 12px 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid transparent;
}
.flash-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}
.flash-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}
.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}
.flash-info, .flash-default {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}


.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button, .btn {
    background: #007bff;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
}

button:hover, .btn:hover {
    background: #0056b3;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.active-pairings {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pairing-item {
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

.upload-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.device-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
}

.upload-form {
    margin-bottom: 2rem;
}

.api-info {
    background: #e9ecef;
    padding: 1.5rem;
    border-radius: 4px;
}

.api-info code {
    background: #343a40;
    color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    display: block;
    margin: 0.5rem 0;
    font-size: 0.9rem;
    overflow-x: auto;
}

.pairing-actions {
    margin-top: 0.5rem;
}

.pairing-actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.btn-success:hover {
    background: #218838;
}

/* Styles for device management */
.device-header, .pairing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.device-actions, .pairing-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}
.btn-disabled:hover {
    background: #6c757d;
}

.device-inactive, .pairing-inactive {
    opacity: 0.6;
    background: #f8f9fa;
}

.status-active {
    color: #28a745;
    font-weight: bold;
}

.status-inactive {
    color: #dc3545;
    font-weight: bold;
}

.device-info, .pairing-info {
    background: rgba(0,0,0,0.05);
    padding: 0.5rem;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #007bff;
}

/* --- ADMIN/USER Management Styles (Mới) --- */

.management-container {
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
    border-top: 1px solid #ddd;
}

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

/* Huy hiệu (Badge) cho vai trò Admin/User */
.badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap; 
}

.badge-admin {
    background-color: #ffc107; 
    color: #212529;
}

.badge-user {
    background-color: #17a2b8; 
    color: white;
}

/* Checkbox group trong form Admin */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}
.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 0;
}