/**
 * tpl_bpha - Template CSS
 * สำนักวิชาการสาธารณสุข (Bureau of Public Health Academic Affairs)
 * Joomla 5 Template
 *
 * @copyright (C) 2026 BPHA
 * @license   GNU GPL v2+
 */

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
    --bpha-primary: #0c2d6b;
    --bpha-primary-light: #1a4ba0;
    --bpha-primary-bright: #2563eb;
    --bpha-accent: #f59e0b;
    --bpha-accent-light: #fbbf24;

    --bpha-bg: #f0f4f8;
    --bpha-bg-alt: #f8fafc;
    --bpha-card: #ffffff;
    --bpha-text: #1e293b;
    --bpha-text-muted: #64748b;
    --bpha-text-light: #94a3b8;
    --bpha-border: #e2e8f0;

    --bpha-radius: 16px;
    --bpha-radius-sm: 10px;
    --bpha-radius-xs: 6px;
    --bpha-shadow: 0 4px 24px rgba(12, 45, 107, 0.08);
    --bpha-shadow-hover: 0 12px 40px rgba(12, 45, 107, 0.15);
    --bpha-transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);

    --bpha-header-height: 72px;
    --bpha-navbar-height: 52px;
    --bpha-container-width: 1440px;

    --bpha-font: 'Kanit', sans-serif;
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--bpha-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--bpha-text);
    background: var(--bpha-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--bpha-primary-bright);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--bpha-primary);
}

::selection {
    background: var(--bpha-primary-bright);
    color: #fff;
}


/* ============================================================
   CONTAINER
   ============================================================ */
.bpha-container {
    width: 100%;
    max-width: var(--bpha-container-width);
    margin: 0 auto;
    padding: 0 24px;
}

.bpha-container-fluid {
    width: 100%;
    padding: 0 24px;
}

@media (max-width: 767px) {
    .bpha-container,
    .bpha-container-fluid {
        padding: 0 16px;
    }
}


/* ============================================================
   HEADER BANNER (แถบน้ำเงิน + โลโก้)
   ============================================================ */
.bpha-header {
    position: relative;
    height: var(--bpha-header-height);
    z-index: 100;
    overflow: hidden;
}

.bpha-header-sticky {
    position: sticky;
    top: 0;
}

.bpha-header-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--bpha-primary) 0%, var(--bpha-primary-light) 50%, var(--bpha-primary-bright) 100%);
    z-index: 0;
}

.bpha-header-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.05) 0%, transparent 40%);
}

.bpha-header-pattern {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

.bpha-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    position: relative;
    z-index: 2;
}

/* Logo Group */
.bpha-logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #fff;
    transition: var(--bpha-transition);
}

.bpha-logo-group:hover {
    color: #fff;
    opacity: 0.92;
}

.bpha-logo-img {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
    transition: var(--bpha-transition);
}

.bpha-logo-group:hover .bpha-logo-img {
    transform: scale(1.06) rotate(-2deg);
}

.bpha-logo-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bpha-ministry-label {
    font-size: 11px;
    font-weight: 300;
    color: rgba(255,255,255,0.55);
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1.3;
}

.bpha-site-title {
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.bpha-site-subtitle {
    font-size: 12px;
    font-weight: 300;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.5px;
    line-height: 1.3;
}

/* Header Right */
.bpha-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Date Badge */
.bpha-date-badge {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 18px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 300;
}

@media (min-width: 768px) {
    .bpha-date-badge { display: flex; }
}

.bpha-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: bpha-pulse 2s infinite;
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
    flex-shrink: 0;
}

@keyframes bpha-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Header Responsive */
@media (max-width: 767px) {
    :root {
        --bpha-header-height: 62px;
    }
    .bpha-logo-img {
        width: 40px;
        height: 40px;
    }
    .bpha-site-title {
        font-size: 17px;
    }
    .bpha-ministry-label {
        font-size: 9px;
    }
    .bpha-site-subtitle {
        display: none;
    }
    .bpha-logo-group {
        gap: 10px;
    }
}


