﻿body {
    background: linear-gradient(135deg, #eef5ff, #f8fbff);
    min-height: 100vh;
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji';
    font-size: 1.125rem;
    color: var(--dark-color);
}

.top-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    padding: 15px 0;
}

.logo {
    width: 55px;
    height: 55px;
    object-fit: contain;
}

.hospital-name {
    color: #2391DB;
    font-weight: 600;
    line-height: 1.4;
}

.main-section {
    padding: 60px 0;
}

.search-card {
    background: #fff;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(13, 110, 253, .08);
}

.left-panel {
    background: linear-gradient(135deg, #2391DB, #4ea5ff);
    color: white;
    height: 100%;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

    .left-panel h2 {
        font-weight: 700;
        margin-bottom: 20px;
    }

    .left-panel p {
        opacity: .95;
        font-size: 17px;
        line-height: 1.8;
    }

.feature-item {
    margin-top: 20px;
    font-size: 15px;
}

    .feature-item i {
        width: 25px;
    }

.right-panel {
    padding: 50px;
}

.form-title {
    font-weight: 700;
    color: #2391DB;
    margin-bottom: 10px;
}

.form-subtitle {
    color: #6c757d;
    margin-bottom: 35px;
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
}

.required {
    color: red;
}

.form-control {
    height: 55px;
    border-radius: 12px;
    border: 1px solid #dce3ec;
}

    .form-control:focus {
        border-color: #2391DB;
        box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15);
    }

.btn-search {
    height: 55px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
}

.security-box {
    margin-top: 25px;
    background: #eef6ff;
    border-radius: 12px;
    padding: 15px;
    color: #2391DB;
    text-align: center;
}

.doctor-icon {
    font-size: 90px;
    margin-bottom: 25px;
    opacity: .95;
}

@media (max-width: 991px) {

    .left-panel,
    .right-panel {
        padding: 30px;
    }

    .left-panel {
        text-align: center;
    }
}

.card-header {
    padding: 18px 24px;
    font-weight: 600;
}

    .card-header h5 {
        font-size: 24px;
        font-weight: 700;
    }

.card-body {
    background: #fff;
}

#loadingPage {
    position: fixed;
    background: #DFEFEF;
    top: 0px;
    left: 0px;
    height: 100%;
    width: 100%;
    opacity: 0.8;
    z-index: 100;
    display: none;
}

    #loadingPage .loading {
        margin-top: 250px;
    }



.medical-card {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    border: none;
    box-shadow: 0 5px 25px rgba(0,0,0,.08);
}

.patient-header {
    background: linear-gradient(135deg, #2391DB, #0099ff);
    color: white;
    padding: 25px;
}

.patient-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-right: 20px;
}

.patient-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.patient-code {
    opacity: .9;
}

.patient-info {
    padding: 25px;
}

.info-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all .3s;
    border-left: 4px solid #2391DB;
}

    .info-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,.08);
    }

.info-label {
    color: #6c757d;
    font-size: 13px;
    margin-bottom: 4px;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
}

.badge-gender {
    background: #e7f1ff;
    color: #2391DB;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2391DB;
    margin-bottom: 20px;
}

.xn-header {
    padding: 15px 20px;
    cursor: pointer;
    padding: 15px;
    background: #f8fafc;
}

    .xn-header:hover {
        opacity: .95;
    }

.xn-title {
    font-size: 18px;
    font-weight: bold;
    color: #1e293b;
}

.xn-date {
    font-size: 13px;
    opacity: .9;
}

.xn-body {
    padding: 20px;
}

.xn-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

    .xn-info span {
        background: #f8f9fa;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 13px;
    }

.dv-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

    .dv-item:last-child {
        border-bottom: none;
    }

.dv-index {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #2391DB;
    color: white;
    text-align: center;
    line-height: 35px;
    margin-right: 15px;
    font-weight: bold;
}

.dv-name {
    flex: 1;
}

.badge-phieu {
    background: #e7f1ff;
    color: #2391DB;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
}

.collapse:not(.show) {
    display: none !important;
}

