@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;800&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-grad: linear-gradient(135deg, #0062ff 0%, #00d4ff 100%);
    --admin-grad: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    --accent-grad: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --success-grad: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --bg-light: #f8fafc;
    --white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, .font-title { font-family: 'Montserrat', sans-serif; font-weight: 700; }

/* --- HEADER & HERO --- */
.main-header {
    background: var(--primary-grad);
    color: white;
    padding: 100px 20px;
    text-align: center;
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0% 100%);
    z-index: 1;
}

.main-header h1 { font-size: 2.5rem; margin-bottom: 15px; letter-spacing: -1px; }
.main-header p { font-size: 1.2rem; opacity: 0.9; font-weight: 300; }

/* --- SLIDER THÔNG BÁO --- */
.announcement-slider {
    max-width: 1100px;
    margin: -60px auto 40px;
    background: white;
    height: 400px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.slide-item {
    position: absolute;
    width: 100%; height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: 0.8s ease-in-out;
    background-size: cover;
    background-position: center;
}

.slide-item.active { opacity: 1; visibility: visible; }

.slide-content {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 60px 40px 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    color: white;
}

/* --- ADMIN PANEL LAYOUT --- */
.admin-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--admin-grad);
    padding: 40px 20px;
    color: white;
    position: sticky;
    top: 0; height: 100vh;
}

.admin-tab-btn {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 12px;
    border: none;
    background: rgba(255,255,255,0.05);
    color: #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex; align-items: center; gap: 12px;
}

.admin-tab-btn.active {
    background: var(--primary-grad);
    color: white;
    box-shadow: 0 4px 12px rgba(0,98,255,0.3);
}

.admin-main { padding: 40px; background: #f1f5f9; }

/* --- FORMS & INPUTS --- */
.form-card {
    background: white;
    padding: 35px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.input-group { margin-bottom: 25px; }
.input-group label { display: block; margin-bottom: 10px; font-weight: 700; color: var(--text-dark); font-size: 0.9rem; text-transform: uppercase; }
.input-group input, .input-group textarea, .input-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus { border-color: #0062ff; outline: none; box-shadow: 0 0 0 4px rgba(0,98,255,0.1); }
/* Tìm và thay thế đoạn .card-desc cũ trong style.css */
.card-desc { 
    font-size: 0.9rem; 
    color: #666; 
    white-space: pre-wrap;       /* Quan trọng: Giúp hiển thị các dấu xuống dòng khi bạn nhấn Enter */
    word-wrap: break-word; 
    margin-bottom: 10px;
    /* Nếu bạn muốn hiện toàn bộ nội dung, hãy xóa các dòng -webkit-line-clamp dưới đây */
    display: -webkit-box; 
    -webkit-line-clamp: 15;      /* Tăng số dòng hiển thị lên (ví dụ: 10 dòng) */
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}
/* Thêm vào style.css nếu muốn các ô mô tả đều nhau */
.card-body { 
    padding: 15px; 
    display: flex;
    flex-direction: column;
    min-height: 150px; /* Điều chỉnh con số này tùy theo ý bạn */
}
/* --- TABLES --- */
.admin-table {
    width: 100%; border-collapse: collapse;
    background: white; border-radius: 12px; overflow: hidden;
}

.admin-table th { background: #f8fafc; padding: 18px; text-align: left; font-size: 0.8rem; text-transform: uppercase; color: var(--text-gray); border-bottom: 2px solid #e2e8f0; }
.admin-table td { padding: 18px; border-bottom: 1px solid #f1f5f9; }

/* --- BUTTONS --- */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex; align-items: center; gap: 8px;
}

.btn-primary { background: var(--primary-grad); color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-success { background: var(--success-grad); color: white; }

/* --- FOOTER --- */
.footer {
    background: #0f172a;
    color: white;
    padding: 80px 20px 40px;
    text-align: center;
    margin-top: 100px;
}

.footer .designer-tag {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 25px;
    background: var(--primary-grad);
    border-radius: 50px;
    font-weight: 800;
    letter-spacing: 1px;
}

/* Modal View */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.9);
    display: none; z-index: 1000;
    justify-content: center; align-items: center;
    padding: 20px;
}

.modal-content {
    background: white; width: 100%; max-width: 900px;
    max-height: 90vh; border-radius: 20px; overflow-y: auto;
    position: relative; padding: 40px;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.6s ease forwards; }
/* Tối ưu hiển thị nội dung trộn lẫn */
#modal-body-content {
    white-space: pre-line; /* Tự động xuống dòng khi bạn nhấn Enter trong Admin */
    word-wrap: break-word;
}

#modal-body-content iframe {
    max-width: 100%; /* Đảm bảo video/file không bị tràn khỏi khung điện thoại */
    border-radius: 10px;
    margin: 15px 0;
    display: block;
}
/* Thống kê truy cập */
.visit-stats {
    margin-top: 30px;
    padding: 15px;
    text-align: center;
    background: #fff;
    border-radius: 8px;
    border: 1px dashed #ccc;
    color: #555;
    font-size: 0.9rem;
}

#visit-count {
    color: var(--primary);
    font-size: 1.1rem;
}
/* Thay thế đoạn .toolbar và input#search cũ */
.toolbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 20px; 
    flex-wrap: wrap; /* Giúp các thành phần tự xuống dòng trên mobile */
    gap: 10px; 
}

