/* ==========================================================================
   REVISINEWS - SIDEBAR & WIDGET POPULAR NEWS
   ========================================================================== */

.rn-sidebar-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.rn-widget {
  padding: 16px;
  border-radius: var(--rn-radius);
  background-color: var(--rn-surface);
  box-shadow: var(--rn-shadow-sm);
}

.rn-widget-title {
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 4px solid var(--rn-accent);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--rn-heading);
}

/* 1. DAFTAR POPULAR NEWS -------------------------------------------------- */
.rn-popular-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rn-popular;
}

.rn-popular-list > li {
  display: block;
  counter-increment: rn-popular;
}

/* 1a. ITEM PERTAMA: KARTU BERGAMBAR */
.rn-popular-list > li:first-child .rn-popular-hero-media {
  position: relative;
  height: 200px;
  overflow: hidden;
  border-radius: var(--rn-radius);
  background-color: var(--rn-heading);
}

.rn-popular-list > li:first-child .rn-popular-hero-media .wp-block-post-featured-image,
.rn-popular-list > li:first-child .rn-popular-hero-media a {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
}

.rn-popular-list > li:first-child .rn-popular-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.rn-popular-list > li:first-child:hover .rn-popular-hero-media img {
  transform: scale(1.05);
}

.rn-popular-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  background: linear-gradient(
    to top,
    rgba(200, 30, 30, 0.97) 0%,
    rgba(190, 28, 28, 0.82) 45%,
    rgba(9, 14, 24, 0.35) 100%
  );
}

.rn-popular-hero-rank {
  margin-bottom: 2px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

.rn-popular-hero-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.rn-popular-hero-title a {
  display: -webkit-box;
  overflow: hidden;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.rn-popular-hero-title a:hover {
  color: #ffffff;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.rn-popular-hero-meta {
  margin-top: 6px;
}

.rn-popular-hero-meta .rn-views-count {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
}

.rn-popular-list > li:first-child .rn-popular-list-body {
  display: none;
}

/* 1b. ITEM BERIKUTNYA: DAFTAR BERURUT NOMOR */
.rn-popular-list > li:not(:first-child) {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rn-border);
}

.rn-popular-list > li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.rn-popular-list > li:not(:first-child) .rn-popular-hero-media {
  display: none;
}

.rn-popular-list > li:not(:first-child) .rn-popular-list-body {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.rn-popular-num {
  flex-shrink: 0;
  width: 26px;
  padding-top: 1px;
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  color: var(--rn-text-muted);
}

.rn-popular-list > li:not(:first-child) .rn-popular-num::before {
  content: '#' counter(rn-popular);
}

.rn-popular-text {
  min-width: 0;
}

.rn-popular-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.38;
}

.rn-popular-title a {
  display: -webkit-box;
  overflow: hidden;
  color: var(--rn-heading);
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.rn-popular-title a:hover {
  color: var(--rn-accent);
}

.rn-popular-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--rn-text-muted);
}

.rn-popular-meta .wp-block-post-date {
  margin: 0;
  font-size: inherit;
  color: inherit;
}

.rn-popular-meta .rn-views-count {
  color: inherit;
}

/* Angka view: paragraf yang diisi block binding `revisinews/post-views`. */
.rn-views-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--rn-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Ikon mata dekoratif: tidak dibaca pembaca layar, ikut warna teks. */
.rn-views-count::before {
  content: '';
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  background-color: currentColor;
  opacity: 0.7;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 12S5.5 5 12 5s10.5 7 10.5 7-4 7-10.5 7S1.5 12 1.5 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 12S5.5 5 12 5s10.5 7 10.5 7-4 7-10.5 7S1.5 12 1.5 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* 2. SLOT IKLAN ----------------------------------------------------------- */
.rn-ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 250px;
  border: 1px dashed var(--rn-border-strong);
  border-radius: var(--rn-radius-sm);
  background-color: var(--rn-surface-alt);
  color: var(--rn-text);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
  text-transform: uppercase;
}

/* 3. RESPONSIF ----------------------------------------------------------- */
@media screen and (max-width: 900px) {
  .rn-widget {
    padding: 14px;
  }
}