/* ============================================================
   NAVIGATION BAR (เมนูแนวนอน)
   ============================================================ */
.bpha-navbar {
    background: var(--bpha-card);
    border-bottom: 1px solid var(--bpha-border);
    height: var(--bpha-navbar-height);
    z-index: 99;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s;
}

.bpha-navbar-sticky {
    position: sticky;
    top: var(--bpha-header-height);
}

/* เมื่อ Header ไม่ sticky แต่ Navbar sticky */
.bpha-header:not(.bpha-header-sticky) + .bpha-navbar-sticky {
    top: 0;
}

/* เมื่อทั้ง Header และ Navbar sticky */
.bpha-header-sticky + .bpha-navbar-sticky {
    top: var(--bpha-header-height);
}

.bpha-navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.bpha-navbar-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* ★ ชิดขวา */
    height: 100%;
}

/* Desktop Menu Container */
.bpha-menu-desktop {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

/* ── Reset All Menu ULs ── */
.bpha-menu-desktop ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── ROOT LEVEL UL (Level 1) ── */
.bpha-menu-desktop > ul,
.bpha-menu-desktop > div > ul {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 0;
}

/* ── ROOT LEVEL LI ── */
.bpha-menu-desktop > ul > li,
.bpha-menu-desktop > div > ul > li {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* ── ROOT LEVEL Links (A / SPAN) ── */
.bpha-menu-desktop > ul > li > a,
.bpha-menu-desktop > ul > li > span,
.bpha-menu-desktop > div > ul > li > a,
.bpha-menu-desktop > div > ul > li > span {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 18px;
    height: 100%;
    font-size: 18px;
    font-weight: 500;
    color: var(--bpha-text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: var(--bpha-transition);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    position: relative;
}

/* Hover Effects (Root Level) */
.bpha-menu-desktop > ul > li > a::after,
.bpha-menu-desktop > ul > li > span::after,
.bpha-menu-desktop > div > ul > li > a::after,
.bpha-menu-desktop > div > ul > li > span::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--bpha-primary-bright), var(--bpha-accent));
    border-radius: 3px 3px 0 0;
    transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
    transform: translateX(-50%);
}