/* Khai báo bảng màu hệ thống - dễ dàng thay đổi theme toàn trang */
:root {
    --primary-color: #2391DB;
    --secondary-color: #0dcaf0;
    --dark-color: #212529;
    --light-bg: linear-gradient(135deg, #eef5ff, #f8fbff);
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --border-radius: 16px;
}

/* Thẻ kết quả xét nghiệm / dịch vụ kỹ thuật */
.xn-card {
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    background: #fff;
    transition: transform 0.2s ease;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #fff;
}

    .xn-card:hover {
        transform: translateY(-2px); /* Hiệu ứng nổi nhẹ khi rê chuột vào */
    }

.xn-header:hover {
    opacity: .95;
}


.xn-body {
    padding: 20px;
}

.xn-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

    .xn-info span {
        background: #f8w9fa;
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
    }

/* Tùy biến thanh Tab */
.medical-tabs {
    border-bottom: 2px solid #dee2e6;
}

    .medical-tabs .nav-item {
        margin-bottom: -2px; /* Đè lên border dưới để không bị sọc ngang ngắt quãng */
    }

    .medical-tabs .nav-link {
        color: #495057;
        font-weight: 500;
        border: 2px solid transparent;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
        padding: 12px 20px;
        transition: all 0.2s ease-in-out;
    }

        /* Hiệu ứng khi di chuột qua tab */
        .medical-tabs .nav-link:hover {
            color: #0b5ed7;
            background-color: #f8f9fa;
            border-color: #e9ecef #e9ecef #dee2e6;
        }

        /* Giao diện khi Tab đang được Active (Đang chọn) */
        .medical-tabs .nav-link.active {
            color: #2391DB !important; /* Màu xanh Medical */
            background-color: #ffffff;
            border-color: #dee2e6 #dee2e6 #ffffff !important;
            font-weight: 600;
            box-shadow: 0 -3px 0 #2391DB inset; /* Tạo một đường line nhấn dưới chân tab active */
        }

        /* Thêm icon khoảng cách */
        .medical-tabs .nav-link i {
            font-size: 1.1rem;
        }

/* Tùy biến khung chứa nội dung */
.medical-tab-content {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-radius: 0 0 8px 8px;
    min-height: 200px; /* Chiều cao tối thiểu tùy chọn */
}

.card-header {
    cursor: pointer;
}

#resultBox {
    margin-top: 20px;
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}
/* Container chính của Tab */
.medical-tabs-container {
    width: 100%;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Thanh điều hướng (Nav Tabs) */
.nav-tabs {
    display: flex;
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    list-style: none;
}

.nav-item {
    flex: 1;
}

.nav-link {
    display: block;
    width: 100%;
    padding: 16px 20px;
    text-align: center;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

    /* Hiệu ứng khi Hover */
    .nav-link:hover {
        color: #0284c7;
        background-color: #f1f5f9;
    }

    /* Trạng thái Tab đang hoạt động (Active) */
    .nav-link.active {
        color: #0284c7;
        background-color: #ffffff;
    }

        .nav-link.active::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 100%;
            height: 3px;
            background-color: #0284c7;
        }

/* Nội dung phía dưới Tab */
.tab-content {
    padding: 30px;
    min-height: 300px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

    .tab-panel.active {
        display: block;
    }

/* CSS bổ sung làm mẫu nội dung bên trong */
.demo-data {
    color: #334155;
    line-height: 1.6;
}

    .demo-data h3 {
        margin-bottom: 15px;
        color: #0f172a;
        border-left: 4px solid #0284c7;
        padding-left: 10px;
    }

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.info-item {
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* --- MODERN POPUP STYLES --- */
#PopupThongbao .modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modern-popup {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    padding: 24px !important;
    background: #fff !important;
    text-align: center;
    position: relative;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Nút tắt góc trên */
.close-modern {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s ease;
    outline: none !important;
}

    .close-modern:hover {
        color: #374151;
    }

/* Header & Icon wrapper */
.popup-header {
    margin-top: 8px;
    margin-bottom: 16px;
}

.popup-icon-box {
    width: 56px;
    height: 56px;
    background-color: #fef3c7; /* Mặc định màu vàng nhạt cảnh báo */
    color: #d97706; /* Màu icon vàng đậm */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    font-size: 24px;
}

.modal-title-modern {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    margin: 0 !important;
}

/* Body chứa text thông báo */
.popup-body {
    font-size: 14px !important;
    color: #4b5563 !important;
    line-height: 1.5;
    margin-bottom: 20px;
    word-break: break-word;
}

/* Footer & Button định dạng mới */
.popup-footer {
    display: flex;
    justify-content: center;
}

.btn-popup-confirm {
    background-color: #3b82f6 !important; /* Xanh tương tác hiện đại */
    color: #fff !important;
    border: none !important;
    padding: 8px 32px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
}

    .btn-popup-confirm:hover {
        background-color: #2563eb !important;
        box-shadow: 0 6px 12px -2px rgba(59, 130, 246, 0.4) !important;
        transform: translateY(-1px);
    }

/* --- Tự động đổi màu Icon theo trạng thái lỗi (Dành cho TH loại "3") --- */
/* Nếu JS của bạn thêm class alert-danger hoặc tương tự vào #body hoặc #containerTB, CSS dưới đây sẽ tự động đổi màu icon */
.alert-danger .popup-icon-box,
.modal-danger .popup-icon-box {
    background-color: #fee2e2 !important; /* Đỏ nhạt */
    color: #dc2626 !important; /* Đỏ đậm */
}

.alert-success .popup-icon-box,
.modal-success .popup-icon-box {
    background-color: #dcfce7 !important; /* Xanh nhạt */
    color: #16a34a !important; /* Xanh đậm */
}

/* Mặc định khi nội dung đang MỞ (Mũi tên hướng lên) */
#iconCollapse {
    transition: transform 0.3s ease; /* Tạo hiệu ứng xoay mượt mà 0.3 giây */
}

/* Khi BỊ ĐÓNG (Bootstrap tự động thêm class .collapsed vào card-header) */
.card-header.collapsed #iconCollapse {
    transform: rotate(180deg); /* Xoay ngược icon 180 độ thành hướng xuống */
}

/* =========================================================
   MEDICAL TABS - RESPONSIVE
   ========================================================= */

.medical-tabs-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Thanh cuộn ngang */
.medical-tabs-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

    /* Ẩn scrollbar trên mobile nhưng vẫn cho phép vuốt */
    .medical-tabs-scroll::-webkit-scrollbar {
        height: 4px;
    }

    .medical-tabs-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .medical-tabs-scroll::-webkit-scrollbar-thumb {
        background: #2391DB;
        border-radius: 10px;
    }

/* Danh sách tab */
.medical-nav-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: max-content;
    min-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

    /* Từng tab */
    .medical-nav-tabs .nav-item {
        flex: 0 0 auto !important;
        white-space: nowrap;
    }

    /* Nút tab */
    .medical-nav-tabs .nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        min-height: 48px;
        padding: 10px 16px;
        border: none;
        background: transparent;
        font-size: 14px;
        font-weight: 600;
        color: #555;
        transition: all 0.2s ease;
    }

        /* Hover */
        .medical-nav-tabs .nav-link:hover {
            color: #2391DB;
            background: rgba(35, 145, 219, 0.08);
        }

        /* Tab đang chọn */
        .medical-nav-tabs .nav-link.active {
            color: #2391DB;
            background: #fff;
            border-bottom: 3px solid #2391DB;
        }

    /* Badge */
    .medical-nav-tabs .badge {
        font-size: 11px;
        line-height: 1;
        padding: 4px 7px;
    }