input#search { 
    padding: 10px; 
    flex: 1; /* Để thanh tìm kiếm chiếm hết không gian còn lại */
    min-width: 200px; /* Không để nó quá nhỏ trên mobile */
    border: 1px solid #ddd; 
    border-radius: 5px; 
    box-sizing: border-box;
}
/* Thay thế đoạn .grid cũ */
.grid { 
    display: grid; 
    /* Đổi 300px thành 1fr để nó linh hoạt hơn trên màn hình hẹp */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 20px; 
}

.container { 
    max-width: 1000px; 
    margin: 0 auto; 
    padding: 15px; /* Giảm padding một chút để tiết kiệm diện tích trên mobile */
}
/* --- PHẦN THÊM MỚI VÀO CUỐI FILE STYLE.CSS --- */

@media screen and (max-width: 600px) {
    /* Header thu nhỏ lại cho gọn */
    header { padding: 1.5rem 0.5rem; }
    h1 { font-size: 1.4rem; }
    
    /* Thanh công cụ xếp dọc trên điện thoại */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    input#search {
        max-width: 100%;
    }

    .admin-btn {
        text-align: center;
    }

    /* Các form đăng nhập/đăng bài rộng ra toàn màn hình */
    .login-form, .post-form {
        margin: 20px 10px;
        padding: 20px;
    }
}
/* 1. Thiết lập Header để chứa nút */
header {
    position: relative; /* Làm điểm tựa cho nút */
    background: var(--primary);
    color: white;
    padding: 3rem 1rem;
    text-align: center;
}

/* 2. Style mới cho nút Admin trong Header */
.admin-btn-header {
    position: absolute;
    top: 15px;
    right: 20px;
    text-decoration: none;
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.4);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: 0.3s;
}

.admin-btn-header:hover {
    background: white;
    color: var(--primary);
}

/* 3. Sửa lại Toolbar để thanh tìm kiếm rộng hết cỡ */
.toolbar {
    margin-top: -25px; /* Đẩy thanh tìm kiếm lên một chút cho đẹp */
    display: block; /* Chuyển về block để input chiếm 100% */
}

input#search {
    width: 100%;
    max-width: 100% !important; /* Ghi đè các giới hạn cũ */
    height: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 4. Xử lý hiển thị trên Điện thoại (Mobile) */
