/* ============================================================
   ALPHA FINANS - Accessibility CSS
   WCAG 2.1 AA Compliance (targeting AAA where possible)

   Table of Contents:
   1.  CSS Custom Properties
   2.  Screen Reader Only (.sr-only)
   3.  Skip Link
   4.  Focus Indicators
   5.  High Contrast Mode
   6.  Reduced Motion
   7.  Font Size Scale (A- / A / A+)
   8.  Screen Reader Mode Enhancements
   9.  Focus Trap Overlay
   10. Live Regions
   11. Form Accessibility
   12. Touch Target Sizes
   13. Text Readability
   14. Navigation Landmarks
   15. Current Page Indicator
   16. RTL Support
   17. Accessibility Settings Panel
   18. Print Styles
   ============================================================ */

/* ============================================================
   1. CSS CUSTOM PROPERTIES
============================================================ */
:root {
  /* Odak rengi: marka mavisi (CLAUDE.md logo rengi). Site genelinde TEK renk —
     sayfa içi `:focus-visible` kuralları da bu değeri kullanır. */
  --a11y-focus-color:       #1295EB;
  --a11y-focus-shadow:      0 0 0 6px rgba(18, 149, 235, 0.25);
  --a11y-focus-width:       3px;
  --a11y-font-scale:        1;
  --a11y-hc-bg:             #000;
  --a11y-hc-text:           #fff;
  --a11y-hc-link:           #ffff00;
  --a11y-hc-border:         #fff;
  --a11y-hc-focus:          #ffff00;
  --a11y-panel-bg:          #1e2130;
  --a11y-panel-border:      rgba(255, 255, 255, 0.12);
  --a11y-panel-text:        #e0e0e0;
  --a11y-panel-accent:      #4caf50;
  --a11y-panel-toggle-off:  #555;
  --a11y-panel-toggle-on:   #4caf50;
  --a11y-panel-z:           100001;
}

/* ============================================================
   2. SCREEN READER ONLY
============================================================ */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Visible on focus (for skip links) */
.sr-only-focusable:focus,
.sr-only-focusable:active {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: inherit !important;
  margin: inherit !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: inherit !important;
}

/* ============================================================
   3. SKIP LINK
============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: calc(var(--a11y-panel-z) + 1);
  padding: 12px 24px;
  background: #0A63AC; /* sürekli-kalite: #1295EB üstünde beyaz ~3.2:1 idi; AA için koyu ton */
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 8px;
  transition: top 0.15s ease;
  line-height: 1.4;
}

.skip-link:focus {
  top: 0;
  outline: var(--a11y-focus-width) solid var(--a11y-focus-color);
  outline-offset: 2px;
}

/* ============================================================
   4. FOCUS INDICATORS
   Visible focus for keyboard navigation on every interactive element.
============================================================ */

/* Universal focus-visible
   `!important` BİLİNÇLİ: odak göstergesi bir erişilebilirlik garantisidir,
   sayfa CSS'i tarafından ezilebilir olmamalıdır (erisebilirlik.md:
   "Odak görünür olmalı (outline kaldırma YASAK)").
   Sayfa dosyalarında `.x:focus { outline: none }` gibi kurallar vardı ve
   sınıf+pseudo özgüllüğü (0,2,0) bu kuralın (0,1,0) önüne geçiyordu;
   `!important` özgüllükten bağımsız olarak bunu engeller.
   Fare kullanıcıları etkilenmez — aşağıdaki `:focus:not(:focus-visible)`
   ayrı bir seçicidir ve tarayıcı zaten :focus-visible'ı klavyeye ayırır. */
*:focus-visible {
  outline: var(--a11y-focus-width) solid var(--a11y-focus-color) !important;
  outline-offset: 2px !important;
}

/* Remove focus ring for mouse users */
*:focus:not(:focus-visible) {
  
}

