/* =========================================
   BERITA UPDATE - MAIN STYLES
========================================= */

.berita-update {
    padding: 60px 5%;
    background: #a6815d;
}

.berita-update .update-title {
    text-align: center;
    margin-bottom: 40px;
}

.berita-update .update-title h2 {
    margin: 0;
    color: white;
    font-size: 42px;
    font-weight: 700;
}

.berita-update .update-title p {
        font-size: 21px;
        margin-bottom: 25px;
        color: white;
    }

/* =========================================
   SLIDER CONTAINER
========================================= */

.berita-update .update-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.berita-update .update-track {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.berita-update .update-track::-webkit-scrollbar {
    display: none;
}

/* =========================================
   NAVIGATION BUTTONS
========================================= */

.update-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.update-nav:hover {
    background: rgba(255, 255, 255, 0.32);
}

.update-nav:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .update-nav {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
}

/* =========================================
   FEATURED CARD
========================================= */

.featured-card {
    flex: 0 0 calc((100% - 48px) / 3.5);
    display: flex;
    flex-direction: column;
    background: #8c6b48;
    border-radius: 16px;
    overflow: hidden;
    color: white;
    scroll-snap-align: start;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.featured-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

/* Card Thumbnail */
.featured-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    position: relative;
    overflow: hidden;
    background: #7a5a3a;
}

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

.featured-card:hover .featured-thumb img {
    transform: scale(1.05);
}

/* Card Info */
.featured-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 16px 14px 18px;
}

.featured-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: white;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.featured-link {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    color: #e3c9a3;
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.featured-link:hover {
    color: #f3ddb8;
}

.featured-source-badge {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: white;
    color: #1a1a1a;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.featured-source-badge:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.featured-source-badge i {
    font-size: 13px;
    color: #1a1a1a;
}

/* =========================================
   RESPONSIVE - TABLET
========================================= */

@media (max-width: 1024px) {
    .berita-update .update-title h2 {
        font-size: 36px;
    }

    .featured-card {
        flex: 0 0 calc((100% - 16px) / 2.2);
    }

    .featured-info h3 {
        font-size: 15px;
    }
}

/* =========================================
   RESPONSIVE - MOBILE
========================================= */

@media (max-width: 768px) {
    .berita-update {
        padding: 50px 5%;
    }

    .berita-update .update-title h2 {
        font-size: 30px;
        margin-bottom: 30px;
    }

    .featured-card {
        flex: 0 0 calc(100% - 80px);
    }

    .featured-thumb {
        aspect-ratio: 1/1;
    }

    .featured-info h3 {
        font-size: 15px;
    }

    .featured-link {
        font-size: 12px;
    }

    .featured-source-badge {
        font-size: 11px;
        padding: 5px 12px;
    }
}

@media (max-width: 480px) {
    .berita-update {
        padding: 40px 5%;
    }

    .berita-update .update-title h2 {
        font-size: 24px;
        margin-bottom: 25px;
    }

    .berita-update .update-title p {
        font-size: 16px;
        margin-bottom: 25px;
        color: white;
    }

    .featured-card {
        flex: 0 0 calc(100% - 40px);
    }

    .featured-info {
        padding: 14px 12px 16px;
        gap: 8px;
    }

    .featured-info h3 {
        font-size: 14px;
    }
}

/* =========================================
   MODAL - ADAPTIVE SIZE (SEPERTI INSTAGRAM)
========================================= */

.update-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.update-modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.update-modal-box {
    position: relative;
    width: min(1000px, 92vw);
    max-height: 90vh;
    overflow: hidden;
    background: #8c6b48;
    border-radius: 18px;
    display: flex;
    color: white;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    gap: 0;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.update-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.update-modal-close:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: scale(1.1);
}

/* =========================================
   MODAL - MEDIA (GAMBAR - ADAPTIVE)
========================================= */

.update-modal-media {
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 16px 0 0 16px;
    background: #7a5a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;

    /* ✅ ADAPTIVE: kotak ini gak punya ukuran sendiri,
       dia cuma ngebatesin (max-width/max-height) lalu
       ikut sebesar foto di dalamnya */
    min-width: 200px;
    max-width: 60%;
}

.update-modal-media img {
    /* width/height auto + max-width/max-height = foto
       tampil di rasio aslinya, gak di-crop, gak distorsi */
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 82vh;
    object-fit: contain;
}

/* Slider (2+ gambar) di dalam modal: dipaksa pakai
   display:none/block (bukan opacity) supaya gambar yang
   aktif tetap punya ukuran asli sendiri & ikut nentuin
   besar kotak ini. Konsekuensinya transisi antar-gambar
   jadi potong langsung (gak fade) khusus di dalam modal. */
.update-modal-media .img-slider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
}

.update-modal-media .img-slider img {
    position: static;
    display: none;
    opacity: 1;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 82vh;
    object-fit: contain;
}

.update-modal-media .img-slider img.active {
    display: block;
}

.update-modal-media .img-slider-dots {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    z-index: 5;
}


/* =========================================
   MODAL - CONTENT (DESKRIPSI BOX)
========================================= */

.update-modal-content {
    position: relative;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 20px 16px 16px;
    margin-bottom: 16px;
}

.update-modal-tag {
    position: absolute;
    top: -12px;
    left: 14px;
    background: #1a1a1a;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.update-modal-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    color: white;
}

