/* ==========================================
   1. CÀI ĐẶT CHUNG
   ========================================== */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
}

/* ==========================================
   2. HEADER & LAYOUT CHÍNH
   ========================================== */
.main-header {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    padding: 15px 24px;
    background-color: #ffffff;
    position: sticky;
    top: 0;
    box-shadow: 0px 4px 6px -4px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 50px;
}

.logo-header a {
    font-weight: bold;
    font-size: 22px;
    color: #1a4b77;
}

/* --- MENU DESKTOP --- */
.desktop-nav {
    display: flex;
    gap: 40px; 
    align-items: center;
}

.nav-item {
    position: relative; 
    padding: 10px 0;
}

.nav-item > a {
    color: #333;
    font-weight: bold;
    position: relative;
    padding-bottom: 5px; 
}

/* Hiệu ứng gạch đỏ dưới chân */
.nav-item > a::after {
    content: '';
    position: absolute;
    width: 0; 
    height: 2px; 
    bottom: 0;
    left: 0;
    background-color: red; 
    transition: width 0.3s ease; 
}

.nav-item:hover > a::after {
    width: 100%;
}

/* --- DROPDOWN TỈNH THÀNH --- */
.dropdown-tinhthanh {
    display: none; 
    position: absolute;
    top: 100%; 
    left: 0;
    background: white;
    min-width: 220px;
    max-height: 400px; 
    overflow-y: auto;  
    box-shadow: 0px 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    border-radius: 6px;
    z-index: 1000;
}

.nav-dia-chi:hover .dropdown-tinhthanh {
    display: flex;
    flex-direction: column;
}

.dropdown-tinhthanh a {
    display: block; 
    padding: 12px 15px;
    color: #333;
    border-bottom: 1px solid #f9f9f9;
    font-size: 14px;
}

.dropdown-tinhthanh a:hover {
    background-color: #f1f3f4;
    color: red; 
}

#inputTimTinh {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-bottom: 1px solid #ddd;
    outline: none;
    font-size: 14px;
    position: sticky; 
    top: 0;
    background: #fff; 
    z-index: 10;
}

#inputTimTinh:focus {
    background: #fdfdfd;
}

/* ==========================================
   3. MENU BÊN PHẢI (USER, THÔNG BÁO, AUTH)
   ========================================== */
#user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Nút Đăng nhập / Đăng ký */
.btn-auth {
    color: #1a4b77;
    font-weight: bold;
    padding: 10px 16px; 
    border-radius: 8px; 
    transition: background-color 0.2s ease; 
}
.btn-auth:hover {
    background-color: #f1f3f4; 
}

/* Chuông & Trái tim */
.btn-bell-header, .btn-heart-header {
    background: none;
    border: none;
    font-size: 24px; 
    cursor: pointer;
    position: relative;
    color: #555;
    transition: transform 0.2s ease;
}

.btn-bell-header:hover, .btn-heart-header:hover {
    transform: scale(1.1); 
}

