/* ============================================================
   RBRU news/gallery redesign — โทนแดงคณะ ใช้คู่กับ js/rbru-api.js
   ============================================================ */

:root {
    --rbru-red: #781112;
    --rbru-red-2: #b53c40;
    --rbru-dark: #661114;
    --rbru-pink: #ffd4d2;
    --rbru-pink-soft: #fdf0ef;
    --rbru-radius: 18px;
    --rbru-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* ---------- หัว section หน้าแรก + ปุ่มดูทั้งหมด ---------- */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0 18px;
}

.section-head h2 {
    position: relative;
    margin: 0;
    padding-left: 16px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #222;
}

.section-head h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 1.4em;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--rbru-red), var(--rbru-red-2));
}

.btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 18px;
    border: 1.5px solid var(--rbru-red);
    border-radius: 25px;
    color: var(--rbru-red);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    background: #fff;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.btn-view-all:hover {
    background: var(--rbru-red);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(120, 17, 18, 0.3);
}

/* ---------- ชิปวันที่/ปี บนการ์ด ---------- */

.card-img {
    position: relative;
}

.card-date {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 3px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--rbru-red);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ---------- หน้า detail (ข่าว/อัลบั้ม) ---------- */

.detail-hero {
    background: #fff;
    border-radius: var(--rbru-radius);
    box-shadow: var(--rbru-shadow);
    padding: 28px;
    margin-bottom: 20px;
}

.detail-title {
    font-weight: 600;
    color: #222;
    line-height: 1.5;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 3px solid var(--rbru-pink);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-bottom: 18px;
    color: #888;
    font-size: 14px;
}

.detail-meta i {
    color: var(--rbru-red-2);
}

.detail-body {
    line-height: 1.8;
    color: #333;
    overflow-wrap: break-word;
}

.detail-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.detail-body iframe {
    max-width: 100%;
}

/* ---------- ไฟล์แนบข่าว ---------- */

.attach-head {
    margin: 24px 0 12px;
    font-weight: 600;
    color: var(--rbru-dark);
}

.attach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.attach-grid a {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--rbru-shadow);
}

.attach-grid img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.attach-grid a:hover img {
    transform: scale(1.05);
}

.attach-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attach-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #eee;
    border-radius: 12px;
    color: #333;
    text-decoration: none;
    transition: all 0.25s ease;
    background: #fff;
}

.attach-item > i:first-child {
    font-size: 1.3rem;
    color: var(--rbru-red);
    width: 26px;
    text-align: center;
}

.attach-item .fa-download {
    color: #bbb;
}

.attach-item:hover {
    background: var(--rbru-pink-soft);
    border-color: var(--rbru-pink);
    color: var(--rbru-dark);
    transform: translateX(4px);
}

/* ---------- กริดรูปในอัลบั้ม ---------- */

.album-desc {
    background: var(--rbru-pink-soft);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 20px;
    line-height: 1.8;
    color: #444;
    overflow-wrap: break-word;
}

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

.gallery-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--rbru-shadow);
    cursor: zoom-in;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.gallery-thumb:hover img {
    transform: scale(1.08);
}

.gallery-zoom {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    background: rgba(102, 17, 20, 0);
    opacity: 0;
    transition: all 0.25s ease;
}

.gallery-thumb:hover .gallery-zoom {
    opacity: 1;
    background: rgba(102, 17, 20, 0.35);
}

/* ---------- lightbox ---------- */

.rbru-lightbox .modal-content {
    background: #0d0a0a;
    border: 0;
    border-radius: 0;
    height: 100%;
}

.rbru-lightbox .lightbox-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    color: #eee;
}

.rbru-lightbox .lightbox-title {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rbru-lightbox .lightbox-counter {
    padding: 3px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 13px;
    white-space: nowrap;
}

.rbru-lightbox .lightbox-close {
    border: 0;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.rbru-lightbox .lightbox-close:hover {
    background: var(--rbru-red-2);
}

.rbru-lightbox .modal-body {
    display: flex;
    align-items: center;
    padding: 0 0 20px;
    min-height: 0;
}

.rbru-lightbox .carousel {
    width: 100%;
    height: 100%;
}

.rbru-lightbox .carousel-inner,
.rbru-lightbox .carousel-item {
    height: 100%;
}

.rbru-lightbox .carousel-item {
    text-align: center;
}

.rbru-lightbox .carousel-item img {
    max-width: 96%;
    max-height: 85vh;
    object-fit: contain;
    margin: 0 auto;
}

/* ---------- ตัวกรองปี + pagination ---------- */

.year-filter {
    background: #fff;
    border: 1.5px solid var(--rbru-red);
    color: var(--rbru-red);
    border-radius: 25px;
    padding: 6px 18px;
    font-weight: 500;
}

.year-filter:hover,
.year-filter:focus,
.year-filter:active {
    background: var(--rbru-red) !important;
    border-color: var(--rbru-red) !important;
    color: #fff !important;
}

.dropdown-menu .dropdown-item.active {
    background-color: var(--rbru-red);
}

.rbru-pagination .page-link {
    color: var(--rbru-red);
    border-radius: 8px;
    margin: 0 3px;
    border-color: #eee;
}

.rbru-pagination .page-item.active .page-link {
    background: var(--rbru-red);
    border-color: var(--rbru-red);
    color: #fff;
}

.rbru-pagination .page-link:hover {
    background: var(--rbru-pink-soft);
    color: var(--rbru-dark);
}

.rbru-pagination .page-item.disabled .page-link {
    color: #bbb;
}

/* ---------- กล่องสถานะ ว่าง/ผิดพลาด ---------- */

.rbru-state {
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: var(--rbru-radius);
    padding: 36px 24px;
    text-align: center;
    color: #777;
}

.rbru-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--rbru-pink-soft);
    color: var(--rbru-red-2);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rbru-state h5 {
    color: #444;
    font-weight: 600;
}

.rbru-state p {
    margin-bottom: 0;
}

.rbru-state-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.rbru-state-actions .btn-modern {
    border: 0;
    cursor: pointer;
}

.rbru-state-error {
    border-color: var(--rbru-pink);
    background: var(--rbru-pink-soft);
}

/* ---------- skeleton เพิ่มเติม ---------- */

.skeleton-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    margin-bottom: 16px;
}

.skeleton-detail {
    background: #fff;
    border-radius: var(--rbru-radius);
    box-shadow: var(--rbru-shadow);
    padding: 28px;
}

.skeleton-detail .skeleton-line {
    height: 16px;
    border-radius: 6px;
    margin-bottom: 14px;
}

/* ---------- responsive ---------- */

@media (max-width: 767.98px) {
    .section-head h2 {
        font-size: 1.25rem;
    }

    .detail-hero {
        padding: 18px;
    }

    .attach-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .attach-grid img {
        height: 130px;
    }
}
