/* ==========================================================================
   Insider Widget — Tirto.id Clone
   Layout: 40:60 Split Desktop
   ========================================================================== */

.insider-widget {
    background: #fff;
    padding-top: 14px;
    padding-bottom: 8px;
    margin-top: 22px;
    margin-bottom: 22px;
    font-family: 'Inter', Arial, Roboto, sans-serif;
    box-sizing: border-box;
}

.insider-widget *,
.insider-widget *::before,
.insider-widget *::after {
    box-sizing: border-box;
}

.insider-widget-inner {
    max-width: 1033px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* Header Kiri Kanan */
.insider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    padding-bottom: 14px;
    margin-bottom: 20px;
    border-top: 1px solid #2b2b2b;
    border-bottom: 1px dotted #ccc;
}

.insider-title-main {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin: 0;
    line-height: 1.2;
}

.insider-more {
    font-size: 14px;
    color: #2d5bd1;
    text-decoration: none;
    font-weight: 500;
}
.insider-more:hover {
    text-decoration: underline;
}

/* ==========================================================================
   LAYOUT GRID UTAMA (Kiri vs Kanan)
   ========================================================================== */
.insider-layout {
    display: grid;
    grid-template-columns: minmax(380px, 420px) 1fr;
    gap: 30px;
    align-items: start;
}

/* ==========================================================================
   KIRI: HEADLINE BESAR
   ========================================================================== */
.insider-main {
    display: flex;
    flex-direction: column;
    padding-right: 20px; /* Spasi sebelum separator vertikal */
    border-right: 1px solid #f2f2f2; /* Separator Vertikal antara Kiri & Kanan */
}

.insider-main-article {
    display: flex;
    flex-direction: column;
}

.insider-main-imglink {
    display: block;
    margin-bottom: 12px;
    border-radius: 4px;
    overflow: hidden;
}

.insider-main-thumb {
    margin: 0;
    padding: 0;
    line-height: 0;
    background: #f0f0f0;
    aspect-ratio: 16 / 9;
}
.insider-main-thumb img,
.insider-main-thumb .imageload-wrapper {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}
.insider-main-article:hover .insider-main-thumb img,
.insider-main-article:hover .insider-main-thumb .imageload-wrapper {
    transform: scale(1.03);
}

.insider-main-content {
    display: flex;
    flex-direction: column;
}

.insider-meta {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    line-height: 1;
}

.insider-category {
    font-size: 13px;
    color: #2f5fd3;
    font-weight: 600;
    text-decoration: none;
}
.insider-category:hover {
    text-decoration: underline;
}

.insider-meta-sep {
    margin: 0 6px;
    color: #ccc;
    font-size: 11px;
}

.insider-time {
    font-size: 12px;
    color: #777;
    margin-left: 2px;
}

.insider-main-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: #111;
    margin: 0 0 8px;
}
.insider-main-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.insider-main-article:hover .insider-main-title a {
    color: #0d47a1;
}