.bpha-menu-desktop > ul > li > a::before,
.bpha-menu-desktop > ul > li > span::before,
.bpha-menu-desktop > div > ul > li > a::before,
.bpha-menu-desktop > div > ul > li > span::before {
    content: '';
    position: absolute;
    inset: 6px 4px;
    background: var(--bpha-primary-bright);
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.bpha-menu-desktop > ul > li:hover > a,
.bpha-menu-desktop > ul > li:hover > span,
.bpha-menu-desktop > div > ul > li:hover > a,
.bpha-menu-desktop > div > ul > li:hover > span {
    color: var(--bpha-primary);
    border-bottom-color: transparent;
}

.bpha-menu-desktop > ul > li:hover > a::after,
.bpha-menu-desktop > ul > li:hover > span::after,
.bpha-menu-desktop > div > ul > li:hover > a::after,
.bpha-menu-desktop > div > ul > li:hover > span::after {
    width: 70%;
}

.bpha-menu-desktop > ul > li:hover > a::before,
.bpha-menu-desktop > ul > li:hover > span::before,
.bpha-menu-desktop > div > ul > li:hover > a::before,
.bpha-menu-desktop > div > ul > li:hover > span::before {
    opacity: 0.06;
}

/* Active State (Root Level) */
.bpha-menu-desktop > ul > li.active > a,
.bpha-menu-desktop > ul > li.current > a,
.bpha-menu-desktop > ul > li.active > span,
.bpha-menu-desktop > ul > li.current > span,
.bpha-menu-desktop > div > ul > li.active > a,
.bpha-menu-desktop > div > ul > li.current > a,
.bpha-menu-desktop > div > ul > li.active > span,
.bpha-menu-desktop > div > ul > li.current > span {
    color: var(--bpha-primary);
    font-weight: 600;
}

.bpha-menu-desktop > ul > li.active > a::after,
.bpha-menu-desktop > ul > li.current > a::after,
.bpha-menu-desktop > ul > li.active > span::after,
.bpha-menu-desktop > ul > li.current > span::after,
.bpha-menu-desktop > div > ul > li.active > a::after,
.bpha-menu-desktop > div > ul > li.current > a::after,
.bpha-menu-desktop > div > ul > li.active > span::after,
.bpha-menu-desktop > div > ul > li.current > span::after {
    width: 60%;
    background: var(--bpha-primary-bright);
}

/* Dropdown Caret (Root Level) */
.bpha-menu-desktop > ul > li.deeper > a::after,
.bpha-menu-desktop > ul > li.parent > a::after,
.bpha-menu-desktop > ul > li.deeper > span::after,
.bpha-menu-desktop > ul > li.parent > span::after,
.bpha-menu-desktop > div > ul > li.deeper > a::after,
.bpha-menu-desktop > div > ul > li.parent > a::after,
.bpha-menu-desktop > div > ul > li.deeper > span::after,
.bpha-menu-desktop > div > ul > li.parent > span::after {
    content: '';
    position: static;
    width: 6px;
    height: 6px;
    border: none;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    background: none;
    border-radius: 0;
    opacity: 0.5;
    transition: all 0.3s;
    flex-shrink: 0;
    left: auto;
}

.bpha-menu-desktop > ul > li.deeper:hover > a::after,
.bpha-menu-desktop > ul > li.parent:hover > a::after,
.bpha-menu-desktop > ul > li.deeper:hover > span::after,
.bpha-menu-desktop > ul > li.parent:hover > span::after,
.bpha-menu-desktop > div > ul > li.deeper:hover > a::after,
.bpha-menu-desktop > div > ul > li.parent:hover > a::after,
.bpha-menu-desktop > div > ul > li.deeper:hover > span::after,
.bpha-menu-desktop > div > ul > li.parent:hover > span::after {
    opacity: 1;
    transform: rotate(45deg) translateY(-2px);
}

/* ── ★ DROPDOWN SUBMENU (Level 2 and beyond) ── */
.bpha-menu-desktop ul ul {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: var(--bpha-card);
    border: 1px solid var(--bpha-border);
    border-radius: var(--bpha-radius-sm);
    box-shadow: 0 16px 48px rgba(12, 45, 107, 0.12), 0 4px 12px rgba(0,0,0,0.06);
    padding: 12px 0;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.98);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    text-align: left;
}

/* Right-align the last root item's dropdown to prevent screen overflow */
.bpha-menu-desktop > ul > li:last-child > ul,
.bpha-menu-desktop > div > ul > li:last-child > ul {
    left: auto;
    right: 0;
}

/* Show submenu on hover */
.bpha-menu-desktop ul li:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Level 3 Submenu (flyout to right) */
.bpha-menu-desktop ul ul ul {
    top: -13px; /* Align to parent item height */
    left: 100%;
    transform: translateX(8px);
}
.bpha-menu-desktop ul ul li:hover > ul {
    transform: translateX(0);
}

/* Submenu LI */
.bpha-menu-desktop ul ul > li {
    display: block;
    width: 100%;
    position: relative;
}

/* Submenu Links */
.bpha-menu-desktop ul ul > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 400;
    color: var(--bpha-text);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    border-left: 3px solid transparent;
    white-space: normal;
}

.bpha-menu-desktop ul ul > li > a:hover {
    background: linear-gradient(90deg, rgba(37,99,235,0.06) 0%, transparent 100%);
    color: var(--bpha-primary);
    border-left-color: var(--bpha-primary-bright);
    padding-left: 28px;
}

/* Active State (Submenu) */
.bpha-menu-desktop ul ul > li.active > a,
.bpha-menu-desktop ul ul > li.current > a {
    color: var(--bpha-primary);
    font-weight: 600;
    border-left-color: var(--bpha-primary-bright);
    background: rgba(37,99,235,0.04);
}