/* Specific enhanced focus for key elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="option"]:focus-visible,
[role="switch"]:focus-visible,
[role="checkbox"]:focus-visible,
[role="radio"]:focus-visible,
[role="combobox"]:focus-visible,
[role="listbox"]:focus-visible,
[role="link"]:focus-visible,
[tabindex]:focus-visible {
  outline: var(--a11y-focus-width) solid var(--a11y-focus-color);
  outline-offset: 2px;
  box-shadow: var(--a11y-focus-shadow);
}

/* Keyboard navigation mode — stronger indicators */
.keyboard-nav *:focus {
  outline: var(--a11y-focus-width) solid var(--a11y-focus-color) !important;
  outline-offset: 2px !important;
}

/* Cells in tables */
.keyboard-nav td:focus,
.keyboard-nav th:focus {
  outline: var(--a11y-focus-width) solid var(--a11y-focus-color);
  outline-offset: -2px;
}

/* ============================================================
   5. HIGH CONTRAST MODE
   Activated by body.high-contrast OR OS prefers-contrast: high
============================================================ */
@media (prefers-contrast: high) {
  body:not([class*="theme-"]) {
    --a11y-hc-active: 1;
  }
}

body.high-contrast,
@media (prefers-contrast: high) {
  body {
    --text-primary:   #000;
    --text-secondary: #111;
    --bg-primary:     #fff;
    --bg-secondary:   #f0f0f0;
    --border-color:   #000;
    --focus-color:    #000080;
  }
}

body.high-contrast {
  background-color: var(--a11y-hc-bg) !important;
  color: var(--a11y-hc-text) !important;
}

body.high-contrast a {
  color: var(--a11y-hc-link) !important;
  text-decoration: underline !important;
}

body.high-contrast button,
body.high-contrast input,
body.high-contrast select,
body.high-contrast textarea {
  background-color: var(--a11y-hc-bg) !important;
  color: var(--a11y-hc-text) !important;
  border: 2px solid var(--a11y-hc-border) !important;
}

body.high-contrast *:focus-visible {
  outline: 3px solid var(--a11y-hc-focus) !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}

body.high-contrast img {
  filter: contrast(1.3) brightness(1.1);
}

/* Dark theme in high contrast */
[data-theme="dark"].high-contrast,
body[data-theme="dark"].high-contrast {
  --a11y-hc-bg:   #000;
  --a11y-hc-text: #fff;
  --a11y-hc-link: #ffff00;
}

/* OS high contrast media query */
@media (prefers-contrast: high) {
  :root {
    --text-primary:   #000;
    --text-secondary: #333;
    --bg-primary:     #fff;
    --border-color:   #000;
  }

  [data-theme="dark"] {
    --text-primary:   #fff;
    --text-secondary: #ddd;
    --bg-primary:     #000;
    --border-color:   #fff;
  }

  button,
  a,
  input,
  select,
  textarea {
    border: 2px solid currentColor;
  }

  img {
    filter: contrast(1.2);
  }
}

/* ============================================================
   6. REDUCED MOTION
============================================================ */

/* OS preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration:        0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration:       0.01ms !important;
    scroll-behavior:           auto !important;
  }
}

/* Manual toggle via body.reduced-motion */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration:        0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration:       0.01ms !important;
  scroll-behavior:           auto !important;
}

/* Ticker/marquee: stop when reduced motion is on */
body.reduced-motion [role="marquee"],
body.reduced-motion .ticker-tape,
body.reduced-motion .ticker-track {
  animation: none !important;
}

/* ============================================================
   7. FONT SIZE SCALE
   Applied via --a11y-font-scale CSS variable.
   `rem` her zaman kök (html) elementinin font-size'ına görelidir,
   body'ninkine değil — bu yüzden ölçekleme `html` üzerinde olmalı,
   aksi halde rem kullanan (neredeyse tüm) bileşenler büyümez.
============================================================ */
html {
  font-size: calc(100% * var(--a11y-font-scale, 1));
}

