/* ===================================================
   index.css — สไตล์เฉพาะหน้าแรก (index.php)
   ใช้คู่กับ style.css (โหลด style.css ก่อนเสมอ)
   =================================================== */

/* Dropdown Menu สีส้ม */
.dropdown-menu {
    background-color: var(--hosp-orange) !important;
    border: none !important;
    border-radius: 0 0 6px 6px !important;
    padding: 0 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.dropdown-item {
    color: #ffffff !important;
    font-size: 14px;
    padding: 10px 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background-color: var(--hosp-orange-dark) !important; }

/* Dropdown กลุ่มงาน (2 คอลัมน์) */
.dept-dropdown-menu {
    width: 460px;
    max-width: calc(100vw - 24px);
    max-height: 70vh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px 8px !important;
    grid-template-columns: 1fr 1fr;
    align-content: start;
    gap: 0;
}
/* แสดง grid เฉพาะตอนที่ dropdown เปิด — ไม่ทับ display:none ของ Bootstrap */
.dept-dropdown-menu.show,
.nav-item.dropdown:hover .dept-dropdown-menu {
    display: grid !important;
}
.dept-dropdown-menu li { list-style: none; }
.dept-dropdown-menu .dropdown-item {
    border-bottom: none;
    padding: 9px 14px !important;
    white-space: nowrap;
}

/* Hover on desktop */
@media (min-width: 992px) {
    .nav-item.dropdown:hover .dropdown-menu { display: block; margin-top: 0; }
    .dept-dropdown-menu { max-height: none; overflow-y: visible; overflow-x: visible; }
}

/* ==================== TAB SECTION ==================== */

/* Reset Bootstrap .nav styles ที่ใช้ใน tab header */
.hosp-tab-header.nav {
    flex-wrap: nowrap !important;
    list-style: none !important;
    padding-left: 0 !important;
    margin-bottom: 0 !important;
}

.hosp-tab-header {
    display: flex;
    gap: 4px;
    background-color: var(--hosp-orange-dark);
    padding: 8px 8px 0 8px;
    border-radius: 6px 6px 0 0;
}

.hosp-tab-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    padding: 10px 22px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.hosp-tab-btn:hover { background: rgba(255,255,255,0.25); }
.hosp-tab-btn.active {
    background: #ffffff;
    color: var(--hosp-orange-dark);
}

.hosp-tab-body {
    border: 1px solid #dee2e6;
    border-top: none;
    background: #ffffff;
    min-height: 380px;
}

/* ลิงก์ ดูทั้งหมด */
.hosp-see-all {
    color: var(--hosp-orange);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.hosp-see-all:hover { color: var(--hosp-orange-dark); text-decoration: underline; }

/* ==================== EVENT THUMBNAIL CARDS ==================== */

.ev-thumb-card {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ev-thumb-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(231, 133, 81, 0.2);
}

.ev-thumb-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    border-bottom: 3px solid var(--hosp-orange);
}

.ev-thumb-body {
    padding: 10px 12px;
}

.ev-thumb-title {
    font-size: 13px;
    font-weight: 700;
    color: #2d2d2d;
    line-height: 1.45;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ev-thumb-date {
    font-size: 12px;
    color: var(--hosp-orange);
    font-weight: 600;
}

/* ==================== SIDEBAR ==================== */

.sidebar-box {
    border: 1px solid #dee2e6;
    border-top: none;
    background: #fff;
    padding: 14px 16px;
    font-size: 14px;
}

.visitor-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px dashed #f0f0f0;
    color: #555;
}
.visitor-stat-row:last-child { border-bottom: none; }

/* Social Buttons */
.social-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
    border: none;
}
.social-btn:hover { opacity: 0.85; }
.social-fb   { background: #1877f2; color: #fff; }
.social-yt   { background: #ff0000; color: #fff; }
.social-line { background: #06c755; color: #fff; }

/* Hover สีพื้นหลัง */
.event-card:hover,
.dept-link-node:hover,
.link-grid-item:hover { background-color: #fdf5ee; transition: background-color 0.2s; }

/* ==================== QUICK ACCESS SECTION ==================== */

.quick-access-section {
    background-color: #f8f4f0;
    padding: 32px 0 40px;
    margin-top: 8px;
}

.qa-header {
    background-color: var(--hosp-orange);
    color: #ffffff;
    padding: 10px 18px;
    font-weight: bold;
    font-size: 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: inline-block;
}

.ql-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #ffffff;
    border-radius: 10px;
    padding: 20px 12px 16px;
    text-decoration: none;
    border: 1px solid #e9ecef;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}
.ql-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

.ql-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 10px;
    color: #ffffff;
}

.ql-blue   { background-color: #3b82f6; }
.ql-red    { background-color: #ef4444; }
.ql-green  { background-color: #22c55e; }
.ql-purple { background-color: #8b5cf6; }
.ql-orange { background-color: var(--hosp-orange); }
.ql-teal   { background-color: #14b8a6; }

.ql-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--hosp-text-dark);
    line-height: 1.4;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 991.98px) {
    .hosp-tab-btn { font-size: 14px; padding: 9px 16px; }
    .ev-thumb-img { height: 130px; }
    .dept-dropdown-menu { max-width: 100%; padding: 8px 4px !important; }
}

@media (max-width: 767.98px) {
    .hosp-tab-header { overflow-x: auto; flex-wrap: nowrap; }
    .hosp-tab-btn    { font-size: 13px; padding: 8px 14px; white-space: nowrap; }
    .ev-thumb-img    { height: 120px; }
    .ql-icon-wrap    { width: 50px; height: 50px; font-size: 22px; }
    .ql-label        { font-size: 12px; }
}

@media (max-width: 575.98px) {
    .dept-dropdown-menu { width: calc(100vw - 16px); padding: 8px 4px !important; }
    .dept-dropdown-menu .dropdown-item { font-size: 13px; padding: 8px 8px !important; }
    .ev-thumb-img { height: 110px; }
    .ql-card { padding: 16px 8px 12px; }
}

/* ==================== SCROLL TO TOP ==================== */

#scrollTopBtn {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 9999;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--hosp-orange);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
#scrollTopBtn.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
#scrollTopBtn:hover { background: var(--hosp-orange-dark); }

/* ==================== NEWS POSTER CAROUSEL ==================== */

.news-carousel-wrap {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px 50px;
}

.news-carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0;
}
.news-carousel::-webkit-scrollbar { display: none; }

.news-card-item {
    flex: 0 0 calc(33.333% - 14px);
    min-width: 280px;
    scroll-snap-align: start;
}

.news-poster-card {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    background: #f8f4f0;
    border: 1px solid #e9ecef;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s, box-shadow 0.25s;
    position: relative;
    height: 480px;
}
.news-poster-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 28px rgba(231, 133, 81, 0.22);
}

.news-poster-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #f8f4f0;
}

.news-poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f4f0 0%, #ffe8d6 100%);
    color: #bbb;
    font-size: 14px;
    gap: 8px;
}
.news-poster-placeholder i { font-size: 48px; }

.news-poster-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.45) 55%, transparent 100%);
    padding: 50px 14px 14px;
    color: #fff;
}

