/**
 * SBL Accessibility Plugin — Stylesheet
 * LPPL Radio Suara Bumi Lasinrang 92.4 FM Kabupaten Pinrang
 * Standar WCAG 2.1 & Permenkominfo Pelayanan Publik Inklusif
 */

/* Container root tidak memakan ruang layout halaman sama sekali */
#sbl-a11y-root {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: visible;
  z-index: 999990;
}

/* Tombol Floating di Sisi Kiri Layar */
.sbl-a11y-trigger-btn {
  position: fixed;
  left: 0;
  top: 48%;
  transform: translateY(-50%);
  z-index: 999991;
  background: linear-gradient(135deg, #005ce6 0%, #0284c7 100%);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-left: none;
  border-radius: 0 12px 12px 0;
  padding: 10px 14px 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 2px 4px 18px rgba(0, 92, 230, 0.4);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  font-family: inherit;
}

.sbl-a11y-trigger-btn:hover {
  transform: translateY(-50%) translateX(4px);
  box-shadow: 4px 6px 24px rgba(0, 92, 230, 0.55);
  background: linear-gradient(135deg, #004ecc 0%, #0274b0 100%);
}

.sbl-a11y-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.sbl-a11y-trigger-text {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Backdrop Gelap Transparan */
.sbl-a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 999992;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sbl-a11y-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Panel Drawer Geser dari Kiri */
.sbl-a11y-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 310px;
  max-width: 86vw;
  background: #ffffff;
  z-index: 999995;
  box-shadow: 6px 0 35px rgba(0, 0, 0, 0.25);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  font-family: inherit;
  box-sizing: border-box;
}

.sbl-a11y-panel.is-open {
  transform: translateX(0);
}

/* Header Panel */
.sbl-a11y-header {
  background: linear-gradient(135deg, #005ce6 0%, #0284c7 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 92, 230, 0.2);
  flex-shrink: 0;
}

.sbl-a11y-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
}

.sbl-a11y-close-btn {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease;
  padding: 0;
}

.sbl-a11y-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Body Panel */
.sbl-a11y-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

.sbl-a11y-intro {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0 0 12px 0;
  line-height: 1.45;
}

.sbl-a11y-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sbl-a11y-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  color: #1e293b;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.sbl-a11y-item:hover {
  background: #eff6ff;
  border-color: #38bdf8;
  color: #0284c7;
}

.sbl-a11y-item.is-active {
  background: linear-gradient(135deg, #005ce6 0%, #0284c7 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.sbl-a11y-item-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sbl-a11y-item-text {
  flex: 1;
  white-space: nowrap;
}

.sbl-a11y-item-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 5px;
  background: #e2e8f0;
  color: #64748b;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sbl-a11y-item.is-active .sbl-a11y-item-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Footer / Tombol Reset */
.sbl-a11y-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.sbl-a11y-reset-btn {
  width: 100%;
  padding: 10px 14px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.18s ease;
  font-family: inherit;
}

.sbl-a11y-reset-btn:hover {
  background: #fecaca;
  color: #991b1b;
}

/* Garis Panduan Baca */
.sbl-a11y-reading-bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(239, 68, 68, 0.85);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  z-index: 999998;
  pointer-events: none;
  display: none;
  top: 50%;
}

html.a11y-reading-guide .sbl-a11y-reading-bar {
  display: block;
}

/* ========================================================
   GLOBAL A11Y EFFECT CLASSES (DIAPLIKASIKAN KE <html>)
   ======================================================== */
html.a11y-grayscale {
  filter: grayscale(100%) !important;
}

html.a11y-invert {
  filter: invert(100%) hue-rotate(180deg) !important;
  background: #000000 !important;
}

html.a11y-invert img,
html.a11y-invert video,
html.a11y-invert iframe,
html.a11y-invert .news-card-thumb,
html.a11y-invert .headline-news-card {
  filter: invert(100%) hue-rotate(180deg) !important;
}

html.a11y-brightness {
  filter: brightness(125%) contrast(112%) !important;
}

html.a11y-font-bold * {
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
}

html.a11y-highlight-links a {
  text-decoration: underline 3px !important;
  text-underline-offset: 4px !important;
  background-color: #fef08a !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border-radius: 2px !important;
}

html.a11y-highlight-headings h1,
html.a11y-highlight-headings h2,
html.a11y-highlight-headings h3,
html.a11y-highlight-headings h4,
html.a11y-highlight-headings h5,
html.a11y-highlight-headings h6 {
  outline: 2px solid #0284c7 !important;
  outline-offset: 3px !important;
  background: rgba(2, 132, 199, 0.09) !important;
  border-radius: 4px !important;
}

/* Kursor besar putih */
html.a11y-cursor-white,
html.a11y-cursor-white * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpolygon points='6,3 6,34 16,24 23,39 29,36 21,21 33,21' fill='%23ffffff' stroke='%23000000' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E"), auto !important;
}

/* Kursor besar hitam */
html.a11y-cursor-black,
html.a11y-cursor-black * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpolygon points='6,3 6,34 16,24 23,39 29,36 21,21 33,21' fill='%23000000' stroke='%23ffffff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E"), auto !important;
}

/* Check Alt Image Tooltip */
html.a11y-check-alt img {
  outline: 2px dashed #10b981 !important;
  outline-offset: 2px !important;
}

/* Dark Mode Overrides */
[data-theme="dark"] .sbl-a11y-panel {
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 6px 0 35px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .sbl-a11y-item {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

[data-theme="dark"] .sbl-a11y-item:hover {
  background: #334155;
  color: #38bdf8;
}

[data-theme="dark"] .sbl-a11y-item-badge {
  background: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .sbl-a11y-intro {
  color: #94a3b8;
}

[data-theme="dark"] .sbl-a11y-footer {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .sbl-a11y-reset-btn {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

@media (max-width: 640px) {
  .sbl-a11y-trigger-btn {
    padding: 8px 10px 8px 6px;
    top: 55%;
  }
  .sbl-a11y-trigger-text {
    display: none;
  }
}
