/* Live search dropdown — articles header */
.berita-search-wrap {
  position: relative;
}

.berita-search-panel {
  position: relative;
}

.berita-search-backdrop {
  display: none;
}

.berita-search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.berita-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: hsl(var(--secondary-foreground));
  z-index: 1;
  line-height: 0;
}

.berita-search-input {
  padding-left: 2.5rem;
}

.berita-search-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin-left: 0.375rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.berita-search-close-btn:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.berita-search-mobile-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.berita-search-mobile-btn:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.berita-search-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(28rem, calc(100vw - 2rem));
  min-width: 22rem;
  z-index: 60;
  max-height: min(460px, 70vh);
  overflow-y: auto;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--popover));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  padding: 0.625rem;
}

.berita-search-dropdown.hidden {
  display: none;
}

body.berita-search-open {
  overflow: hidden;
}

@media (max-width: 699px) {
  .berita-search-mobile-btn {
    display: inline-flex;
  }

  .berita-search-field {
    display: none;
  }

  .berita-search-wrap--expanded {
    position: static;
  }

  .berita-search-wrap--expanded .berita-search-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
  }

  .berita-search-wrap--expanded .berita-search-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 210;
    padding: 0.875rem 1rem;
    padding-top: max(0.875rem, env(safe-area-inset-top));
    background: hsl(var(--background));
    border-bottom: 1px solid hsl(var(--border));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }

  .berita-search-wrap--expanded .berita-search-mobile-btn {
    display: none;
  }

  .berita-search-wrap--expanded .berita-search-field {
    display: flex;
  }

  .berita-search-wrap--expanded .berita-search-close-btn {
    display: inline-flex;
  }

  .berita-search-wrap--expanded .berita-search-input {
    flex: 1;
    min-width: 0;
  }

  .berita-search-wrap--expanded .berita-search-dropdown {
    position: fixed;
    top: calc(3.75rem + env(safe-area-inset-top, 0px));
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    width: auto;
    min-width: 0;
    max-height: calc(100vh - 5rem - env(safe-area-inset-top, 0px));
    z-index: 210;
  }
}

.berita-search-results {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.berita-search-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.375rem 0;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}

.berita-search-item:hover {
  background: hsl(var(--accent) / 0.45);
}

.berita-search-item__thumb {
  width: 5.75rem;
  height: 4.25rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  object-fit: cover;
}

.berita-search-item__body {
  min-width: 0;
  flex: 1;
}

.berita-search-item__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.berita-search-item .berita-badge {
  padding: 0.0625rem 0.3125rem;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.berita-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0.375rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.4;
}

.berita-badge--kategori {
  background: hsl(var(--info) / 0.2);
  color: hsl(var(--info));
  border: 1px solid hsl(var(--info) / 0.35);
}

.berita-badge--tag {
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / 0.3);
}

.berita-search-item__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  line-clamp: 1;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.berita-search-item:hover .berita-search-item__title {
  color: hsl(var(--primary));
}

.berita-search-item__excerpt {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.berita-search-item__date {
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground) / 0.75);
}

.berita-search-empty {
  padding: 1rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* Mobile hamburger menu */
.berita-mobile-menu.offcanvas {
  --bs-offcanvas-width: min(100%, 20rem);
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  border-left: 1px solid hsl(var(--border));
}

.berita-mobile-menu.offcanvas-end {
  top: 0;
  bottom: 0;
  height: 100%;
  max-height: 100%;
}

.berita-mobile-menu .offcanvas-header,
.berita-mobile-menu .offcanvas-body {
  display: none;
}

.berita-mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
}

.berita-mobile-menu__brand {
  min-width: 0;
}

.berita-mobile-menu__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.berita-mobile-menu__close:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--primary) / 0.4);
}

.berita-mobile-menu__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.berita-mobile-menu__nav {
  flex: 1;
  padding: 1rem 0.75rem;
}

.berita-mobile-menu__link,
.berita-mobile-menu__accordion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.berita-mobile-menu__link:hover,
.berita-mobile-menu__accordion:hover {
  background: hsl(var(--accent) / 0.5);
  color: hsl(var(--primary));
}

.berita-mobile-menu__link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.berita-mobile-menu__link-icon--dot {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--primary));
}

.berita-mobile-menu__dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 9999px;
  background: currentColor;
}

.berita-mobile-menu__section {
  margin-top: 0.25rem;
}

.berita-mobile-menu__accordion {
  text-align: left;
}

.berita-mobile-menu__chevron {
  margin-left: auto;
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
  transition: transform 0.2s ease;
}

.berita-mobile-menu__chevron--open {
  transform: rotate(180deg);
}

.berita-mobile-menu__sub {
  margin: 0.25rem 0 0.5rem 3rem;
  padding-left: 0.75rem;
  border-left: 2px solid hsl(var(--border));
}

.berita-mobile-menu__sublink {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.berita-mobile-menu__sublink:hover {
  color: hsl(var(--primary));
  background: hsl(var(--accent) / 0.35);
}

.berita-mobile-menu__sublink--parent {
  font-weight: 700;
  color: hsl(var(--foreground));
}

.berita-mobile-menu__footer {
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

.berita-mobile-menu__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.berita-mobile-menu__cta:hover {
  background: hsl(var(--primary) / 0.9);
  color: hsl(var(--primary-foreground));
}

.berita-mobile-menu-btn {
  flex-shrink: 0;
}

/* Comment form */
.berita-comment-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.berita-comment-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .berita-comment-form__row {
    grid-template-columns: 1fr;
  }
}

.berita-comment-field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.berita-comment-field input,
.berita-comment-field textarea {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
}

.berita-comment-field input::placeholder,
.berita-comment-field textarea::placeholder {
  color: hsl(60 9% 75%);
  opacity: 1;
}

.berita-comment-field input:focus,
.berita-comment-field textarea:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.25);
}

.berita-comment-submit {
  align-self: flex-start;
  margin-top: 0.25rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