/* ============================================================
   7b. RENK KÖRLÜĞÜ MODU
   body[data-color-blind="protanopia" | "deuteranopia" | "tritanopia"]

   Piksel filtresi (filter: url(#...)) UYGULANMAZ — filtre tüm sayfayı
   yeniden renklendirir, kontrast oranlarını bozar ve metni okunmaz hale
   getirebilir. Bunun yerine yalnızca ANLAM taşıyan renkler
   (yükseliş/düşüş/uyarı) ayırt edilebilir bir palete eşlenir.

   Palet: Okabe-Ito renk körü güvenli paleti.
   Protan/deutan → kırmızı-yeşil ayrımı yok  → mavi / vermilyon kullanılır.
   Tritan       → mavi-sarı ayrımı yok       → sarı yerine pembe kullanılır.

   NOT: Renk tek başına bilgi taşımaz (erisebilirlik.md). Yön okları ve
   yüzde metni her modda görünür kalır; bu kurallar yalnızca renkleri
   ayrıştırır, işaretleri kaldırmaz.
============================================================ */
body[data-color-blind="protanopia"],
body[data-color-blind="deuteranopia"] {
  --color-market-up:   #0072B2; /* mavi */
  --color-market-down: #D55E00; /* vermilyon */
  --color-success:     #0072B2;
  --color-success-bg:  rgba(0, 114, 178, 0.12);
  --color-error:       #D55E00;
  --color-error-bg:    rgba(213, 94, 0, 0.12);
  --color-warning:     #F0E442; /* sarı — protan/deutan için ayırt edilebilir */
  --color-warning-bg:  rgba(240, 228, 66, 0.12);
}

body[data-color-blind="tritanopia"] {
  --color-market-up:   #009E73; /* mavimsi yeşil */
  --color-market-down: #D55E00; /* vermilyon */
  --color-success:     #009E73;
  --color-success-bg:  rgba(0, 158, 115, 0.12);
  --color-error:       #D55E00;
  --color-error-bg:    rgba(213, 94, 0, 0.12);
  --color-warning:     #CC79A7; /* pembe — sarı tritan için maviyle karışır */
  --color-warning-bg:  rgba(204, 121, 167, 0.12);
}

/* Renk körü modunda yön göstergeleri her zaman görünür (renk + şekil) */
body[data-color-blind]:not([data-color-blind="off"]) .price-up::before,
body[data-color-blind]:not([data-color-blind="off"]) .change-up::before {
  content: '\25B2\00A0'; /* ▲ */
}

body[data-color-blind]:not([data-color-blind="off"]) .price-down::before,
body[data-color-blind]:not([data-color-blind="off"]) .change-down::before {
  content: '\25BC\00A0'; /* ▼ */
}

/* ============================================================
   7c. DİSLEKSİ DOSTU OKUMA MODU
   body.dyslexia-font

   Dış kaynaktan font indirilmez (CSP dış host'ları engeller ve projede
   paketlenmiş disleksi fontu yoktur). Sistemde bulunan geniş harfli
   fontlar denenir; asıl etkiyi harf/kelime/satır aralığı sağlar —
   aralık artırımı disleksi okuma hızı üzerinde kanıtlanmış etkendir.
============================================================ */
body.dyslexia-font,
body.dyslexia-font button,
body.dyslexia-font input,
body.dyslexia-font select,
body.dyslexia-font textarea {
  font-family: "OpenDyslexic", "Comic Sans MS", "Trebuchet MS", Verdana, Tahoma, sans-serif !important;
}

body.dyslexia-font {
  letter-spacing: 0.06em;
  word-spacing: 0.16em;
  line-height: 1.9;
}

body.dyslexia-font p,
body.dyslexia-font li,
body.dyslexia-font td {
  max-width: 66ch;
}

/* Sayısal veri hizalaması bozulmasın — fiyat/tablo hücreleri sabit genişlik */
body.dyslexia-font .price-value,
body.dyslexia-font [class*="price"],
body.dyslexia-font [class*="amount"],
body.dyslexia-font code,
body.dyslexia-font kbd {
  font-family: "Consolas", "Menlo", monospace !important;
  letter-spacing: normal;
  word-spacing: normal;
}

/* ============================================================
   8. SCREEN READER MODE
   Extra verbosity helpers for screen reader users.
============================================================ */
body.screen-reader-mode [data-sr-label]::before {
  content: attr(data-sr-label) ': ';
  position: absolute;
  left: -10000px;
  white-space: nowrap;
}

