/*
 * ============================================================
 * Общинска банка — Виджет за достъпност
 * Версия: 1.5  |  WCAG 2.1 AA / 2.2  |  EU Accessibility Act
 * ============================================================
 */

/* ── Google Fonts & OpenDyslexic ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap');
@import url('https://fonts.cdnfonts.com/css/opendyslexic');

/* Removed initial !important that was blocking specific font sizes */
#mb-a11y-fab,
#mb-a11y-panel,
#mb-a11y-tooltip {
  /* Protection from parent scaling */
}
#mb-a11y-wrapper * {
  font-family: var(--mb-font) !important;
}

/* ── Design Tokens ── */
:root {
  --mb-navy:        #00B1EB;
  --mb-navy2:       #009DD4;
  --mb-gold:        #00B1EB;
  --mb-gold-light:  #33C4F0;
  --mb-cream:       #f0f9fd;
  --mb-white:       #ffffff;
  --mb-text:        #1a1a2e;
  --mb-muted:       #6b7280;
  --mb-border:      #d8e8f0;
  --mb-shadow:      0 24px 64px rgba(0,177,235,.18), 0 4px 16px rgba(0,177,235,.10);
  --mb-panel-bg:    #B2C6D9;
  --mb-font:        'Noto Sans', sans-serif;
}

/* ══════════════════════════════════════════
   WRAPPER
══════════════════════════════════════════ */
#mb-a11y-wrapper {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2147483000;
  overflow: visible;
  isolation: isolate;
}
#mb-a11y-wrapper > * {
  pointer-events: auto;
}

/* ══════════════════════════════════════════
   FAB BUTTON
══════════════════════════════════════════ */
#mb-a11y-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--mb-navy);
  box-shadow: 0 8px 28px rgba(0,177,235,.38), 0 2px 8px rgba(0,177,235,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s;
}
#mb-a11y-fab::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.7);
  opacity: .7;
  transition: opacity .22s;
}
#mb-a11y-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(0,177,235,.45);
}
#mb-a11y-fab:hover::after { opacity: 1; }
#mb-a11y-fab svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
}

#mb-a11y-tooltip {
  position: fixed;
  bottom: 96px;
  right: 20px;
  background: var(--mb-navy);
  color: #ffffff;
  font-family: var(--mb-font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  padding: 5px 11px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
#mb-a11y-fab:hover + #mb-a11y-tooltip { opacity: 1; transform: translateY(0); }

/* ══════════════════════════════════════════
   PANEL
══════════════════════════════════════════ */
#mb-a11y-panel {
  position: fixed;
  bottom: 98px;
  right: 28px;
  width: 280px;
  height: auto;
  max-height: min(600px, calc(100vh - 110px));
  background: var(--mb-panel-bg);
  border-radius: 16px;
  box-shadow: var(--mb-shadow);
  font-family: var(--mb-font);
  transform: translateY(18px) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.3,.64,1), opacity .22s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#mb-a11y-panel.mb-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.mb-pb {
  padding: 10px 14px 14px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--mb-navy) transparent;
}
.mb-pb::-webkit-scrollbar {
  width: 6px;
  display: block;
}
.mb-pb::-webkit-scrollbar-track {
  background: transparent;
}
.mb-pb::-webkit-scrollbar-thumb {
  background-color: var(--mb-navy);
  border-radius: 10px;
}
.mb-ph {
  background: var(--mb-navy);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 16px 16px 0 0;
}
.mb-ph-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}
.mb-ph-title {
  font-family: var(--mb-font);
  font-size: 14px; /* Increased back to 14px */
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0;
}
.mb-ph-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mb-ph-close svg { width: 10px; height: 10px; stroke: #fff; fill: none; stroke-width: 2.5; }
/* .mb-ph-sub removed */

/* Desktop-only utility */
.mb-desktop-only { display: block; }
@media (max-width: 1023px) {
  .mb-desktop-only { display: none !important; }
}

/* MOBILE & TABLET STYLES */
@media (max-width: 1024px) {
  #mb-a11y-wrapper {
    position: fixed !important;
    inset: auto auto 0 0 !important; /* Bottom Left */
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important;
    z-index: 2147483647 !important;
  }
  #mb-a11y-panel {
    width: calc(100% - 40px);
    max-width: 280px;
    height: auto;
    max-height: 80vh;
    left: 20px;
    right: auto;
    bottom: 160px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  }
  .mb-ph-main {
    align-items: center;
  }
  .mb-ph-title {
    font-size: 16px;
  }
  .mb-ph-sub {
    font-size: 10px;
  }
  #mb-a11y-fab {
    display: flex !important;
    position: fixed !important;
    width: 50px !important;
    height: 50px !important;
    bottom: 100px !important;
    left: 20px !important;
    right: auto !important;
    z-index: 2147483647 !important;
    visibility: visible !important;
    background: #00B1EB !important;
    background: var(--mb-navy) !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #mb-a11y-fab svg {
    width: 24px !important;
    height: 24px !important;
    fill: #ffffff !important;
    display: block !important;
  }
  #mb-a11y-tooltip { display: none; }
  .mb-pb {
    max-height: calc(50vh - 75px);
    padding: 10px 12px;
  }
  .mb-trow {
    padding: 4px 0;
  }
  .mb-sec {
    margin: 10px 0 6px;
  }
}