/* Submenu Caret (for items with children) */
.bpha-menu-desktop ul ul > li.deeper > a::after,
.bpha-menu-desktop ul ul > li.parent > a::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.5;
    margin-left: auto; /* Pushes arrow to the right edge */
}

/* Submenu Headings / Separators (Span) */
.bpha-menu-desktop ul ul > li > span {
    display: block;
    padding: 12px 24px 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--bpha-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: default;
    opacity: 0.7;
}

/* Mobile Toggle Button */
.bpha-menu-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1.5px solid var(--bpha-border);
    border-radius: var(--bpha-radius-xs);
    padding: 6px 14px;
    cursor: pointer;
    color: var(--bpha-text-muted);
    font-family: var(--bpha-font);
    font-size: 14px;
    font-weight: 500;
    transition: var(--bpha-transition);
}

.bpha-menu-toggle:hover {
    border-color: var(--bpha-primary-bright);
    color: var(--bpha-primary);
}

.bpha-hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 20px;
}

.bpha-hamburger span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.3s;
}

.bpha-menu-toggle[aria-expanded="true"] .bpha-hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
.bpha-menu-toggle[aria-expanded="true"] .bpha-hamburger span:nth-child(2) {
    opacity: 0;
}
.bpha-menu-toggle[aria-expanded="true"] .bpha-hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* Mobile Menu Drawer */
.bpha-mobile-menu {
    display: none;
    background: var(--bpha-card);
    border-top: 1px solid var(--bpha-border);
    padding: 16px 0;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.bpha-mobile-menu[aria-hidden="false"] {
    display: block;
    animation: bpha-slideDown 0.3s ease-out;
}

@keyframes bpha-slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bpha-mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bpha-mobile-menu ul > li > a {
    display: block;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--bpha-text);
    text-decoration: none;
    border-bottom: 1px solid var(--bpha-border);
    transition: all 0.2s;
}

.bpha-mobile-menu ul > li > a:hover,
.bpha-mobile-menu ul > li.active > a {
    background: var(--bpha-bg-alt);
    color: var(--bpha-primary-bright);
    padding-left: 28px;
}

.bpha-mobile-menu ul > li > ul > li > a {
    padding-left: 36px;
    font-size: 14px;
    font-weight: 400;
    color: var(--bpha-text-muted);
}

@media (max-width: 991px) {
    .bpha-menu-desktop { display: none; }
    .bpha-menu-toggle { display: flex; }
}


/* ============================================================
   BANNER AREA
   ============================================================ */
.bpha-banner-area {
    position: relative;
    z-index: 1;
}


/* ============================================================
   BREADCRUMB
   ============================================================ */
.bpha-breadcrumb-area {
    padding: 12px 0;
    background: var(--bpha-bg-alt);
    border-bottom: 1px solid var(--bpha-border);
    font-size: 13px;
}

.bpha-breadcrumb-area .breadcrumb,
.bpha-breadcrumb-area ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
    align-items: center;
}

.bpha-breadcrumb-area a {
    color: var(--bpha-text-muted);
    font-weight: 400;
}

.bpha-breadcrumb-area a:hover {
    color: var(--bpha-primary-bright);
}


/* ============================================================
   CONTENT AREAS
   ============================================================ */
.bpha-content-top,
.bpha-content-bottom {
    padding: 20px 0;
}

.bpha-main-area {
    padding: 24px 0;
    min-height: 50vh;
}

/* ★ ถ้าไม่มีเนื้อหาให้ padding เป็น 0 */
.bpha-main-area:empty,
.bpha-main-area:has(> .bpha-container:empty),
.bpha-main-area:has(> *:empty:only-child) {
    padding: 0;
    min-height: 0;
}

.bpha-main-area--no-content {
    padding: 0 !important;
    min-height: 0 !important;
}