/* Show more descriptive text for financial values */
body.screen-reader-mode .price-value::after {
  content: attr(data-sr-price);
  position: absolute;
  left: -10000px;
}

/* ============================================================
   9. FOCUS TRAP OVERLAY
============================================================ */
.focus-trap-active {
  position: relative;
}

.focus-trap-active::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  pointer-events: none;
}

/* ============================================================
   10. LIVE REGIONS
============================================================ */
#alpha-a11y-live,
#alpha-a11y-assertive {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ============================================================
   11. FORM ACCESSIBILITY
============================================================ */

/* Error state — uses shape and color (not just color) */
.error-field,
[aria-invalid="true"] {
  border-color: var(--color-error) !important;
  border-width: 2px !important;
  /* Error icon pattern: right side */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23d32f2f' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm0 10.5a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5zM8.75 4v4.5h-1.5V4h1.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-inline-end: 40px;
}

/* Success state */
[aria-invalid="false"] {
  border-color: #2e7d32 !important;
}

/* Required field visual indicator */
[aria-required="true"]::after {
  content: ' *';
  color: var(--color-error);
  font-weight: 700;
}

/* Onay kutusu/radyo: yıldız kutunun İÇİNE değil, etiketin başına yazılır */
input[type="checkbox"][aria-required="true"]::after,
input[type="radio"][aria-required="true"]::after { content: none; }
.form-checkbox:has(input[aria-required="true"]) .form-checkbox-label::before { content: '* '; color: var(--color-error); font-weight: 700; }

