/*
 * style.css
 */

/* ====================================================================== */
/* 1. THIẾT LẬP CHUNG VÀ BIẾN CSS */
/* ====================================================================== */

:root {
    --color-primary: #3498db;
    --color-success: #2ecc71;
    --color-danger: #e74c3c;
    --color-warning: #f39c12;
    --color-info: #34495e;
    --color-secondary: #95a5a6;

    --color-background-body: #f4f7f6;
    --color-background-sidebar: #2c3e50;
    --color-background-card: #ffffff;
    --color-text-dark: #2c3e50;
    --color-text-light: #ecf0f1;
    --color-text-item: #b6cf95;
    --color-border: #ecf0f1;

    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Đã chỉnh sửa: Áp dụng trực tiếp lên body */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-background-body);
    color: var(--color-text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Lớp tiện ích */
.mt-20 { margin-top: 20px; }


/* ====================================================================== */
/* 2. CẤU TRÚC LAYOUT TỔNG THỂ (Admin Panel & Flexbox) */
/* ====================================================================== */

#adminPanelContent {
    display: none;
    flex-grow: 1;
    display: flex !important;
    width: 100%;
    min-height: 100%;
}

.admin-layout {
    display: flex;
    flex-grow: 1;
    min-height: 100vh;
}

/* MAIN CONTENT - Cấu trúc bên trong Layout */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--color-background-body);
}

/* CONTENT AREA - Khu vực chứa Tab Contents */
.content-area {
    padding: 30px;
    flex-grow: 1;
}

/* TAB CONTENTS */
.tabcontent {
    display: none;
    animation: fadeIn 0.5s;
}

.tabcontent.active {
    display: block;
}

.content-area h2 {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
}

.content-area h2 i {
    margin-right: 10px;
    color: var(--color-primary);
}


/* ====================================================================== */
/* 3. SIDEBAR (THANH ĐIỀU HƯỚNG) */
/* ====================================================================== */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-background-sidebar);
    color: var(--color-text-light);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 20px;
    font-size: 1.5em;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex-grow: 1;
    padding-top: 10px;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

/* BỔ SUNG: Class cho mục phân cách nhóm */
.sidebar-nav-item.separator {
    color: var(--color-text-item);
    font-size: 0.8em;
    font-weight: 700;
    padding: 10px 20px 5px 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 15px;
    cursor: default;
}
.sidebar-nav-item.separator:hover {
    background-color: transparent;
}


.sidebar-nav-item a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--color-text-light);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav-item a:hover {
    background-color: #34495e;
}

.sidebar-nav-item .nav-link.active {
    background-color: var(--color-primary);
    color: white;
    font-weight: 500;
}

.sidebar-nav-item a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    font-size: 0.8em;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--color-secondary);
}

/* ====================================================================== */
/* 4. HEADER VÀ THÔNG BÁO */
/* ====================================================================== */

.header {
    background-color: var(--color-background-card);
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.9em;
}

/* CẤU TRÚC THÔNG BÁO (NOTIFICATION) */
.notification-list-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 15px;
}

.notification-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background-color 0.2s;
    align-items: flex-start;
}

.notification-item:hover {
    background-color: #f9f9f9;
}

.notification-item.unread {
    background-color: #ecf0f1;
    border-left: 4px solid var(--color-primary);
}

.notification-icon {
    font-size: 1.5em;
    margin-right: 15px;
}

.notification-details {
    flex-grow: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--color-text-dark);
}

.notification-body {
    font-size: 0.9em;
    color: var(--color-secondary);
    margin-bottom: 5px;
}

.notification-time {
    font-size: 0.75em;
    color: #bdc3c7;
}


