/**
 * MODERN MEDICAL DESIGN SYSTEM 2026
 * Bệnh viện Đa khoa huyện Bảo Yên
 * Thiết kế chuẩn UI/UX y tế cao cấp, giữ trọn bản sắc thương hiệu
 */

:root {
    --primary: #006837;
    --primary-light: #018b4a;
    --primary-dark: #004d28;
    --primary-subtle: #e6f4ea;
    --secondary: #0284c7;
    --accent: #dc2626;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -3px rgba(0, 104, 55, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 16px 30px -4px rgba(0, 104, 55, 0.14), 0 6px 10px -4px rgba(0, 0, 0, 0.05);
    --transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================
   1. RESET & NỀN TRANG TỔNG THỂ
   ========================================================== */
body {
    background-color: var(--bg-page) !important;
    color: var(--text-primary);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.wrapper {
    background-color: var(--bg-page);
    min-height: 100vh;
}

/* ==========================================================
   2. HEADER & THANH TÌM KIẾM CAO CẤP
   ========================================================== */
.header-main {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid var(--border-color);
}

.header-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-logo-left a img {
    height: 75px;
    width: auto;
    object-fit: contain;
    transition: var(--transition);
}

.header-logo-left a img:hover {
    transform: scale(1.03);
}

/* ==========================================================
   THANH TÌM KIẾM HEADER: MÀN HÌNH LỚN CHỈ HIỆN ICON KÍNH LÚP,
   KHI ẤN MỚI HIỆN INPUT TRƯỢT RA MƯỢT MÀ
   ========================================================== */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. Màn hình lớn (Desktop >= 993px): Mặc định chỉ hiện icon kính lúp, ấn vào mới trượt mở ô input */
@media (min-width: 993px) {
    .header-search {
        justify-content: flex-end;
        width: 44px;
        min-width: 44px;
        height: 44px;
        border-radius: 24px;
        background: transparent;
        border: 1.5px solid transparent;
        margin: 0 10px;
        overflow: hidden;
        flex: 0 0 auto;
    }

    .header-search input {
        width: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        padding: 0 !important;
        border: none !important;
        outline: none !important;
        background: transparent !important;
        pointer-events: none !important;
        font-size: 14px;
        color: var(--text-primary);
        box-shadow: none !important;
        transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, padding 0.3s ease !important;
    }

    .header-search i {
        position: absolute;
        right: 0;
        top: 0;
        transform: none !important;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 17px;
        color: #006837;
        background: #f0fdf4;
        border: 1.5px solid #86efac;
        border-radius: 50%;
        cursor: pointer;
        pointer-events: auto !important;
        z-index: 3;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 6px rgba(0, 104, 55, 0.1);
    }

    .header-search i:hover {
        background: #006837;
        color: #ffffff;
        border-color: #006837;
        transform: scale(1.08) !important;
        box-shadow: 0 4px 12px rgba(0, 104, 55, 0.25);
    }

    /* Trạng thái mở rộng khi người dùng click vào icon */
    .header-search.active {
        width: 320px;
        background: #ffffff !important;
        border: 1.5px solid #006837 !important;
        box-shadow: 0 4px 16px rgba(0, 104, 55, 0.16) !important;
        border-radius: 25px;
    }

    .header-search.active input {
        width: 100% !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 10px 48px 10px 18px !important;
        pointer-events: auto !important;
    }

    .header-search.active i {
        background: #006837;
        color: #ffffff;
        border-color: #006837;
    }
}

/* 2. Màn hình nhỏ (Mobile & Tablet <= 992px): Hiển thị thanh tìm kiếm tiện dụng */
@media (max-width: 992px) {
    .header-search {
        width: 100%;
        max-width: 100%;
        margin: 10px 0;
        background: #f8fafc;
        border: 1.5px solid var(--border-color);
        border-radius: var(--radius-full);
    }

    .header-search input {
        width: 100%;
        padding: 11px 44px 11px 18px;
        border: none;
        outline: none;
        background: transparent;
        font-size: 14px;
        color: var(--text-primary);
    }

    .header-search i {
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--primary);
        font-size: 16px;
        cursor: pointer;
        pointer-events: auto;
    }
}

/* Icon liên hệ & Hotline dạng Pill Badges */
.logo-icon-right {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.logo-icon-right li {
    font-size: 12.5px;
    font-weight: 600;
}

.logo-icon-right li a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: #f1f5f9;
    color: var(--text-secondary) !important;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid transparent;
}

.logo-icon-right li a:hover {
    background: var(--primary-subtle);
    color: var(--primary) !important;
    border-color: rgba(0, 104, 55, 0.2);
    transform: translateY(-1px);
}

.logo-icon-right li a i {
    color: var(--primary);
}

/* Riêng mục cấp cứu nổi bật */
.logo-icon-right li:has(.fa-truck-medical) a,
.logo-icon-right li:nth-child(2) a {
    background: #fee2e2;
    color: #b91c1c !important;
}

.logo-icon-right li:has(.fa-truck-medical) a i,
.logo-icon-right li:nth-child(2) a i {
    color: #dc2626;
}

.logo-icon-right li:has(.fa-truck-medical) a:hover,
.logo-icon-right li:nth-child(2) a:hover {
    background: #fecaca;
    border-color: #f87171;
}

/* ==========================================================
   3. NAVIGATION BAR (THANH MENU CHÍNH)
   ========================================================== */
.header-bottom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 4px 12px rgba(0, 104, 55, 0.15);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header_navbar {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 10px;
    position: relative;
}

.toggle-button {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.header-title h3 {
    margin: 0;
    padding: 8px 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ==========================================================
   DROPDOWN MENU: DANH MỤC BỆNH VIỆN (.header_navbar-list)
   ========================================================== */
.header_navbar-list {
    position: absolute;
    top: 100%;
    left: 10px;
    min-width: 290px;
    background-color: #ffffff !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.16), 0 6px 16px -2px rgba(0, 0, 0, 0.08);
    list-style: none;
    padding: 10px 8px !important;
    margin: 6px 0 0 0 !important;
    z-index: 10000 !important;
    display: none;
    flex-direction: column;
}

.header_navbar-itm {
    margin: 0 !important;
    padding: 2px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 14.5px !important;
}

.header_navbar-itm:last-child {
    border-bottom: none !important;
}

.header_navbar-itm a {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 11px 16px !important;
    color: #1e293b !important;       /* MÀU CHỮ ĐẬM RÕ NÉT TRÊN NỀN TRẮNG */
    text-decoration: none !important;
    font-size: 14.5px !important;
    font-weight: 600 !important;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.header_navbar-itm a:hover {
    background-color: #e6f4ea !important; /* Nền xanh nhạt chuẩn y tế khi hover */
    color: #006837 !important;            /* Chữ xanh đậm nổi bật */
    transform: translateX(4px);
}

.header_navbar-itm a i {
    font-size: 16px !important;
    width: 22px;
    text-align: center;
    color: #006837 !important;            /* Icon màu xanh thương hiệu */
    transition: transform 0.2s ease;
    opacity: 1 !important;
}

.header_navbar-itm a:hover i {
    transform: scale(1.18);
    color: #004d28 !important;
}

/* ==========================================================
   4. HERO SLIDER & BANNER CHÍNH
   ========================================================== */
.first-item {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 20px;
    margin: 24px auto;
    max-width: 1240px;
    padding: 0 15px;
}

.slider-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

.slider-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.slider-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.prev, .next {
    background: rgba(15, 23, 42, 0.55) !important;
    backdrop-filter: blur(6px);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: var(--transition);
}

.prev:hover, .next:hover {
    background: var(--primary) !important;
    transform: translateY(-50%) scale(1.1);
}

/* Banner quảng cáo */
.banner {
    max-width: 1240px;
    margin: 10px auto 24px auto;
    padding: 0 15px;
}

.banner img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.banner img:hover {
    box-shadow: var(--shadow-md);
}

/* ==========================================================
   5. TIÊU ĐỀ KHỐI NỘI DUNG (SECTION HEADINGS)
   ========================================================== */
.sencond-item {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.title {
    background: var(--bg-card);
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.title:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1 !important;
}

.nav-title {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%) !important;
    padding: 10px 18px !important;
    display: flex;
    align-items: center;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.section-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.section-title-main {
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.section-title-main i {
    font-size: 13px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: var(--radius-sm);
}

/* ==========================================================
   6. GRID TIN TỨC & THẺ CARD HIỆN ĐẠI
   ========================================================== */
.grid-container {
    padding: 16px;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)) !important;
    gap: 16px !important;
}

.grid-item {
    background: #ffffff !important;
    border: 1px solid #f1f5f9 !important;
    border-radius: var(--radius-md) !important;
    padding: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover) !important;
    border-color: rgba(0, 104, 55, 0.25) !important;
}

.grid-item .left-div {
    width: 100%;
    height: 165px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #f1f5f9;
}

.grid-item .left-div a {
    display: block;
    width: 100%;
    height: 100%;
}

.grid-item .left-div img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.4s ease;
}

.grid-item:hover .left-div img {
    transform: scale(1.06);
}

.grid-item .right-div {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.news-link {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: var(--transition);
}

.news-link:hover {
    color: var(--primary) !important;
}

/* ==========================================================
   7. KHỐI ĐĂNG KÝ KHÁM & LINK ĐỐI TÁC Y TẾ
   ========================================================== */
.thirst-container {
    max-width: 1240px;
    margin: 24px auto;
    padding: 0 15px;
}

.thirst-container-image a img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.thirst-container-image a img:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Thanh logo đối tác */
.medical-image-link {
    max-width: 1240px;
    margin: 10px auto 30px auto;
    padding: 14px 15px !important;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.ux-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.ux-logo-link:hover {
    background: #ffffff;
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.ux-logo-image {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}

/* ==========================================================
   8. FOOTER TRANG WEB CAO CẤP
   ========================================================== */
.footer {
    background: #09261a !important;
    color: #e2e8f0;
    margin-top: 40px;
    border-top: 4px solid var(--primary);
}

.absolute-footer {
    max-width: 1240px;
    margin: 0 auto;
    padding: 35px 20px 20px 20px;
}

.footer-secondary .footer-text strong {
    color: #ffffff;
    font-size: 16px;
    display: inline-block;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.footer-secondary .footer-text p {
    color: #cbd5e1;
    font-size: 13.5px;
    margin: 4px 0;
    line-height: 1.6;
}

.footer-primary {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
    padding-top: 15px;
    text-align: center;
}

.copyright-footer p {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
}

/* Nút cuộn lên đầu trang */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 25px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #ffffff !important;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    transition: var(--transition);
    z-index: 1000;
}

.back-to-top:hover {
    background: var(--primary-light);
    transform: translateY(-4px) scale(1.08);
}

/* ==========================================================
   9. RESPONSIVE THIẾT KẾ ĐA MÀN HÌNH (TABLET & MOBILE)
   ========================================================== */
@media (max-width: 992px) {
    .first-item {
        grid-template-columns: 1fr;
    }

    .slider-container {
        height: 360px;
        min-height: 360px;
    }

    .header-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .header-search {
        max-width: 100%;
    }

    .logo-icon-right {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .slider-container {
        height: 240px;
        min-height: 240px;
    }

    .grid-container {
        grid-template-columns: 1fr !important;
    }

    .header_navbar-itm a {
        font-size: 12px;
        padding: 6px 10px;
    }

    .logo-icon-right li a {
        font-size: 11px;
        padding: 4px 8px;
    }
}
