/* Reset dan body dasar */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: #ffffff;
  overflow-x: hidden;
}

/* Header */
.header {
  background-color: #673A8B;
  padding: 1rem;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
  width: 60px;
  height: 60px;
  margin-right: 10px;
  border-radius: 50%;
}

.logo-text {
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
}

#main-page {
  margin-top: 100px;
}

/* Berita Utama Section */
.berita-utama-section {
  padding: 2rem 1rem;
  background-color: #ffffff;
  margin-bottom: 2rem;
}

.section-header {
  font-size: 2rem;
  color: #673A8B;
  font-weight: bold;
  margin-bottom: 2rem;
  text-align: center;
}

/* Container untuk berita utama - menggunakan flexbox yang lebih fleksibel */
.berita-utama-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  align-items: stretch;
}

/* Card styling yang diperbaiki */
.card, .card-terbaru {
  flex: 0 0 auto;
  width: 280px;
  background: linear-gradient(145deg, #673A8B, #543572);
  color: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(103, 58, 139, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.card:hover, .card-terbaru:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(103, 58, 139, 0.4);
}

.card-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
  position: relative;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-image img,
.card-terbaru:hover .card-image img {
  transform: scale(1.05);
}

.card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-date {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.card-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 1rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-button {
  background: linear-gradient(45deg, #4C2E6C, #673A8B);
  color: white;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: auto;
}

.card-button:hover {
  background: linear-gradient(45deg, #3a2452, #543572);
  transform: translateY(-2px);
}

/* Berita Terbaru */
.berita-terbaru {
  background: linear-gradient(135deg, rgba(103, 58, 139, 0.1), rgba(103, 58, 139, 0.05));
  margin: 2rem 1rem;
  border-radius: 25px;
  padding: 2.5rem 2rem;
}

.berita-terbaru-header {
  font-size: 1.8rem;
  color: #673A8B;
  font-weight: bold;
  margin-bottom: 2rem;
  text-align: center;
}

.berita-terbaru-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
}

.card-terbaru {
  width: 280px;
}

/* Back button */
.back-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
}

.btn-back {
  background: linear-gradient(45deg, #543572, #673A8B);
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(103, 58, 139, 0.3);
}

.btn-back:hover {
  background: linear-gradient(45deg, #432a5a, #543572);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(103, 58, 139, 0.4);
}

/* Indikator scroll - hidden di desktop */
.scroll-indicator {
  display: none;
}

/* Halaman Detail Berita - PERBAIKAN: Hilangkan gap putih dengan header sendiri */
.berita-detail-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: #ffffff;
  z-index: 2000;
  overflow: hidden;
}

/* Header untuk detail page */
.detail-header {
  background-color: #673A8B;
  padding: 1rem;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.berita-detail-container {
  display: flex;
  height: 100vh;
  padding-top: 100px;
}

/* Bagian Gambar (Kiri) */
.image-section {
  width: 50%;
  height: calc(100vh - 100px);
  background-color: #f8f9fa;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-slider {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Gambar Utama */
.main-image-container {
  flex: 1;
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  background: #fff;
}

#current-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
  display: block;
}

.slider-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}

.slider-btn {
  background: rgba(103, 58, 139, 0.8);
  color: white;
  border: none;
  padding: 15px 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
  pointer-events: all;
}

.slider-btn:hover {
  background: rgba(103, 58, 139, 1);
  transform: scale(1.1);
}

/* Thumbnail Gallery */
.thumbnail-gallery {
  height: 120px;
  background: rgba(103, 58, 139, 0.1);
  border-radius: 10px;
  padding: 10px;
  overflow: hidden;
}

.thumbnail-container {
  display: flex;
  gap: 10px;
  height: 100%;
  overflow-x: auto;
  padding: 5px 0;
}

.thumbnail-container::-webkit-scrollbar {
  height: 4px;
}

.thumbnail-container::-webkit-scrollbar-thumb {
  background: #673A8B;
  border-radius: 2px;
}

.thumbnail-container::-webkit-scrollbar-track {
  background: rgba(103, 58, 139, 0.1);
}

.thumbnail-item {
  flex: 0 0 auto;
  width: 90px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
}

.thumbnail-item:hover {
  transform: scale(1.05);
  border-color: rgba(103, 58, 139, 0.5);
}

.thumbnail-item.active {
  border-color: #673A8B;
  transform: scale(1.1);
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.thumbnail-item:not(.active) img {
  opacity: 0.7;
}

.thumbnail-item.active img {
  opacity: 1;
}

/* Bagian Konten (Kanan) */
.content-section {
  width: 50%;
  height: calc(100vh - 100px);
  background-color: white;
  position: relative;
  display: flex;
  flex-direction: column;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  padding-bottom: 120px;
}

.content-scroll::-webkit-scrollbar {
  width: 8px;
}

.content-scroll::-webkit-scrollbar-thumb {
  background-color: #673A8B;
  border-radius: 4px;
}

#berita-title {
  color: #673A8B;
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

#berita-content p {
  color: #333;
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  text-align: justify;
}

/* Tombol kembali yang melayang - diperbaiki agar selalu terlihat */
.close-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(45deg, #673A8B, #8A4FB8);
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(103, 58, 139, 0.4);
  z-index: 3000;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.close-btn:hover {
  background: linear-gradient(45deg, #8A4FB8, #A569C7);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 35px rgba(103, 58, 139, 0.6);
}

.close-btn:active {
  transform: translateY(-1px) scale(1.02);
}

/* Responsive */
@media (max-width: 1200px) {
  .berita-utama-container {
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .berita-utama-container {
    justify-content: center;
  }
}

/* Responsive untuk mobile - Slider horizontal */
@media (max-width: 768px) {
  /* Mobile slider untuk berita utama */
  .berita-utama-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .berita-utama-container::-webkit-scrollbar {
    height: 6px;
  }

  .berita-utama-container::-webkit-scrollbar-thumb {
    background: #673A8B;
    border-radius: 3px;
  }

  .berita-utama-container::-webkit-scrollbar-track {
    background: rgba(103, 58, 139, 0.1);
  }

  .card {
    flex: 0 0 280px;
    scroll-snap-align: center;
  }

  /* Mobile slider untuk berita terbaru */
  .berita-terbaru-cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .berita-terbaru-cards::-webkit-scrollbar {
    height: 6px;
  }

  .berita-terbaru-cards::-webkit-scrollbar-thumb {
    background: #673A8B;
    border-radius: 3px;
  }

  .berita-terbaru-cards::-webkit-scrollbar-track {
    background: rgba(103, 58, 139, 0.1);
  }

  .card-terbaru {
    flex: 0 0 280px;
    scroll-snap-align: center;
  }

  /* Show scroll indicator untuk mobile */
  .scroll-indicator {
    display: block;
    text-align: center;
    color: #673A8B;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
    font-style: italic;
  }

  /* Berita detail untuk mobile */
  .berita-detail-container {
    flex-direction: column;
    padding-top: 100px;
  }
  
  .image-section {
    width: 100%;
    height: 45vh;
    background-color: #f8f9fa;
  }
  
  .content-section {
    width: 100%;
    height: 55vh;
  }
  
  .thumbnail-gallery {
    height: 80px;
  }
  
  .thumbnail-item {
    width: 60px;
    height: 60px;
  }

  .content-scroll {
    padding: 1.5rem;
    padding-bottom: 100px;
  }

  #berita-title {
    font-size: 1.6rem;
  }

  #berita-content p {
    font-size: 1rem;
  }

  /* Tombol kembali untuk mobile */
  .close-btn {
    bottom: 20px;
    right: 20px;
    padding: 12px 25px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .card, .card-terbaru {
    flex: 0 0 250px;
  }

  .section-header {
    font-size: 1.6rem;
  }
  
  .berita-terbaru-header {
    font-size: 1.5rem;
  }

  .berita-utama-section, .berita-terbaru {
    padding: 1.5rem 0.5rem;
    margin: 1rem 0.5rem;
  }

  /* Tombol kembali lebih kecil untuk layar sangat kecil */
  .close-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    bottom: 15px;
    right: 15px;
  }
}