.update-modal-excerpt {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    white-space: pre-wrap;
    word-break: break-word;
    word-wrap: break-word;
}

/* =========================================
   MODAL - BODY (DESKRIPSI - ADAPTIVE)
========================================= */


.update-modal-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    
    /* ✅ ADAPTIVE: Height sesuaikan dengan media */
    max-height: 90vh;
}

.update-modal-body::-webkit-scrollbar {
    width: 6px;
}

.update-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.update-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.update-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* =========================================
   MODAL - FOOTER
========================================= */

.update-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.update-modal-date {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

.update-modal-source {
    margin-left: auto;
}

/* =========================================
   RESPONSIVE - TABLET (1024px - 768px)
========================================= */

@media (max-width: 1024px) {
    .update-modal-box {
        width: min(850px, 90vw);
        max-height: 85vh;
    }

    .update-modal-media {
        max-width: 55%;
        max-height: 85vh;
    }

    .update-modal-body {
        padding: 22px 20px;
        max-height: 85vh;
    }

    .update-modal-title {
        font-size: 17px;
    }

    .update-modal-excerpt {
        font-size: 13px;
    }

    .update-modal-content {
        padding: 16px 14px 12px;
        margin-bottom: 14px;
    }
}

/* =========================================
   RESPONSIVE - MOBILE BESAR (768px - 480px)
========================================= */

@media (max-width: 768px) {
    .update-modal-box {
        width: min(95vw, 400px);
        max-height: 90vh;
        flex-direction: column;
        gap: 0;
        border-radius: 16px;
    }

    /* ✅ Mobile: Gambar full width, tinggi ikut rasio asli foto */
    .update-modal-media {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        height: auto;
        min-height: 0;
        border-radius: 16px 16px 0 0;
        margin-bottom: 0;
    }


    .update-modal-media img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 50vh;
        object-fit: contain;
    }

    .update-modal-media .img-slider {
        width: 100%;
        min-height: 0;
    }

    .update-modal-media .img-slider img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 50vh;
        object-fit: contain;
    }



    /* ✅ Mobile: Body scrollable */
    .update-modal-body {
        max-height: 40vh;
        overflow-y: auto;
        padding: 20px 18px 18px;
        flex-grow: 1;
    }

    .update-modal-close {
        width: 28px;
        height: 28px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }

    .update-modal-content {
        border: none;
        padding: 0;
        margin: 0 0 12px 0;
    }

    .update-modal-tag {
        display: none;
    }

    .update-modal-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .update-modal-excerpt {
        font-size: 13px;
        line-height: 1.5;
    }

    .update-modal-footer {
        flex-direction: row;
        align-items: center;
        padding-top: 10px;
        border-top: none;
        margin-top: auto;
    }

    .update-modal-date {
        font-size: 12px;
    }

    .update-modal-source {
        margin-left: auto;
    }
}

/* =========================================
   RESPONSIVE - MOBILE KECIL (< 480px)
========================================= */

@media (max-width: 480px) {
    .update-modal-box {
        width: 90vw;
        max-height: 92vh;
        border-radius: 14px;
    }

    .update-modal-media {
        max-height: 40vh;
    }

    .update-modal-media img {
        max-height: 40vh;
    }

    .update-modal-media .img-slider img {
        max-height: 40vh;
    }


    .update-modal-body {
        max-height: 52vh;
        padding: 18px 16px 16px;
    }

    .update-modal-close {
        width: 26px;
        height: 26px;
        font-size: 18px;
    }

    .update-modal-content {
        margin-bottom: 10px;
    }

    .update-modal-title {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .update-modal-excerpt {
        font-size: 12px;
        line-height: 1.5;
    }

    .update-modal-footer {
        gap: 6px;
        padding-top: 8px;
    }

    .update-modal-date {
        font-size: 11px;
    }

    .featured-source-badge {
        font-size: 11px;
        padding: 5px 12px;
    }
}

/* =========================================
   LINK PICKER - OVERLAY
========================================= */

.link-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1100;
    backdrop-filter: blur(4px);
}

.link-picker-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.link-picker-box {
    width: min(280px, 85vw);
    background: #8c6b48;
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

/* =========================================
   LINK PICKER - ITEMS
========================================= */

.link-picker-item {
    border: none;
    background: white;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.link-picker-item:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.link-picker-item:active {
    transform: scale(0.95);
}

@media (max-width: 480px) {
    .link-picker-box {
        width: min(260px, 80vw);
        padding: 16px;
        gap: 8px;
    }

    .link-picker-item {
        font-size: 12px;
        padding: 9px 14px;
    }
}

/* =========================================
   IMAGE SLIDER (REUSABLE)
========================================= */

.img-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.img-slider-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.img-slider img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.img-slider img.active {
    opacity: 1;
}

.img-slider-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
    z-index: 5;
}

.img-slider-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.img-slider-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.img-slider-dot.active {
    background: white;
    width: 10px;
}

/* =========================================
   PRINT STYLES
========================================= */

@media print {
    .update-nav,
    .update-modal-close,
    .featured-link {
        display: none;
    }

    .update-modal-overlay.active {
        position: static;
        background: none;
        padding: 0;
    }

    .update-modal-box {
        width: 100%;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}