/* Sections & Rows */
.mb-sec {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: #004884;
  margin: 12px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.mb-sec::after { content: ''; flex: 1; height: 1px; background: var(--mb-border); }
.mb-sec:first-child { margin-top: 0; }

/* Feature Card (Button) */
.mb-feat-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  margin-bottom: 8px;
  background: var(--mb-white);
  border: none; /* Removed borders */
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-align: left;
}
.mb-feat-card:hover {
  background: #f0f7ff;
}
.mb-feat-card.mb-on {
  background: #009dd4;
  border: none;
  box-shadow: 0 4px 10px rgba(0, 157, 212, 0.3);
}
.mb-feat-card.mb-on .mb-feat-name,
.mb-feat-card.mb-on .mb-feat-icon {
  color: #fff;
}
.mb-feat-icon {
  width: 28px; /* Slightly smaller icon to match reduced height */
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #009dd4;
  transition: color 0.2s;
}
.mb-feat-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.mb-feat-name {
  font-size: 14px; /* Increased to 14px */
  font-weight: 500;
  color: var(--mb-text);
  line-height: 1.2;
  transition: color 0.2s;
}

/* Sliders */
.mb-srow {
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--mb-white);
  border: none; /* Removed borders */
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.mb-srow-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.mb-srow-name {
  font-size: 14px; /* Increased to 14px */
  font-weight: 500;
  color: var(--mb-text);
}
.mb-srow-val {
  font-size: 11px; /* Increased back */
  font-weight: 700;
  color: var(--mb-navy);
  background: var(--mb-cream);
  padding: 2px 8px;
  border-radius: 20px;
}
.mb-srow input[type="range"] {
  width: 100%;
  height: 8px; /* Slightly thicker track as in image */
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--mb-navy) var(--pct, 0%), rgba(148, 147, 147, 0.3) var(--pct, 0%));
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
.mb-srow input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--mb-white);
  border: 2px solid var(--mb-navy);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.1s;
}
.mb-srow input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Reset */
.mb-reset {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1.5px solid #feb2b2;
  background: #fff5f5;
  cursor: pointer;
  font-size: 14px; /* Increased back to 14px */
  font-weight: 500;
  color: #c53030;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}
.mb-reset:hover {
  background: #fff;
  border-color: #c53030;
  box-shadow: 0 4px 6px rgba(197, 48, 48, 0.1);
}
.mb-reset svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.mb-others-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin: 12px 0 8px;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--mb-font);
  font-size: 14px; /* Set to 14px */
  font-weight: 500; /* Matching others */
  color: var(--mb-text);
  transition: background 0.2s;
}
.mb-others-toggle:hover {
  background: rgba(255, 255, 255, 0.6);
}
#mb-others-container {
  padding-top: 4px;
}

/* Dyslexia Font */
body.mb-dyslexia-font, body.mb-dyslexia-font * {
  font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
  line-height: 2 !important;
  word-spacing: 0.18em !important;
  letter-spacing: 0.05em !important;
}
body.mb-dyslexia-font #mb-a11y-panel,
body.mb-dyslexia-font #mb-a11y-panel *,
body.mb-dyslexia-font #mb-a11y-fab,
body.mb-dyslexia-font #mb-a11y-tooltip {
  font-family: var(--mb-font) !important;
  line-height: normal !important;
  word-spacing: normal !important;
  letter-spacing: initial !important;
}

/* Big Buttons */
body.mb-big-buttons button,
body.mb-big-buttons input[type="button"],
body.mb-big-buttons input[type="submit"],
body.mb-big-buttons .btn,
body.mb-big-buttons a.button,
body.mb-big-buttons .mb-feat-card,
body.mb-big-buttons .mb-srow {
  font-size: 125% !important;
  padding: 18px 24px !important;
  min-height: 56px !important;
}
body.mb-big-buttons .mb-feat-name,
body.mb-big-buttons .mb-srow-name {
  font-size: 110% !important;
}

/* Focus Highlight */
body.mb-focus-highlight *:focus,
body.mb-focus-highlight *:focus-visible {
  outline: 4px solid #00B1EB !important; /* Sky Blue for visibility */
  outline-offset: 4px !important;
  box-shadow: 0 0 0 8px rgba(0, 177, 235, 0.4), 0 0 0 12px rgba(0, 177, 235, 0.2) !important;
  z-index: 9999999 !important; /* Ensure it stays above other elements */
}
/* Ensure widget elements also follow the strong focus rule */
body.mb-focus-highlight #mb-a11y-wrapper *:focus,
body.mb-focus-highlight #mb-a11y-wrapper *:focus-visible {
  outline: 3px solid #00B1EB !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(0, 177, 235, 0.3) !important;
}

/* Reading Mask */
#mb-reading-mask {
  position: fixed; inset: 0; pointer-events: none; display: none; z-index: 9998;
}
#mb-reading-mask.mb-active { display: block; }
#mb-reading-mask .mb-mask-top,
#mb-reading-mask .mb-mask-bottom {
  position: fixed; left: 0; right: 0; width: 100%;
  background: rgba(0,0,0,.75);
}
#mb-reading-mask .mb-mask-top { top: 0; height: 0; }
#mb-reading-mask .mb-mask-bottom { bottom: 0; height: 0; }
#mb-reading-mask .mb-mask-line {
  position: fixed; left: 5%; right: 5%; height: 90px; top: 0;
  border: 3px solid var(--mb-gold); border-radius: 8px;
  box-shadow: 0 0 20px rgba(0,177,235,.4);
}

/* Invert Colors */
body.mb-invert-colors {
  filter: invert(1) hue-rotate(180deg) !important;
}
/* Ensure the widget wrapper stays on top and clickable */
#mb-a11y-wrapper {
  z-index: 2147483647 !important;
}