.insider-excerpt {
    font-size: 15px;
    color: #444;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   KANAN: GRID BERITA KECIL
   ========================================================================== */
.insider-side {
    display: grid;
    row-gap: 20px;
    column-gap: 0;
}

/* Konfigurasi Kolom Dinamis via Class */
.insider-side.cols-1 { grid-template-columns: 1fr; }
.insider-side.cols-2 { grid-template-columns: 1fr 1fr; }
.insider-side.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* 
   Border & Gap Simulation untuk Grid Kolom
   Untuk membuat garis pemisah lurus antar kolom seperti tabel
*/

/* --- 2 Kolom --- */
.insider-side.cols-2 .insider-item:nth-child(even) {
    border-left: 1px solid #f2f2f2;
    padding-left: 12px;
}
.insider-side.cols-2 .insider-item:nth-child(odd) {
    padding-right: 12px;
}

/* --- 3 Kolom --- */
.insider-side.cols-3 .insider-item:not(:nth-child(3n+1)) {
    border-left: 1px solid #f2f2f2;
    padding-left: 12px;
}
.insider-side.cols-3 .insider-item:not(:nth-child(3n)) {
    padding-right: 12px;
}

.insider-item {
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
    border-bottom: 1px solid #f2f2f2;
}

/* Hapus border bawah di baris terakhir agar bersih */
.insider-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.insider-side.cols-2 .insider-item:nth-last-child(-n+2) {
    border-bottom: none;
    padding-bottom: 0;
}
.insider-side.cols-3 .insider-item:nth-last-child(-n+3) {
    border-bottom: none;
    padding-bottom: 0;
}

.insider-item-imglink {
    display: block;
    margin-bottom: 10px;
    border-radius: 4px;
    overflow: hidden;
}

.insider-item-thumb {
    margin: 0;
    padding: 0;
    line-height: 0;
    background: #f0f0f0;
    aspect-ratio: 16 / 9;
}
.insider-item-thumb img,
.insider-item-thumb .imageload-wrapper {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}
.insider-item:hover .insider-item-thumb img,
.insider-item:hover .insider-item-thumb .imageload-wrapper {
    transform: scale(1.03);
}

.insider-item-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 6px;
}
.insider-item-title a {
    color: #111;
    text-decoration: none;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.insider-item:hover .insider-item-title a {
    color: #0d47a1;
}

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

/* Tablet: Layout Vertikal */
@media (max-width: 1024px) {
    .insider-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .insider-main {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #f2f2f2;
        padding-bottom: 24px;
    }
    
    .insider-side.cols-1,
    .insider-side.cols-2,
    .insider-side.cols-3 {
        grid-template-columns: 1fr 1fr; /* Paksa 2 kolom di tablet */
    }
    
    /* Timpa aturan 3 kolom menjadi 2 kolom untuk border di tablet */
    .insider-side.cols-3 .insider-item:not(:nth-child(3n+1)) {
        border-left: none;
        padding-left: 0;
    }
    .insider-side.cols-3 .insider-item:not(:nth-child(3n)) {
        padding-right: 0;
    }
    .insider-side.cols-3 .insider-item:nth-child(even) {
        border-left: 1px solid #f2f2f2;
        padding-left: 12px;
    }
    .insider-side.cols-3 .insider-item:nth-child(odd) {
        padding-right: 12px;
    }
}

/* Mobile: Decode-style (1 Main Post + Horizontal Scroll Grid) */
@media (max-width: 768px) {
    /* Thick gray separator for widget */
    .insider-widget {
        border-top: 10px solid #f5f5f5 !important;
        border-bottom: 10px solid #f5f5f5 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-top: 20px !important;
        padding-bottom: 20px !important;
    }
    /* Header Updates */
    .insider-header {
        border-top: none !important;
        border-bottom: none !important;
        padding-top: 0;
        margin-bottom: 12px;
    }
    .insider-more {
        display: none !important;
    }
    .insider-title-main {
        font-size: 16px;
    }
    .insider-excerpt {
        display: none !important;
    }

    /* Layout Reset */
    .insider-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }
    .insider-main {
        padding-right: 0 !important;
        border-right: none !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    /* Main Featured Post */
    .insider-main-imglink {
        width: 100%;
        margin-bottom: 12px;
        display: block;
    }
    .insider-main-thumb {
        aspect-ratio: 16 / 9;
        border-radius: 6px;
        width: 100%;
    }
    .insider-main-thumb img {
        border-radius: 6px;
    }
    .insider-main-title {
        font-size: 18px !important;
        font-weight: 700;
        line-height: 1.4;
    }

    /* Small Cards Wrapper (insider-side) */
    .insider-side.mobile-rows-1row,
    .insider-side.mobile-rows-2row {
        display: grid !important;
        grid-template-columns: none !important;
        grid-auto-flow: column !important;
        grid-auto-columns: 88% !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 12px !important;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .insider-side.mobile-rows-1row {
        grid-template-rows: auto !important;
    }
    .insider-side.mobile-rows-2row {
        grid-template-rows: repeat(2, auto) !important;
    }
    .insider-side::-webkit-scrollbar {
        display: none;
    }

    /* Override tablet border/padding rules */
    .insider-side .insider-item:nth-child(even),
    .insider-side .insider-item:nth-child(odd) {
        border-left: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Small Cards Style */
    .insider-side .insider-item {
        width: 100% !important;
        max-width: none !important;
        scroll-snap-align: start;
        border: 1px solid #eee !important;
        border-radius: 10px !important;
        padding: 12px !important;
        display: grid !important;
        grid-template-columns: 1fr 100px !important; /* Text takes left, image takes exactly 100px on right */
        gap: 14px !important;
        align-items: center !important;
        margin: 0 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.02) !important;
        height: 100%;
        box-sizing: border-box;
    }

    /* Image on the right */
    .insider-side .insider-item-imglink {
        width: 100px;
        height: 75px;
        margin: 0;
        display: block;
        order: 2; /* Move image to the right column */
    }
    .insider-side .insider-item-thumb {
        height: 100%;
        border-radius: 6px;
        aspect-ratio: auto;
    }
    .insider-side .insider-item-thumb img,
    .insider-side .insider-item-thumb .imageload-wrapper {
        width: 100px;
        height: 75px;
        object-fit: cover;
        border-radius: 6px;
    }

    /* Text content on the left */
    .insider-side .insider-item-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        order: 1; /* Move text to the left column */
    }

    .insider-side .insider-meta {
        order: -1; /* Kategori & waktu di atas judul */
        margin-bottom: 6px;
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px;
    }

    .insider-side .insider-category {
        color: #2d5bd1 !important; /* Biru tebal seperti referensi */
        font-weight: 700;
        text-transform: capitalize;
    }

    .insider-side .insider-meta-sep {
        color: #ccc;
    }

    .insider-side .insider-time {
        color: #888;
    }

    .insider-side .insider-item-title {
        font-family: 'PT Serif', 'Merriweather', 'Times New Roman', serif;
        font-size: 15px !important;
        font-weight: 700;
        line-height: 1.4;
        margin: 0;
        color: #222;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .insider-side .insider-item-title a {
        color: inherit;
        text-decoration: none;
    }
}