.news-poster-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-poster-date {
    font-size: 12px;
    opacity: 0.85;
}

/* ปุ่มเลื่อน */
.news-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--hosp-orange);
    background: #fff;
    color: var(--hosp-orange);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: all 0.2s;
}
.news-nav-btn:hover {
    background: var(--hosp-orange);
    color: #fff;
}
.news-nav-prev { left: 4px; }
.news-nav-next { right: 4px; }

/* Responsive */
@media (max-width: 991.98px) {
    .news-card-item { flex: 0 0 calc(50% - 10px); min-width: 260px; }
    .news-poster-card { height: 400px; }
    .news-carousel-wrap { padding: 16px 46px; }
}

@media (max-width: 575.98px) {
    .news-card-item { flex: 0 0 85%; min-width: 240px; }
    .news-poster-card { height: 360px; }
    .news-carousel-wrap { padding: 14px 40px; }
    .news-nav-btn { width: 34px; height: 34px; font-size: 16px; }
}

/* ==================== NEWS GRID (ข่าวประชาสัมพันธ์ section) ==================== */

.news-frame {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    overflow: hidden;
}
.news-wrapper {
    padding: 24px 28px 20px;
}
.news-img-wrap {
    border-radius: 8px;
    overflow: hidden;
    background: #f0ece8;
    border: 1px solid #e9ecef;
}
.news-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.25s;
}
.news-img-wrap:hover img { transform: scale(1.04); }

.news-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}
.page-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e9ecef;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.page-dot.active,
.page-dot:hover {
    background: var(--hosp-orange);
    color: #fff;
}

@media (max-width: 767.98px) {
    .news-wrapper { padding: 16px; }
}