/*
Theme Name: Aging Well Guide Child
Description: Independent consumer research and product guides for healthy aging and independent living.
Author: Mark Reynolds
Template: flatsome
Version: 1.0.4
*/

/*************** 1. CORE LAYOUT & ANTI-COLLAPSE (CHỐNG SẬP TRANG) ***************/
#main {
    min-height: 70vh !important;
    background-color: #ffffff !important;
    position: relative;
    z-index: 1;
}

#masthead {
    position: relative !important;
    background-color: #ffffff !important;
}

/*************** 2. HEADER TRÊN MÁY TÍNH (DESKTOP >= 850PX) ***************/
@media (min-width: 850px) {
    .header-main {
        height: 75px !important;
    }

    .header-main .flex-row {
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* Đưa Logo bám sát lề trái, cân đối với thanh Search bên phải */
    .header-main .flex-col.flex-center,
    .header-main .flex-col.flex-left {
        position: static !important;
        transform: none !important;
        left: auto !important;
        margin-right: auto !important;
        margin-left: 0 !important;
        justify-content: flex-start !important;
        text-align: left !important;
        flex: initial !important;
    }

    .header-main .header-logo img {
        max-height: 48px !important;
        width: auto !important;
        display: block !important;
    }
}

/*************** 3. HEADER TRÊN ĐIỆN THOẠI (MOBILE < 850PX) ***************/
@media (max-width: 849px) {
    .header-main {
        height: 64px !important;
    }

    .header-main .container {
        position: relative !important;
        height: 100% !important;
    }

    /* Khóa chặt Logo đúng tâm đối xứng màn hình */
    .header-main .flex-col.flex-center {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        max-width: 65% !important;
        z-index: 99 !important;
    }

    /* Triệt tiêu logo phụ thứ 2 để chống lỗi nhân đôi logo */
    .header-logo-dark,
    img.header-logo-dark,
    #logo .header-logo-dark {
        display: none !important;
    }

    /* Hiển thị logo chính rõ nét, không bị bóp nghẽn */
    .header-main #logo img:not(.header-logo-dark),
    .header-main .header-logo img:not(.header-logo-dark) {
        max-height: 40px !important;
        height: auto !important;
        width: auto !important;
        display: block !important;
    }
}

/*************** 4. HEADER BOTTOM (MENU 7 CHUYÊN MỤC BIÊN TẬP) ***************/
.header-bottom {
    min-height: 48px !important;
    background-color: #ffffff !important;
    border-top: 1px solid #f1f5f9 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.header-bottom .nav > li > a {
    font-size: 14.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    padding: 14px 16px !important;
    letter-spacing: -0.2px;
    transition: all 0.2s ease-in-out;
}

.header-bottom .nav > li > a:hover {
    color: #1e3a8a !important;
    background-color: #f8fafc;
}

/* Tab chuyên mục đang đứng (Active) */
.header-bottom .nav > li.current-menu-item > a,
.header-bottom .nav > li.current-category-ancestor > a,
.header-bottom .nav > li.active > a {
    color: #1e3a8a !important;
    font-weight: 700 !important;
    position: relative;
}

.header-bottom .nav > li.current-menu-item > a:after,
.header-bottom .nav > li.active > a:after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 16px;
    right: 16px;
    height: 3px;
    background-color: #1e3a8a;
    border-radius: 2px 2px 0 0;
}

/*************** 5. TÌM KIẾM & BỘ TIÊU ĐỀ ARCHIVE CHUẨN NAVY ***************/
.button.primary,
button[type="submit"],
input[type="submit"],
.searchform button {
    background-color: #1e3a8a !important;
    border-color: #1e3a8a !important;
    color: #ffffff !important;
}

.button.primary:hover,
button[type="submit"]:hover,
.searchform button:hover {
    background-color: #172554 !important;
}

.search-field {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px 0 0 6px !important;
    background-color: #f8fafc !important;
}

.archive .page-title h1,
.archive .page-title span {
    font-size: 26px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    letter-spacing: -0.5px;
    text-transform: capitalize !important;
}