.badge-thong-bao, .badge-tin-luu {
    position: absolute;
    top: -5px;      
    right: -8px;   
    background-color: #e91e63; 
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 5px;
    min-width: 18px; 
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Popup dùng chung cho Thông báo & Tin đã lưu */
.popup-thong-bao, .popup-tin-luu {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #eee;
}

.popup-header {
    text-align: center;
    font-weight: bold;
    font-size: 15px;
    padding: 12px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.popup-body {
    max-height: 300px;
    overflow-y: auto;
}

.popup-footer {
    text-align: center;
    padding: 12px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

.xem-tat-ca {
    color: #1a4b77;
    font-weight: bold;
    font-size: 13px;
}

/* Item Tin đã lưu */
.item-tin-luu {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    color: black;
}
.item-tin-luu img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
}
.item-tin-luu-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.item-tin-luu-title {
    font-size: 14px;
    font-weight: bold;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item-tin-luu-time {
    font-size: 13px;
    color: #666;
}

/* Item Thông báo */
.thong-bao-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    color: #333;
}
.thong-bao-item.chuadoc {
    background-color: #eef5ff;
}
.tungloaithongbao {
    padding: 10px; 
    color: #666; 
    font-size: 14px; 
    text-align: center;
}

/* Avatar Menu */
.avt-chu-cai {
    width: 38px;
    height: 38px;
    background-color: #1a4b77;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
}

.avt-dropdown {
    position: absolute;
    top: 65px;
    right: 20px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0px 4px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.avt-dropdown a, .avt-dropdown button {
    font-size: 14px;
    padding: 12px 15px;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #f9f9f9;
    cursor: pointer;
    color: #333;
    width: 100%;
}
.avt-dropdown a:hover, .avt-dropdown button:hover {
    background-color: #f1f3f4;
    color: #1a4b77;
}
#btnDangXuat {
    color: #e74c3c !important;
}

/* ==========================================
   4. GIAO DIỆN FORM MODAL (ĐĂNG TIN, ĐẶT LỊCH)
   ========================================== */
.modal { 
    display: none; 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: #ffffff; 
    padding: 25px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 100vw rgba(0,0,0,0.5); 
    zoom: 1; 
    z-index: 9999; 
    border-radius: 12px; 
    width: 90%; 
    max-width: 550px; 
    max-height: 85vh; 
    overflow-y: auto; 
}

.modal h2 {
    font-size: 22px;
    color: #1a4b77;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #f1f2f6;
    padding-bottom: 12px;
}

.modal label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    margin-top: 12px;
    font-size: 14px;
    color: #444;
}

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="datetime-local"],
.modal select { 
    width: 100%; 
    padding: 10px 12px; 
    margin-bottom: 5px; 
    border: 1px solid #cccccc; 
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.modal input:focus, .modal select:focus, .modal textarea:focus {
    border-color: #1a4b77;
    box-shadow: 0 0 5px rgba(26, 75, 119, 0.2);
}

.modal input[type="file"] {
    margin-top: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.btn-guiyeucau, button[onclick="xacNhanDangTin()"] { 
    background: #27ae60; 
    color: white; 
    padding: 12px; 
    width: 100%; 
    border: none; 
    border-radius: 6px; 
    font-weight: bold;
    font-size: 15px;
    margin-top: 15px; 
    cursor: pointer;
    transition: background 0.2s;
}
.btn-guiyeucau:hover, button[onclick="xacNhanDangTin()"]:hover { background: #218c4f; }

.btn-huy, .btn-dong, button[onclick="dongFormDangTin()"] { 
    background: #e74c3c; 
    color: white; 
    padding: 12px; 
    width: 100%; 
    border: none; 
    border-radius: 6px; 
    font-weight: bold;
    font-size: 15px;
    margin-top: 10px; 
    cursor: pointer;
    transition: background 0.2s;
}
.btn-huy:hover, .btn-dong:hover, button[onclick="dongFormDangTin()"]:hover { background: #c0392b; }

#danhSachLichHen, #danhSachLichDaDat {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 10px;
    border: 1px solid #eee;
}

/* Thanh cuộn cho Modal */
.modal::-webkit-scrollbar, 
#danhSachLichHen::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-thumb, 
#danhSachLichHen::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }


/* ==========================================
   5. RESPONSIVE CHO MOBILE (Dưới 768px)
   ========================================== */
.mobile-menu-btn { display: none; } 
.mobile-sidebar { display: none; overflow-x: hidden; } 

@media (max-width: 768px) {
    .desktop-nav { display: none; }
    
    .header-left { gap: 15px; }

    .mobile-menu-btn {
        display: block; 
        font-size: 30px;
        cursor: pointer;
        color: #333;
    }
    
    .mobile-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5); 
        z-index: 9998;
    }

    .mobile-sidebar {
        position: fixed;
        top: 0;
        left: -100%; 
        width: 85%;
        max-width: 350px;
        height: 100vh;
        background: white;
        z-index: 9999;
        transition: left 0.3s ease-in-out; 
        display: flex;
        flex-direction: column;
        box-shadow: 2px 0px 8px rgba(0,0,0,0.2);
    }

    .mobile-sidebar.open { left: 0; }

    .sidebar-close {
        position: absolute;
        top: 15px;
        right: 20px;
        font-size: 30px;
        color: #999;
        cursor: pointer;
        z-index: 10;
        line-height: 1;
    }

    .mobile-view {
        position: absolute; 
        top: 0; left: 0; width: 100%; height: 100%;
        padding-top: 60px; 
        overflow-y: auto;  
        display: flex; flex-direction: column;
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
        opacity: 0; visibility: hidden; pointer-events: none; 
    }
    
    #mobileMenuMain { transform: translateX(-30px); }
    #mobileMenuProvinces { transform: translateX(30px); }

    .mobile-view.active-view {
        opacity: 1; visibility: visible; pointer-events: auto;
        transform: translateX(0) !important;
        display: flex; 
    }

    .mobile-nav-item {
        display: flex; justify-content: space-between; align-items: center;
        padding: 16px 20px; font-size: 16px; font-weight: bold;
        color: #333; border-bottom: 1px solid #f0f0f0; cursor: pointer;
    }
    .mobile-nav-item:hover { background-color: #f9f9f9; }

    .mobile-nav-back {
        display: flex; align-items: center; padding: 16px 20px;
        font-size: 18px; font-weight: bold; color: #333;
        border-bottom: 1px solid #ddd; cursor: pointer;
    }

    .mobile-provinces-list a {
        display: block; padding: 14px 20px; color: #555;
        border-bottom: 1px solid #f5f5f5; font-size: 15px;
    }
    .mobile-provinces-list a:hover { background-color: #f1f3f4; color: #000; }

    .slogan-mobile {
        padding: 20px; font-size: 13px; color: #666;
        line-height: 1.5; margin-top: 10px;
    }
}