/* ====================================================================== */
/* 5. CARDS VÀ CẤU TRÚC LƯỚI */
/* ====================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background-color: var(--color-background-card);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); /* Giữ bóng đổ nhẹ */
    transition: transform 0.2s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.full-width {
    grid-column: 1 / -1;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h4 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* Stat Cards (Thống kê Dashboard) */
.stat-card {
    text-align: center;
    padding: 20px;
    position: relative;
    border-left: 5px solid;
}

.stat-card.primary { border-color: var(--color-primary); }
.stat-card.info { border-color: var(--color-info); }
.stat-card.warning { border-color: var(--color-warning); }
.stat-card.success { border-color: var(--color-success); }

.stat-card h3 {
    font-size: 1em;
    color: var(--color-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--color-text-dark);
}


/* ====================================================================== */
/* 6. FORM VÀ CONTROLS (Input, Select, Button) */
/* ====================================================================== */

.form-group {
    margin-bottom: 15px;
    display: block;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    min-height: 40px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

textarea.form-control { resize: vertical; }

.form-text-muted {
    font-size: 0.8em;
    color: var(--color-secondary);
    display: block;
    margin-top: 5px;
}

/* Input Group (Input với Text kèm theo) */
.form-group.input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.form-group.input-group label {
    flex-basis: 100%;
}

.form-group.input-group .form-control {
    flex-grow: 1;
    width: auto;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    min-height: 40px;
}

.input-group-text {
    background-color: #ecf0f1;
    color: var(--color-secondary);
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-left: none;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 0.9em;
    white-space: nowrap;
    margin-top: 0;
    min-height: 40px;
}

.action-list button { margin-bottom: 10px; }
.action-bar { margin-bottom: 15px; }
.form-actions { margin-top: 20px; text-align: right; }
.form-actions button { margin-left: 10px; }

/* BỔ SUNG: CSS cho Toggle Switch (cho DHCP Enable) */
.form-group.switch-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.form-group.switch-group input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Switch container */
.form-group.switch-group .switch-label {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 25px;
}

/* Slider */
.form-group.switch-group .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 25px;
}

.form-group.switch-group .slider:before {
    position: absolute;
    content: "";
    height: 19px;
    width: 19px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

/* Checked state */
.form-group.switch-group input:checked + .slider {
    background-color: var(--color-success);
}

.form-group.switch-group input:checked + .slider:before {
    transform: translateX(25px);
}


/* BUTTONS (Nút) */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn i { margin-right: 5px; }

/* Colors */
.btn-primary { background-color: var(--color-primary); color: white; }
.btn-primary:hover { background-color: #2980b9; }

.btn-success { background-color: var(--color-success); color: white; }
.btn-success:hover { background-color: #27ae60; }

.btn-danger { background-color: var(--color-danger); color: white; }
.btn-danger:hover { background-color: #c0392b; }

.btn-warning { background-color: var(--color-warning); color: var(--color-text-dark); }
.btn-warning:hover { background-color: #f1c40f; }

.btn-info { background-color: var(--color-info); color: white; }
.btn-info:hover { background-color: #2c3e50; }

.btn-secondary { background-color: var(--color-secondary); color: white; }
.btn-secondary:hover { background-color: #7f8c8d; }

.btn-sm { padding: 5px 10px; font-size: 0.85em; }

/* CSS Cần thiết cho các nút Switch Bật/Tắt */
.switch-setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.switch-setting-group label:first-child {
    font-weight: bold;
    flex-grow: 1;
}
.switch-setting-group p {
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
    grid-column: 1 / span 2; /* Để mô tả nằm dưới cả label và switch */
}

/* Base Switch CSS (Giả định bạn đã có, nếu không thì cần thêm vào) */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #28a745; /* Màu xanh lá cây */
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}


/* ====================================================================== */
/* 7. TABLES VÀ BADGES */
/* ====================================================================== */

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    background-color: #f8f9fa;
    color: var(--color-text-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
}

.data-table tbody tr:hover {
    background-color: #f1f1f1;
}

.data-table td button {
    margin-right: 5px;
    white-space: nowrap;
}

/* BỔ SUNG: Đảm bảo cột hành động không bị vỡ dòng và chiếm ít không gian hơn */
.data-table td.actions-cell {
    white-space: nowrap; 
    width: 1%; 
}

td:nth-child(6) {
    text-transform: capitalize;
}

/* BADGES (Trạng thái) */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    color: white;
}

.bg-success { background-color: var(--color-success); }
.bg-danger { background-color: var(--color-danger); }
.bg-warning { background-color: var(--color-warning); color: var(--color-text-dark); }
.bg-primary { background-color: var(--color-primary); }
.bg-info { background-color: var(--color-info); }
.bg-secondary { background-color: var(--color-secondary); }



/* ====================================================================== */
/* 1. KHU VỰC CHUYỂN ĐỔI CHẾ ĐỘ IP */
/* ====================================================================== */

.ip-mode-switch-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f0f8ff; /* Light blue background */
    border: 1px solid #cceeff;
    border-radius: 4px;
}

.ip-mode-switch-group label {
    font-weight: 600;
    color: #0056b3;
    margin-right: 15px;
    white-space: nowrap; /* Ngăn label bị xuống dòng */
}

/* Định dạng Switch chung */
.switch-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ====================================================================== */
/* 2. CẤU TRÚC IP CHUNKED INPUTS (4 Ô TÁCH cho IPv4) */
/* IPv4 luôn hiển thị */
/* ====================================================================== */

.ipv4-input-container {
    display: flex;
    width: 100%;
}

.ip-address-input-group {
    display: flex;
    align-items: center;
    gap: 0px; 
    width: 100%;
}

/* Định dạng chung cho 4 ô IP */
.ip-address-input-group .ip-octet {
    text-align: center;
    width: 25%;
    flex-grow: 1;
    border-radius: 0; 
    border-left: none; /* Loại bỏ border giữa các input */
    padding-left: 5px;
    padding-right: 5px;
}

/* Bo góc cho ô đầu tiên */
.ip-address-input-group .ip-octet:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-left: 1px solid var(--border-color, #ced4da); /* Thêm lại border cho ô đầu tiên */
}

/* Bo góc cho ô cuối cùng */
.ip-address-input-group .ip-octet:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Định dạng dấu chấm phân cách */
.ip-address-input-group .dot {
    font-size: 1.2em;
    font-weight: bold;
    color: #495057; 
    line-height: 38px;
    padding: 0 2px;
}


/* ====================================================================== */
/* 3. CẤU TRÚC IPv6 INPUT (SỬ DỤNG MAX-HEIGHT ĐỂ HIỆN/ẨN MƯỢT MÀ) */
/* ====================================================================== */

/* ẨN CONTAINER IPv6 MẶC ĐỊNH */
.ipv6-input-container {
    /* Thay thế display: none bằng max-height và opacity */
    opacity: 0;
    max-height: 0; 
    padding-top: 0;
    margin-top: 0;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    pointer-events: none; /* Không thể tương tác khi ẩn */
}

/* HIỂN THỊ CONTAINER IPv6 KHI CÓ CLASS ACTIVE (Khi switch được bật) */
.ipv6-input-container.active {
    opacity: 1;
    max-height: 100px; /* Giá trị đủ lớn để input hiện ra */
    padding-top: 10px; /* Thêm khoảng cách với IPv4 phía trên */
    margin-top: 10px; /* Thêm khoảng cách với label IPv6 trong HTML */
    overflow: visible;
    pointer-events: auto; /* Có thể tương tác khi hiện */
}

/* Định dạng cho ô nhập IPv6 (lớn hơn, font chữ đơn cách) */
.ipv6-input-container .form-control {
    font-family: 'Consolas', 'Courier New', monospace; /* Font chữ đơn cách cho IP */
    font-size: 0.95em;
    height: 38px; /* Đồng bộ chiều cao */
}

/* ====================================================================== */
/* 4. CẤU TRÚC CHUNG CHO DHCP RANGE */
/* ====================================================================== */

.dhcp-range-group {
    display: flex;
    align-items: stretch;
}

.dhcp-range-group .form-control:first-child {
    border-radius: 4px 0 0 4px;
}

.dhcp-range-group .form-control:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.dhcp-range-group .input-group-text {
    background-color: #f1f1f1;
    border: 1px solid #ced4da;
    border-radius: 0;
    font-weight: bold;
    color: #495057;
    padding: 0 10px;
    display: flex;
    align-items: center;
}


/* ====================================================================== */
/* 8. MODALS (CỬA SỔ POP-UP) */
/* ====================================================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Khi modal bị ẩn, loại bỏ thuộc tính flex để tránh lỗi hiển thị */
.modal:not([style*="display: flex"]) {
    display: none;
}

.modal-content {
    background-color: var(--color-background-card);
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); /* Bóng đổ mạnh hơn cho modal */
    animation: slideDown 0.3s ease-out;
}

.modal-actions {
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close-button:hover,
.close-button:focus {
    color: var(--color-danger);
    text-decoration: none;
    cursor: pointer;
}

/* Tùy chỉnh body khi modal mở (từ code JS) */
.modal-open {
    overflow: hidden;
}

/* ======================== */
/* CÁC MODAL ĐẶC BIỆT - ĐÃ TỐI ƯU HÓA MOBILE */
/* ======================== */

#loginModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* CHUẨN HÓA ĐƯỜNG DẪN HÌNH ẢNH: Sử dụng đường dẫn tuyệt đối /images/ */
    /* Giả định file 1035.png nằm trong wwwroot/images/ */
    background-image: url('./images/1035.png'); 
    
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    display: flex;
    justify-content: center;
    align-items: center; /* Căn giữa dọc và ngang */
    z-index: 1000;
    padding: 20px; /* Thêm padding chung để nội dung không bị dính sát mép */
    margin: 0;
    background-color: rgba(0, 0, 0, 0.5);
    
    /* Đảm bảo nội dung cuộn nếu tràn màn hình (Mobile fix) */
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
}

#loginModal .modal-content {
    background-color: #fff;
    padding: 30px; /* Tăng padding để nội dung không quá sát mép */
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.0001s ease-out; /* Giữ animation */
    
    /* Đảm bảo container không bị quá rộng và chiếm tỷ lệ tốt */
    max-width: 400px;
    width: 100%; /* Đảm bảo chiếm toàn bộ chiều rộng có sẵn */
    
    /* Thêm khoảng margin trên/dưới khi nội dung cuộn (quan trọng trên mobile) */
    margin: 20px 0; 
    z-index: 1001;
}

/* --- MEDIA QUERY CHO THIẾT BỊ NHỎ HƠN 480px --- */
@media (max-width: 480px) {
    #loginModal {
        /* Giảm padding tổng thể trên thiết bị rất nhỏ */
        padding: 10px; 
    }

    #loginModal .modal-content {
        /* Giảm padding bên trong nội dung */
        padding: 20px; 
        /* Nếu muốn làm cho nó "toàn màn hình" hơn trên mobile */
        /* width: 95%; */
        /* margin: 0; */
    }
}


/* ====================================================================== */
/* 9. ANIMATIONS */
/* ====================================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}


/* ====================================================================== */
/* 10. MEDIA QUERIES (RESPONSIVE DESIGN) */
/* ====================================================================== */

@media (max-width: 992px) {
    .sidebar {
        width: 60px;
    }

    /* Đã ẩn separator khi sidebar thu nhỏ */
    .sidebar-brand, .sidebar-footer, .sidebar-nav-item.separator {
        display: none;
    }

    .sidebar-nav-item span {
        display: none;
    }

    .sidebar-nav-item a {
        justify-content: center;
        padding: 15px 0;
    }

    .sidebar-nav-item a i {
        margin-right: 0;
    }

    .header-user-info span {
        display: none;
    }
}

@media (max-width: 576px) {
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        top: auto;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        padding-top: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-nav ul {
        display: flex;
        padding: 0 10px;
        flex-shrink: 0;
    }

    .sidebar-nav-item a {
        padding: 10px 15px;
        flex-direction: column;
        font-size: 0.8em;
    }

    .sidebar-nav-item span {
        display: block;
        font-size: 0.7em;
        margin-top: 5px;
    }
    
    .sidebar-nav-item.separator { /* Đảm bảo vẫn ẩn trên mobile */
        display: none;
    }

    .main-content {
        width: 100%;
    }

    .header {
        padding: 10px 15px;
    }

    .content-area {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    #loginModal {
        position: fixed; /* Cần thiết để phủ toàn màn hình */
        top: 0;
        left: 0;
        
        background-image: url(./images/1035.png);
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        
        /* QUAN TRỌNG: Ngăn cuộn ngang và cho phép cuộn dọc */
        overflow-x: hidden; /* Ngăn cuộn ngang */
        overflow-y: hidden;   /* Cho phép cuộn dọc nếu nội dung form lớn hơn màn hình */
        
        /* Đảm bảo căn giữa nội dung form bên trong */
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }
}

/* ========================================= */
/* CSS Cho Card Server Management */
/* ========================================= */

/* Đảm bảo bố cục 2, 3 cột hoạt động tốt */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.form-row > .form-group {
    padding-right: 10px;
    padding-left: 10px;
}

/* Định nghĩa lại col-md-4 và col-md-6 nếu không dùng Bootstrap */
.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}
.col-md-4 {
    flex: 0 0 33.33333%;
    max-width: 33.33333%;
}

/* Tiêu đề nhỏ trong card body */
.card-body h5 {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
    color: #34495e;
}

/* Trạng thái */
.status-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap; /* Ngăn xuống dòng */
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}
.status-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* Nút thao tác trong bảng */
.view-btn {
    background-color: #3498db; /* Blue */
    border-color: #3498db;
    color: white;
}
.terminate-btn {
    background-color: #e74c3c; /* Red */
    border-color: #e74c3c;
    color: white;
}

/* Media Query cho di động */
@media (max-width: 768px) {
    .form-row > .form-group {
        flex: 0 0 100%;
        max-width: 100%;
        padding-right: 0;
        padding-left: 0;
    }
}