/*************** 6. UI POLISH & CARDS (LÀM MỀM GIAO DIỆN) ***************/
.box, .card, .post-item, .button:not(.circle), .badge {
    border-radius: 8px !important;
}

.post-item, .box-shadow {
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05) !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid #f1f5f9;
}

.post-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1) !important;
}

/*************** 7. MODERN SIDEBAR WIDGETS ***************/
span.widget-title {
    position: relative;
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

span.widget-title:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 45px;
    height: 2px;
    background-color: #1e3a8a;
}

.widget_categories ul, .flatsome_recent_posts ul {
    list-style: none;
    padding-left: 0;
}

.widget_categories li, .flatsome_recent_posts li {
    padding: 8px 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 14px;
}

/*************** 8. AFFILIATE & TRUST BOXES (E-E-A-T) ***************/
.safety-note, .answer-box {
    background-color: #f8fafc;
    border-left: 4px solid #1e3a8a;
    padding: 16px 20px;
    margin: 25px 0;
    border-radius: 0 8px 8px 0;
    font-size: 15px;
    line-height: 1.6;
    color: #334155;
}

.btn-amazon-cta {
    background-color: #d97706 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    padding: 12px 28px !important;
    border: none !important;
    display: inline-block;
    text-align: center;
    text-decoration: none !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25) !important;
    transition: all 0.2s ease-in-out !important;
}

.btn-amazon-cta:hover {
    background-color: #b45309 !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.35) !important;
}

/*************** 9. SENIOR READABILITY & RESPONSIVE ***************/
body {
    line-height: 1.7;
    color: #334155;
}

@media only screen and (max-width: 48em) {
    body {
        font-size: 16px;
    }
    .post-item {
        margin-bottom: 20px;
    }
}

/*************** 10. EDITORIAL LINKS & OUTLINKS (NO UNDERLINE, WCAG BLUE) ***************/
/* Màu xanh chuẩn Royal Blue, bỏ hoàn toàn gạch chân trên toàn bộ bài viết (kể cả bảng) */
article a,
.entry-content a,
.post-content a,
.single-post .content a:not(.button):not(.btn-amazon-cta),
#main p a,
#main li a,
#main td a {
    color: #1d4ed8 !important;              /* Xanh chuẩn nổi bật */
    font-weight: 600 !important;
    text-decoration: none !important;      /* Triệt tiêu gạch chân */
    border-bottom: none !important;
    transition: all 0.2s ease-in-out !important;
}

/* Hover chuyển màu Navy đậm và highlight nền nhẹ */
article a:hover,
.entry-content a:hover,
.post-content a:hover,
.single-post .content a:not(.button):not(.btn-amazon-cta):hover,
#main p a:hover,
#main li a:hover,
#main td a:hover {
    color: #1e3a8a !important;              /* Đổi sang Navy đậm */
    text-decoration: none !important;
    background-color: #eff6ff !important;   /* Nền highlight xanh nhạt */
    border-radius: 2px;
}

/* Icon nhận diện Outlink (link trỏ ra ngoài như CDC, NIA, MedlinePlus) */
article a[href^="http"]:not([href*="agingwellguide.com"]):not(.button):not(:has(img))::after,
.entry-content a[href^="http"]:not([href*="agingwellguide.com"]):not(.button):not(:has(img))::after,
#main p a[href^="http"]:not([href*="agingwellguide.com"]):not(.button):not(:has(img))::after,
#main li a[href^="http"]:not([href*="agingwellguide.com"]):not(.button):not(:has(img))::after {
    content: "" !important;
    display: inline-block !important;
    width: 12px !important;
    height: 12px !important;
    margin-left: 4px !important;
    vertical-align: baseline !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%231d4ed8'%3E%3Cpath d='M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z'/%3E%3Cpath d='M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
}

/* Loại bỏ gạch chân và background cho ảnh và nút bấm CTA */
article a:has(img),
.entry-content a:has(img),
article a img,
.entry-content a img,
a.button,
a.btn-amazon-cta {
    text-decoration: none !important;
    background-color: transparent !important;
    border: none !important;
}