@media screen and (max-width: 600px) {
    .admin-btn-header {
        position: static; /* Bỏ chế độ nằm góc */
        display: inline-block;
        margin-top: 15px; /* Đẩy nút xuống dưới tiêu đề */
        background: rgba(0,0,0,0.1);
    }
    
    header {
        padding: 2rem 1rem;
    }
}
/* Suggest box cho tìm kiếm tên */
.suggest-box { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #ddd; border-top: none; z-index: 100; max-height: 200px; overflow-y: auto; display: none; box-shadow: var(--shadow-md); }
.suggest-item { padding: 10px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.suggest-item:hover { background: #f8fafc; color: #0062ff; } 

.history-box { padding: 10px; background: #f1f5f9; border-radius: 5px; font-size: 0.85rem; color: #475569; min-height: 40px; }

/* Bed Card */
.bed-card { background: white; padding: 25px; border-radius: 15px; text-align: center; box-shadow: var(--shadow-sm); border-top: 6px solid #e2e8f0; }
.bed-card.active { border-top-color: var(--accent-grad); }

/* THIẾT LẬP IN A3 */
/* THIẾT LẬP IN BÁO CÁO (Đã chuẩn hóa Font, Cỡ chữ 13.5 và NỀN TRẮNG tuyệt đối) */
@media print {
    img {
        max-width: 100% !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    /* Ép nền tắng cho toàn bộ trang giấy */
    html, body {
        background-color: #ffffff !important;
        background-image: none !important;
    }

    body * { visibility: hidden; }
    
    /* Cấu hình khu vực in */
    #print-section, #print-section * { 
        visibility: visible; 
        font-family: "Times New Roman", Times, serif !important; 
        color: black !important;
    }
    
    #print-section { 
        position: absolute; 
        left: 0; 
        top: 0; 
        width: 100%; 
        background-color: #ffffff !important; /* Xóa ám xám */
    }
    
    @page { size: A3 landscape; margin: 15mm; }
    
    /* Bảng dữ liệu */
    .print-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
    .print-table th, .print-table td { 
        border: 1px solid black; 
        padding: 10px 8px; 
        font-size: 13.5pt !important; 
        line-height: 1.5;
        background-color: #ffffff !important; /* Ép ô bảng màu trắng */
    }
    .print-table th { font-weight: bold; text-align: center; }
    
    /* Phần Header (Tiêu đề in) */
    .print-header { text-align: center; margin-bottom: 25px; }
    .print-header h1 { font-size: 20pt !important; margin-bottom: 5px; font-weight: bold; }
    .print-header p { font-size: 13.5pt !important; font-style: italic; margin: 0; }
    
    /* Lặp lại tiêu đề bảng nếu in sang trang 2 */
    .print-table thead { display: table-header-group; } 
    
    /* Chân trang */
    .print-footer { 
        position: fixed; bottom: 0; width: 100%; 
        text-align: right; 
        font-size: 12pt !important; 
        border-top: 1px solid #000; 
        padding-top: 5px; 
        font-style: italic; 
    }
}
/* Tối ưu Sidebar khi có nhiều nút */
.admin-sidebar {
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Cho phép cuộn nếu menu quá dài */
}

/* Đảm bảo icon có kích thước cố định để các chữ thẳng hàng */
.admin-tab-btn i {
    width: 20px;
    text-align: center;
}

/* Hiệu ứng khi di chuột qua các nút y tế */
.admin-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
__________
__________
/* --- GIAO DIỆN CHO MOBILE (Dưới 768px) --- */
@media (max-width: 767px) {
    .main-header {
        position: relative;
        padding: 40px 20px; /* Thu ngắn header lại */
        text-align: center;
        color: white;
          }
    /* Thu ngắn Slider trên mobile */
    .slider-container, .swiper-container {
        height: 200px !important; /* Điều chỉnh chiều cao slider ngắn lại */
    }
}
/* =========================================
   VTS HEALTH AI CHATBOT BUBBLE
   ========================================= */
.chat-bot-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-grad);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 10px 20px rgba(0, 98, 255, 0.4);
    cursor: pointer;
    z-index: 9999;
    border: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.chat-bot-btn:hover { transform: scale(1.1); }

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}
.chat-window.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.chat-header {
    background: var(--primary-grad);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-header h3 { font-size: 1.1rem; margin: 0; }
.chat-header p { font-size: 0.8rem; margin: 0; opacity: 0.8; }

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}
.chat-msg.bot {
    background: white;
    color: var(--text-dark);
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}
.chat-msg.user {
    background: #0062ff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}
.chat-footer input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    outline: none;
}
.chat-footer button {
    background: #10b981;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}
@media (max-width: 600px) {
    .chat-window {
        width: 90%;
        right: 5%;
        bottom: 90px;
        height: 450px;
    }
}
/* =========================================
   TRANG CHỦ - GLASSMORPHISM HEADER 
   ========================================= */

.glass-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 10px 25px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.5);
}

.header-left { display: flex; align-items: center; gap: 15px; }
.header-logo {
    width: 48px; height: 48px; border-radius: 12px; overflow: hidden; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); background: white;
}
.header-logo img { width: 100%; height: 100%; object-fit: cover; }