/* Content Grid Layout */
.bpha-content-grid {
    display: grid;
    gap: 24px;
}

.bpha-main-full .bpha-main-content {
    grid-column: 1 / -1;
}

.bpha-main-sidebar-left {
    grid-template-columns: 280px 1fr;
}

.bpha-main-sidebar-right {
    grid-template-columns: 1fr 300px;
}

.bpha-main-both-sidebars {
    grid-template-columns: 260px 1fr 280px;
}

@media (max-width: 991px) {
    .bpha-main-sidebar-left,
    .bpha-main-sidebar-right,
    .bpha-main-both-sidebars {
        grid-template-columns: 1fr;
    }
    .bpha-sidebar {
        order: 2;
    }
    .bpha-main-content {
        order: 1;
    }
}


/* ============================================================
   MODULE CHROME: bphaCard
   ============================================================ */
.bpha-module-card {
    background: var(--bpha-card);
    border-radius: var(--bpha-radius);
    border: 1px solid var(--bpha-border);
    overflow: hidden;
    margin-bottom: 20px;
    transition: var(--bpha-transition);
}

.bpha-module-card:hover {
    box-shadow: var(--bpha-shadow);
}

.bpha-module-card .bpha-module-title {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--bpha-primary);
    border-bottom: 1px solid var(--bpha-border);
    background: var(--bpha-bg-alt);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bpha-module-card .bpha-module-title::before {
    content: '';
    width: 4px;
    height: 18px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--bpha-primary-bright), var(--bpha-accent));
    flex-shrink: 0;
}

.bpha-module-card .bpha-module-body {
    padding: 20px;
}


/* ============================================================
   FOOTER AREA
   ============================================================ */
.bpha-footer-area {
    margin-top: auto;
}


/* ============================================================
   BACK TO TOP
   ============================================================ */
.bpha-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--bpha-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--bpha-transition);
    box-shadow: 0 4px 16px rgba(12, 45, 107, 0.3);
}

.bpha-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bpha-back-to-top:hover {
    background: var(--bpha-primary-bright);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(12, 45, 107, 0.4);
}


/* ============================================================
   JOOMLA SYSTEM MESSAGES
   ============================================================ */
#system-message-container {
    padding: 12px 0;
}

/* ★ ถ้าไม่มี message ให้ padding เป็น 0 */
#system-message-container:empty,
#system-message-container:not(:has(.alert)) {
    padding: 0;
    margin: 0;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--bpha-radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
    border: 1px solid;
}

.alert-message,
.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-error,
.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}


/* ============================================================
   JOOMLA COMPONENT OVERRIDES (Basic Article Styling)
   ============================================================ */
.com-content-article .page-header h1,
.com-content-article .page-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--bpha-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.com-content-article .article-info {
    font-size: 13px;
    color: var(--bpha-text-muted);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.com-content-article .com-content-article__body {
    font-size: 16px;
    line-height: 1.8;
    color: var(--bpha-text);
}

.com-content-article .com-content-article__body img {
    border-radius: var(--bpha-radius-sm);
    margin: 16px 0;
}

.com-content-article .com-content-article__body h2,
.com-content-article .com-content-article__body h3 {
    color: var(--bpha-primary);
    margin-top: 28px;
    margin-bottom: 12px;
}

/* Category Blog / List */
.com-content-category .page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--bpha-primary);
    margin-bottom: 20px;
}

.com-content-category .items-row {
    margin-bottom: 20px;
}


/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.bpha-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.bpha-text-center { text-align: center; }
.bpha-text-right { text-align: right; }
.bpha-mt-0 { margin-top: 0; }
.bpha-mb-0 { margin-bottom: 0; }
.bpha-p-0 { padding: 0; }


/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .bpha-header,
    .bpha-navbar,
    .bpha-back-to-top,
    .bpha-banner-area,
    .bpha-footer-area,
    .bpha-sidebar {
        display: none !important;
    }
    .bpha-main-area {
        padding: 0;
    }
    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }
}