/* Nội dung tab */
.medical-tabs-container .tab-content {
    width: 100%;
    overflow: hidden;
}

.medical-tabs-container .tab-panel {
    width: 100%;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    #divKetQuaTraCuu .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }

    .medical-tabs-container {
        border-radius: 10px;
    }

    /*
       Quan trọng:
       Không cho 5 tab xuống dòng.
       Người dùng vuốt ngang để xem tab Lịch sử khám.
    */
    .medical-tabs-scroll {
        overflow-x: auto;
        overflow-y: hidden;
        width: 100%;
        border-bottom: 1px solid #dee2e6;
    }

    .medical-nav-tabs {
        min-width: max-content !important;
        width: max-content !important;
    }

        .medical-nav-tabs .nav-link {
            min-height: 46px;
            padding: 9px 13px;
            font-size: 13px;
        }

        .medical-nav-tabs .badge {
            font-size: 10px;
            padding: 3px 6px;
        }

    /* Nội dung */
    .medical-tabs-container .tab-content {
        padding: 10px 0;
    }

    .medical-tabs-container .demo-data {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }

    /* Tiêu đề lịch sử */
    .history-header {
        display: block !important;
    }

        .history-header .xn-title {
            font-size: 16px;
        }

        .history-header .text-muted {
            font-size: 12px;
            line-height: 1.5;
        }
}


/* =========================================================
   ĐIỆN THOẠI NHỎ
   ========================================================= */

@media (max-width: 480px) {

    #divKetQuaTraCuu .container-fluid {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .medical-nav-tabs .nav-link {
        min-height: 44px;
        padding: 8px 11px;
        font-size: 12px;
    }

    .medical-nav-tabs .badge {
        font-size: 9px;
        padding: 3px 5px;
    }

    .history-header .xn-title {
        font-size: 15px;
    }
}