.header-titles { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.title-top { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.title-bottom { font-size: 1.15rem; font-weight: 900; color: #0062ff; letter-spacing: 4px; margin-left: 4px; line-height: 1; }

.header-right { display: flex; align-items: center; gap: 20px; }
.nav-links { display: flex; gap: 10px; align-items: center; }
.nav-links a { text-decoration: none; color: #475569; font-weight: 600; font-size: 0.9rem; padding: 8px 15px; border-radius: 10px; transition: 0.3s; }
.nav-links a:hover, .nav-links a.active { background: #f1f5f9; color: #0062ff; }
.nav-divider { width: 1px; height: 18px; background: #cbd5e1; }

.user-profile {
    display: none; align-items: center; gap: 10px; background: #f8fafc; 
    padding: 5px 15px 5px 5px; border-radius: 30px; border: 1px solid #e2e8f0;
}
.user-profile img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-name { font-size: 0.85rem; font-weight: 700; color: #1e293b; }

.announcement-slider { margin: 85px auto 40px !important; }
.page-has-header {
    padding-top: 85px; 
}
@media screen and (max-width: 900px) {
    .nav-links a i { margin-right: 0; }
    .nav-links a { font-size: 0.85rem; padding: 8px 10px; }
}
/* Responsive cho Điện thoại - Tối ưu chống rớt dòng */
/* =========================================
   RESPONSIVE CHO ĐIỆN THOẠI (< 768px)
   ========================================= */
@media screen and (max-width: 768px) {
    /* 1. Đẩy riêng trang chủ xuống vừa đủ với Header 2 dòng (Sửa body thành .page-has-header) */
    .page-has-header { padding-top: 105px; } 

    /* 2. Ép Header thành dạng Cột (2 dòng) */
    .glass-header { 
        flex-direction: column; 
        align-items: flex-start; 
        padding: 10px 15px; 
        gap: 12px; /* Khoảng cách giữa dòng trên và dòng dưới */
    }

    /* --- DÒNG 1: LOGO & TIÊU ĐỀ --- */
    .header-left { gap: 10px; }
    .header-logo { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; }
    
    .header-titles { align-items: flex-start; }
    .title-top { font-size: 0.6rem; letter-spacing: 0; white-space: nowrap; }
    .title-bottom { font-size: 0.95rem; letter-spacing: 1px; margin-left: 0; white-space: nowrap; }

    /* --- DÒNG 1 (GÓC PHẢI): USER PROFILE --- */
    /* Dùng absolute để ép nó nhảy lên ngang hàng với Logo */
    .user-profile { 
        position: absolute; 
        top: 12px; 
        right: 15px; 
        padding: 4px 10px 4px 4px;
        gap: 6px;
    }
    .user-profile img { width: 28px; height: 28px; }
    .user-name { 
        font-size: 0.75rem; 
        max-width: 70px; 
        overflow: hidden; 
        text-overflow: ellipsis; /* Hiện dấu ... nếu tên quá dài */
        white-space: nowrap; 
    }

    /* --- DÒNG 2: CÁC NÚT BẤM (MENU) --- */
    .header-right { 
        width: 100%; 
        gap: 0; 
    }
    
    .nav-links { 
        width: 100%;
        display: flex; 
        gap: 8px; 
        /* Bật tính năng vuốt ngang nếu màn hình quá nhỏ không chứa đủ 4 nút */
        overflow-x: auto; 
        padding-bottom: 5px; 
        scrollbar-width: none; /* Ẩn thanh cuộn Firefox */
    }
    .nav-links::-webkit-scrollbar { display: none; } /* Ẩn thanh cuộn Chrome/Safari */
    
    /* Giao diện các nút dạng viên thuốc (Pill) */
    .nav-links a { 
        display: flex; 
        align-items: center;
        gap: 5px;
        font-size: 0.8rem; 
        padding: 6px 14px; 
        white-space: nowrap; 
        background: #f1f5f9; /* Nền xám nhạt cho nút chưa chọn */
        border-radius: 20px;
    }
    .nav-links a.active {
        background: #e0e7ff; /* Nền xanh nhạt cho nút đang chọn */
        color: #0062ff;
        font-weight: 700;
    }
    
    .nav-divider { display: none; } /* Ẩn hoàn toàn vạch kẻ ||| */
/* Tùy chỉnh Slider trên Mobile: Cách Header 50px và Thu hẹp chiều cao */
    .announcement-slider {
        margin-top: 110px !important; 
        height: 220px !important; /* Ép chiều cao lùn xuống (tạo dáng banner nằm ngang) */
    }

    /* Vì khung Slider lùn đi, ta cần ép chữ và nút bên trong nhỏ lại cho cân đối */
    .slide-content {
        padding: 30px 20px 20px !important; /* Giảm khoảng trống bên trong */
    }
    .slide-content h2 {
        font-size: 1.3rem !important; /* Thu nhỏ tiêu đề thông báo */
        margin-bottom: 5px;
    }
    .slide-content .btn {
        padding: 6px 15px !important; /* Thu nhỏ nút "Xem chi tiết" */
        font-size: 0.8rem !important;
        margin-top: 8px !important;
    }
}
/* =========================================
   NÂNG CẤP: GIAO DIỆN TIN TỨC TRÊN MOBILE (Thu nhỏ thẻ bài viết)
   ========================================= */
@media screen and (max-width: 768px) {
    /* 1. Ép lưới hiển thị 2 cột thay vì 1 cột to tổ chảng trên điện thoại */
    #pinned-grid, #main-grid {
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 12px !important; /* Giảm khoảng cách giữa các thẻ */
    }

    /* 2. Thu nhỏ chiều cao ảnh bìa (giảm từ 200px xuống 120px) */
    .post-card img {
        height: 120px !important; 
    }

    /* 3. Thu nhỏ khoảng trống (padding) bên trong thẻ */
    .post-card > div {
        padding: 10px !important; 
    }

    /* 4. Thu nhỏ Tiêu đề bài viết */
    .post-card h3 {
        font-size: 0.9rem !important; 
        margin-bottom: 5px !important;
        line-height: 1.4;
        /* Tự động cắt thêm dấu ... nếu tiêu đề quá dài (giữ nguyên 2 dòng) */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* 5. Thu nhỏ Nội dung tóm tắt */
    .post-card p {
        font-size: 0.75rem !important; 
        margin-bottom: 10px !important;
        line-height: 1.4;
        /* Chỉ hiển thị tối đa 3 dòng tóm tắt để thẻ không bị dài thòng lòong */
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* 6. Thu nhỏ nút bấm "Xem chi tiết" */
    .post-card .btn {
        padding: 6px 5px !important;
        font-size: 0.75rem !important;
        border-radius: 8px !important;
    }
}
/* =========================================
   NÂNG CẤP: GIAO DIỆN THẺ BÀI VIẾT (ĐỒNG BỘ CHIỀU CAO TOÀN DIỆN)
   ========================================= */
/* 1. Ép thẻ hiển thị theo cột linh hoạt (Flexbox) */
.post-card {
    background: white; 
    border-radius: 15px; 
    overflow: hidden; 
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%; /* Ép thẻ kéo dài ra cho bằng với thẻ cao nhất trong hàng */
}

.post-card-img {
    width: 100%; 
    height: 200px; 
    object-fit: cover;
}

/* 2. Phần chứa chữ: Đẩy nội dung chiếm hết không gian trống */
.post-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Rất quan trọng: Bắt khu vực này co giãn lấp đầy khoảng trống */
}

/* 3. Tiêu đề: Thu nhỏ font chữ, ép khung cao đúng 2 dòng tăm tắp */
.post-card-title {
    font-size: 1.05rem; /* Đã thu nhỏ font chữ để chứa được nhiều chữ hơn */
    line-height: 1.4;
    height: 2.8em; /* THẦN CHÚ: Khung tiêu đề luôn cao ĐÚNG 2 dòng (1.4 x 2) */
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Nếu vượt quá 2 dòng sẽ tự động có dấu ... */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 4. Nội dung tóm tắt: Ép chuẩn 2 dòng */
.post-card-desc {
    color: var(--text-gray); 
    font-size: 0.85rem; /* Thu nhỏ chữ tóm tắt */
    line-height: 1.5;
    height: 3em; /* THẦN CHÚ: Khung tóm tắt luôn cao ĐÚNG 2 dòng (1.5 x 2) */
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Chặn ở mức 2 dòng và thêm ... */
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* 5. Nút "Xem chi tiết": Ép dính chặt xuống đáy khung */
.post-card-btn {
    margin-top: auto; /* Thần chú: Đẩy mọi thứ khác lên trên, ép nút xuống sát đáy */
    width: 100%; 
    justify-content: center; 
    text-decoration: none;
}

/* --- TÙY CHỈNH THU NHỎ CHO MÀN HÌNH ĐIỆN THOẠI --- */
@media screen and (max-width: 768px) {
    #pinned-grid, #main-grid {
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 12px !important;
    }
    
    .post-card-img { height: 120px; }
    .post-card-body { padding: 10px; }
    
/* Tùy chỉnh Tiêu đề trên Mobile */
    .post-card-title {
        font-size: 0.85rem !important; /* Ép font chữ thật nhỏ để vừa 2 dòng */
        line-height: 1.4 !important;
        height: 2.8em !important; /* Vẫn giữ khung chuẩn 2 dòng */
    }
    
    /* Tùy chỉnh Nội dung tóm tắt trên Mobile */
    .post-card-desc {
        font-size: 0.75rem !important;
        line-height: 1.4 !important;
        height: 2.8em !important; /* Khung tóm tắt chuẩn 2 dòng */
        margin-bottom: 12px !important;
    }
    .post-card-btn {
        padding: 6px 5px !important;
        font-size: 0.75rem !important;
        border-radius: 8px !important;
    }
}
/* ====== KHUNG DANH SÁCH BÀI TEST ====== */
#test-grid {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Khoảng cách giữa các bài test */
    width: 100%; /* Đảm bảo trải dài 100% */
}

/* ====== MỖI BÀI TEST LÀ 1 CARD NGANG ====== */
.test-row-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 25px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
    border-left: 5px solid var(--primary); /* Vạch màu xanh bên trái cho đẹp */
    transition: all 0.3s ease;
}

.test-row-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* KHU VỰC THÔNG TIN BÊN TRÁI */
.test-row-info {
    flex-grow: 1;
    padding-right: 30px;
}

.test-row-code {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.test-row-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    line-height: 1.4;
}

.test-row-meta {
    display: flex;
    gap: 25px;
    font-size: 0.95rem;
    color: #64748b;
}

.test-row-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 5px 12px;
    border-radius: 8px;
}

/* KHU VỰC NÚT BẤM BÊN PHẢI */
.test-row-action {
    flex-shrink: 0;
}

.test-row-action .btn {
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 10px;
}

/* RESPONSIVE CHO ĐIỆN THOẠI: Tự động xếp dọc lại nếu màn hình nhỏ */
@media (max-width: 768px) {
    .test-row-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 15px;
    }
    .test-row-meta {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    .test-row-action {
        width: 100%;
    }
    .test-row-action .btn {
        width: 100%;
        justify-content: center;
    }
}
/* HIỆU ỨNG TỰ ĐỘNG ĐỔI VIỀN & NỀN CHO TÙY CHỌN XUẤT FILE */
.export-format-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    background: #ffffff;
    font-weight: bold;
    color: #475569;
    transition: all 0.2s ease;
    user-select: none;
}

.export-format-option:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.export-format-option:has(input[type="radio"]:checked) {
    border-color: #2563eb !important;
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
/* =========================================================================
   DASHBOARD TIẾT KIỆM TÀI NGUYÊN & HIỆN ĐẠI
   ========================================================================= */
.db-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 25px;
}

.db-kpi-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    border-left: 5px solid #0284c7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.db-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.db-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.db-kpi-info {
    display: flex;
    flex-direction: column;
}

.db-kpi-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.db-kpi-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    margin: 2px 0;
    line-height: 1.2;
}

.db-kpi-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.db-ai-badge {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.db-symptom-bar-bg {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 6px;
}

.db-symptom-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0284c7, #38bdf8);
    border-radius: 10px;
    transition: width 0.6s ease;
}

@media (max-width: 900px) {
    #tab-dashboard > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}
.ai-epidemic-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e0f2fe;
    box-shadow: 0 10px 30px -10px rgba(2, 132, 199, 0.08), 0 2px 6px rgba(0, 0, 0, 0.02);
    padding: 28px;
    margin-bottom: 40px;
    position: relative;
    border-top: 5px solid #0284c7;
}

.ai-epidemic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.ai-epidemic-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
}

.ai-pill-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    padding: 6px 12px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}
.ai-pill-switch:hover {
    border-color: #0284c7;
    color: #0284c7;
}

.ai-history-row {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.ai-history-row:hover {
    border-color: #bae6fd;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(2, 132, 199, 0.07);
}

.ai-section-divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 35px 0 25px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.ai-section-divider::before, .ai-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