/* Disabled state */
[aria-disabled="true"],
[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Error message role="alert" regions */
[role="alert"],
.error-msg,
.field-error {
  display: block;
  margin-top: 4px;
  font-size: 0.85em;
  color: var(--color-error);
}

/* [role="alert"] ve [hidden] eşit özgüllükte (0,1,0) olduğundan, bu kural
   olmadan yukarıdaki display:block her zaman kazanır ve role="alert" hidden
   taşıyan elementler asla gizlenemez (ör. app/strateji/editor.html
   #editor-error — JS hidden=true yapsa bile görünür kalıyordu). */
[role="alert"][hidden] {
  display: none;
}

/* KÖK NEDEN (change-password boş kırmızı kutu): auth.css `.auth-error{display:none}` + `.visible` ile gösterilir; ancak yukarıdaki
   `[role="alert"]{display:block}` (aynı özgüllük, sonra yüklendiği için) `role="alert"` taşıyan `.auth-error` kutusunu HER ZAMAN görünür yapıyordu
   (metin boşken bile). `.visible` yokken gizli kalması için daha özgül kural: */
.auth-error:not(.visible),
.auth-success:not(.visible) {
  display: none;
}

body[data-theme="dark"] [role="alert"],
body[data-theme="dark"] .error-msg {
  color: #ff8a80;
}

/* ============================================================
   12. TOUCH TARGET SIZES (WCAG 2.5.5 — minimum 44x44)
============================================================ */
button,
a,
[role="button"],
[role="tab"],
[role="menuitem"],
[role="option"] {
  min-height: 44px;
  min-width: 44px;
}
/* Yerel onay kutusu/radyo: 44 px'lik dev beyaz kutu olmasın (kozmetik tur). İmleçli cihazda 24 px (WCAG 2.2 AA 2.5.8) kutu +
   etiket satırı 44 px yüksekliğinde dokunma alanı; dokunmatik cihazda eski 44 px davranışı aynen kalır. */
input[type="checkbox"],
input[type="radio"] {
  min-height: 24px;
  min-width: 24px;
  accent-color: var(--color-accent-fill, #0A63AC);
}
:where(label:has(> input[type="checkbox"]), label:has(> input[type="radio"])) { min-height: 44px; display: flex; align-items: center; gap: 8px; }
@media (pointer: coarse) {
  input[type="checkbox"],
  input[type="radio"] { min-height: 44px; min-width: 44px; }
}

/* Icon-only action buttons (alarm, etc.) keep padding */
.alarm-action-btn,
.icon-btn,
[class*="icon-btn"] {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   13. TEXT READABILITY
============================================================ */
body {
  line-height: 1.6;
  letter-spacing: 0.02em;
}

p {
  margin-bottom: 1em;
  max-width: 75ch; /* Optimal line length for readability */
}

/* Underlined links (not buttons/kart bileşenleri styled as links).
   KÖK NEDEN (2026-10-06 denetim, canlı algoiz.com): [class*="card"]
   istisnası eksikti — .finansmatik-tool-card gibi onlarca block-level
   kart bileşeni (grep: app/**/*.html'de "card" içeren 80+ farklı class)
   bu kuralla zorla alt çizili görünüyordu, component CSS'teki
   text-decoration:none sıfırlaması !important tarafından eziliyordu. */
/* KULLANICI KARARI (2026-10-06): sürekli görünen alt çizgi istenmedi
   ("istemiyorum çizgi ... mobilde daha kötü"). WCAG 1.4.1 (renkten
   bağımsız ayırt edilebilirlik) renk + font-weight farkıyla karşılanır;
   alt çizgi sadece hover/focus'ta görünür (interaktif geri bildirim). */
a:not(.btn):not(.nav-link):not(.skip-link):not([class*="tab"]):not([class*="item"]):not([class*="card"]) {
  color: var(--color-primary, #1295EB);
  font-weight: var(--font-weight-medium, 500);
  text-decoration: none !important;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}

a:not(.btn):not(.nav-link):not(.skip-link):not([class*="tab"]):not([class*="item"]):not([class*="card"]):hover,
a:not(.btn):not(.nav-link):not(.skip-link):not([class*="tab"]):not([class*="item"]):not([class*="card"]):focus-visible {
  text-decoration: underline !important;
  text-decoration-thickness: 1.5px;
}

/* Ensure sufficient line height in form inputs */
input,
select,
textarea {
  line-height: 1.5;
}

/* ============================================================
   14. NAVIGATION LANDMARKS
============================================================ */

/* Visually distinguish main landmark on focus */
main:focus,
[role="main"]:focus {
   /* main gets tabindex=-1 transiently for skip link */
}

/* ============================================================
   15. CURRENT PAGE INDICATOR
============================================================ */
[aria-current="page"] {
  font-weight: 700;
  border-bottom: 3px solid var(--primary-color, #1a73e8);
  text-decoration: none !important;
}

/* ============================================================
   16. RTL SUPPORT
============================================================ */
[dir="rtl"] .skip-link {
  left: auto;
  right: 16px;
  border-radius: 0 0 0 8px;
}

[dir="rtl"] .error-field,
[dir="rtl"] [aria-invalid="true"] {
  background-position: left 12px center;
  padding-inline-end: inherit;
  padding-inline-start: 40px;
}

[dir="rtl"] .a11y-panel-toggle {
  right: auto;
  left: 16px;
}

[dir="rtl"] .a11y-panel {
  right: auto;
  left: 16px;
}

/* ============================================================
   17. ACCESSIBILITY SETTINGS PANEL
============================================================ */

/* Toggle button (floating button to open panel) */
.a11y-panel-toggle {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: var(--a11y-panel-z);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--primary-color, #1a73e8);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  padding: 0;
}

.a11y-panel-toggle:hover {
  background: var(--primary-hover, #1557b0);
  transform: scale(1.08);
}

.a11y-panel-toggle:focus-visible {
  outline: 3px solid var(--a11y-focus-color);
  outline-offset: 3px;
  border-color: var(--a11y-focus-color);
}

.a11y-panel-toggle[aria-expanded="true"] {
  background: var(--a11y-panel-accent, #4caf50);
}

/* Panel container */
.a11y-panel {
  position: fixed;
  bottom: 134px;
  right: 16px;
  z-index: var(--a11y-panel-z);
  width: 280px;
  background: var(--a11y-panel-bg, #1e2130);
  border: 1px solid var(--a11y-panel-border, rgba(255,255,255,0.12));
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  font-size: 14px;
  color: var(--a11y-panel-text, #e0e0e0);
}

/* Panel header */
.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--a11y-panel-border, rgba(255,255,255,0.12));
}

.a11y-panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--a11y-panel-text, #e0e0e0);
}

.a11y-panel-close {
  background: transparent;
  border: none;
  color: var(--a11y-panel-text, #e0e0e0);
  cursor: pointer;
  padding: 4px;
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.a11y-panel-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.a11y-panel-close:focus-visible {
  outline: 2px solid var(--a11y-focus-color);
  outline-offset: 1px;
}

/* Panel body */
.a11y-panel-body {
  padding: 12px 0;
}

/* Panel rows */
.a11y-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 8px;
  min-height: 44px;
}

.a11y-panel-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.a11y-panel-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--a11y-panel-text, #e0e0e0);
  flex: 1;
  user-select: none;
  cursor: default;
}

/* Toggle switch (role="switch") */
.a11y-toggle-btn {
  position: relative;
  width: 44px;
  height: 24px;
  min-width: 44px;
  min-height: 24px;
  background: var(--a11y-panel-toggle-off, #555);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.a11y-toggle-btn--on {
  background: var(--a11y-panel-toggle-on, #4caf50) !important;
}

.a11y-toggle-btn:focus-visible {
  outline: 2px solid var(--a11y-focus-color);
  outline-offset: 2px;
}

.a11y-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.a11y-toggle-btn--on .a11y-toggle-thumb,
.a11y-toggle-btn[aria-checked="true"] .a11y-toggle-thumb {
  transform: translateX(20px);
}

/* Font size controls */
.a11y-font-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.a11y-font-controls {
  display: flex;
  gap: 6px;
  align-self: flex-end;
}

.a11y-font-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--a11y-panel-text, #e0e0e0);
  border-radius: 6px;
  cursor: pointer;
  min-width: 44px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  padding: 0 10px;
}

.a11y-font-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.a11y-font-btn--active {
  background: var(--a11y-panel-accent, #4caf50) !important;
  border-color: var(--a11y-panel-accent, #4caf50) !important;
  color: #fff !important;
}

.a11y-font-btn:focus-visible {
  outline: 2px solid var(--a11y-focus-color);
  outline-offset: 1px;
}

/* Keyboard shortcut hint at bottom of panel */
.a11y-panel-hint {
  padding: 8px 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid var(--a11y-panel-border, rgba(255,255,255,0.12));
  margin-top: 4px;
}

.a11y-panel-hint kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 10px;
}

/* Light theme panel overrides */
body[data-theme="light"] .a11y-panel {
  --a11y-panel-bg:     #ffffff;
  --a11y-panel-border: rgba(0, 0, 0, 0.12);
  --a11y-panel-text:   #212121;
  --a11y-panel-toggle-off: #aaa;
}

body[data-theme="light"] .a11y-panel-hint {
  color: rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] .a11y-panel-hint kbd {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.2);
}

body[data-theme="light"] .a11y-font-btn {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
  color: #212121;
}

body[data-theme="light"] .a11y-panel-close {
  color: #212121;
}

body[data-theme="light"] .a11y-panel-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .a11y-toggle-btn {
  background: #ccc;
}

/* ============================================================
   18. PRINT STYLES
============================================================ */
@media print {
  .skip-link,
  .sr-only,
  [aria-hidden="true"],
  .a11y-panel-toggle,
  .a11y-panel {
    display: none !important;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Print financial tables clearly */
  table {
    border-collapse: collapse;
    width: 100%;
  }

  th,
  td {
    border: 1px solid #000;
    padding: 4px 8px;
  }

  thead {
    background: #f0f0f0;
  }

  /* Mark required fields in print */
  [aria-required="true"]::after {
    content: ' (zorunlu)';
    font-size: 0.8em;
  }
}

/* Koyu yüzeylerde vurgu rengiyle yazılan metinler için AA (4.5:1) sağlayan açık ton */
.alarm-count-badge,
.theme-option.active .theme-option-label,
.language-option.active .language-option-native {
  color: #4db3f5;
}
[data-theme="light"] .alarm-count-badge,
[data-theme="light"] .theme-option.active .theme-option-label,
[data-theme="light"] .language-option.active .language-option-native {
  color: #0b6fb8;
}

/* Beyaz metinli vurgu dolguları: 4.5:1 için koyulaştırılmış ton */
.alarm-tab.active {
  background: #0b6fb8 !important;
  border-color: #0b6fb8 !important;
}

/* Metin içi bağlantılar renkten bağımsız ayırt edilir (link-in-text-block) */
.auth-terms a,
.form-checkbox-label a {
  text-decoration: underline !important;
}

/* 24-tarama: yazı kalınlığı tercihi (AlphaA11y.setFontWeight) */
html[data-font-weight="medium"] body { font-weight: 500; }
html[data-font-weight="bold"] body { font-weight: 600; }

/* 24-tarama (2. tur): mobilde etkileşimli düğme/seçim hedefi >= 44px (WCAG 2.5.5, proje kuralı). Satır içi metin bağlantıları hariç. */
@media (max-width: 768px), (pointer: coarse) {
  button:not(.cc-btn):not(.cc-close):not(.ob-dot), [role="button"], a.btn, .btn, select, input[type="button"], input[type="submit"],
  .sidebar-utility-btn, .sidebar-close-btn, .mobile-topbar-btn, a.a11y-skip { min-height: 44px !important; } /* !important: sayfa CSS'indeki .btn{min-height:36px} ezmesin */
  .sidebar-close-btn, .mobile-topbar-btn, button.tool-btn, button.refresh-btn { min-width: 44px; }
  /* sayfa-gezinme noktaları (ob-dot): görsel nokta küçük kalır, tıklanabilir alan 44px'e uzar */
  button.ob-dot { position: relative; }
  button.ob-dot::after { content: ""; position: absolute; inset: -18px; }
}

/* ===== 26-tarama (koyu tema AA): skip-link beyaz yazı için AA dolgu (#1295EB üstünde 3.22:1 idi) ===== */
.skip-link { background: var(--color-accent-fill, #0A63AC); color: #fff; }

/* ===== WCAG 1.4.11 (metin alanı kenarlığı >= 3:1) =====
   Sayfa CSS'leri alan kenarlığını --color-border-primary/-secondary ile (koyu 1.32:1, açık 1.15-1.23:1) tanımlıyordu.
   Tek güvence kuralı: kenarlığı olan her metin alanı/seçim/çok satırlı alan kontrol kenarlığına (koyu 4.40:1, açık 3.38-3.63:1) bağlanır.
   Odak ve hata durumu kendi rengini korur; kenarlığı olmayan (border:none) alanlar etkilenmez, çünkü yalnız renk atanır. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not(:focus):not([aria-invalid="true"]):not(.is-error):not(.error):not(.invalid),
select:not(:focus):not([aria-invalid="true"]):not(.is-error):not(.error):not(.invalid),
textarea:not(:focus):not([aria-invalid="true"]):not(.is-error):not(.error):not(.invalid) {
  border-color: var(--color-border-control, #4F86B8);
}

/* TEK erişilebilirlik paneli (2026-12-02): a11y-prefs.js "Aa" paneli (menüdeki "Erişilebilirlik" düğmesi bunu açar) varsa, accessibility.js'in ikinci
   ("i" simgeli) paneli ve düğmesi gösterilmez; böylece sağ altta iki ayrı panel çıkmaz. Canlı bölge/atlama bağlantısı gibi işlevler çalışmaya devam eder. */
html:has(.a11y-fab) #alpha-a11y-toggle, html:has(.a11y-fab) #alpha-a11y-panel { display: none !important; }

/* WCAG 1.4.10 (reflow): 320 CSS px'te uzun sözcük/adres/anahtar satırı taşırmaz; görsel ve gömülü öğeler kapsayıcıyı aşmaz */
@media (max-width: 340px) {
  body { overflow-wrap: anywhere; }
  img, video, canvas, iframe { max-width: 100%; }
  pre, code { white-space: pre-wrap; }
}
