/* =============================================================================
   DISABILITIES REGISTRATION PAGE — disabilities.css
   Matches referendum template: Bootstrap, RTL Arabic, colors #BE1E2D / #9d1f20
   Covers: form, accessibility toolbar, shortcuts, high-contrast, large-text,
           focus indicators, TalkBack-friendly layout, screen magnification.
   ============================================================================= */

/* ── Utilities ──────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── Skip Link ───────────────────────────────────────────────────────────── */
.disabilities-skip-link {
  position: absolute;
  top: -9999px; left: 50%;
  transform: translateX(-50%);
  background: #BE1E2D;
  color: #fff;
  padding: 10px 24px;
  border-radius: 0 0 6px 6px;
  font-size: 1rem;
  font-weight: bold;
  z-index: 10000;
  text-decoration: none;
  transition: top .1s;
}
.disabilities-skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ── Global Focus Indicator — never remove outline ───────────────────────── */
.disabilities-page *:focus,
.disabilities-page *:focus-visible {
  outline: 3px solid #BE1E2D !important;
  outline-offset: 3px !important;
  border-radius: 3px;
}

/* ── Accessibility Toolbar ───────────────────────────────────────────────── */
.disabilities-a11y-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #222;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 0.875rem;
}
.a11y-toolbar-label {
  font-weight: bold;
  margin-left: 8px;
  color: #ccc;
}
.a11y-btn {
  background: #444;
  color: #fff;
  border: 1px solid #666;
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  min-height: 36px;
  min-width: 48px;
  transition: background .15s, border-color .15s;
}
.a11y-btn:hover,
.a11y-btn:focus {
  background: #BE1E2D;
  border-color: #9d1f20;
  color: #fff;
  outline: 3px solid #fff !important;
  outline-offset: 2px !important;
}
.a11y-btn[aria-pressed="true"] {
  background: #BE1E2D;
  border-color: #9d1f20;
}

/* ── Keyboard Shortcuts Modal ────────────────────────────────────────────── */
.disabilities-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1040;
}
.disabilities-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.disabilities-modal[hidden],
.disabilities-modal-backdrop[hidden] { display: none !important; }

.disabilities-modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 28px 32px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  direction: rtl;
}
.disabilities-modal-box h2 {
  color: #BE1E2D;
  margin: 0 0 16px;
  font-size: 1.3rem;
  border-bottom: 2px solid #e6e6e6;
  padding-bottom: 10px;
}
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.95rem;
}
.shortcuts-table th,
.shortcuts-table td {
  padding: 8px 10px;
  text-align: right;
  border: 1px solid #e6e6e6;
}
.shortcuts-table th { background: #f9f8f8; font-weight: bold; }
.shortcuts-table tr:nth-child(even) { background: #f4f4f4; }
kbd {
  background: #eee;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 2px 7px;
  font-family: monospace;
  font-size: 0.85rem;
  direction: ltr;
  display: inline-block;
}

/* ── Page wrapper ────────────────────────────────────────────────────────── */
.disabilities-page {
  padding: 24px;
  background: rgba(255,255,255,.85);
  border-radius: 6px;
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.disabilities-header {
  margin-bottom: 28px;
  border-bottom: 3px solid #222;
  padding-bottom: 16px;
}
.disabilities-header h1 {
  color: #BE1E2D;
  font-size: 1.8rem;
  margin: 0 0 10px;
  line-height: 1.4;
}
.disabilities-intro {
  color: #555;
  font-size: 1rem;
  line-height: 1.8;
  margin: 0;
}
.required-mark {
  color: #BE1E2D;
  font-weight: bold;
  margin-right: 4px;
}

/* ── Alert boxes ─────────────────────────────────────────────────────────── */
.disabilities-alert {
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 1rem;
}
.alert-warning {
  background: #fff8e1;
  border: 1px solid #f0c040;
  color: #7a5c00;
}
.alert-icon { font-size: 1.3rem; flex-shrink: 0; }

/* ── Disability Shortcut Buttons ─────────────────────────────────────────── */
.disabilities-shortcuts-section {
  background: #f9f8f8;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 28px;
}
.shortcuts-section-title {
  color: #BE1E2D;
  font-size: 1.15rem;
  margin: 0 0 6px;
  border: 0;
}
.shortcuts-section-desc {
  color: #777;
  font-size: 0.9rem;
  margin: 0 0 16px;
}
.shortcuts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.shortcut-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 90px;
  min-height: 90px;
  padding: 12px 10px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, transform .1s, box-shadow .15s;
  position: relative;
}
.shortcut-btn:hover {
  border-color: #BE1E2D;
  background: #fff5f5;
  box-shadow: 0 2px 8px rgba(190,30,45,.15);
  transform: translateY(-2px);
}
.shortcut-btn:focus {
  border-color: #BE1E2D;
}
.shortcut-btn.active,
.shortcut-btn[aria-pressed="true"] {
  border-color: #9d1f20;
  background: #BE1E2D;
  color: #fff;
  box-shadow: 0 3px 10px rgba(157,31,32,.35);
}
.shortcut-btn.active .shortcut-label,
.shortcut-btn[aria-pressed="true"] .shortcut-label { color: #fff; }
.shortcut-icon {
  font-size: 2rem;
  line-height: 1;
  display: block;
}
.shortcut-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: #3d3d3d;
}
.shortcut-key-hint {
  font-size: 0.65rem;
  color: #999;
  background: #eee;
  border-radius: 3px;
  padding: 1px 5px;
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.shortcut-btn.active .shortcut-key-hint,
.shortcut-btn[aria-pressed="true"] .shortcut-key-hint {
  background: rgba(255,255,255,.25);
  color: #ffe;
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 24px;
}
.form-group.group-error .form-control {
  border-color: #BE1E2D;
}
.form-label {
  display: block;
  font-weight: bold;
  color: #3d3d3d;
  margin-bottom: 8px;
  font-size: 1rem;
}
.form-control {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid #ccc;
  border-radius: 5px;
  font-family: inherit;
  font-size: 1rem;
  color: #3d3d3d;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
  appearance: auto;
}
.form-control:focus {
  border-color: #BE1E2D;
  box-shadow: 0 0 0 3px rgba(190,30,45,.15);
}
.form-control.has-error { border-color: #BE1E2D; }
.form-select { cursor: pointer; min-height: 48px; }
textarea.form-control { resize: vertical; min-height: 110px; }

/* NID input: override Bootstrap/template line-height */
.disabilities-page #nid {
  line-height: 1.5;
}

.input-wrapper {
  position: relative;
}
#grp-nid .input-wrapper .form-control {
  padding-left: 55px; /* space for NID char counter */
}

/* NID/Notes character counter */
.char-counter {
  font-size: 0.78rem;
  color: #999;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  direction: ltr;
}
#notes-counter {
  position: static;
  transform: none;
  float: left;
}
.field-footer { display: flex; justify-content: space-between; align-items: flex-start; }

/* Field helpers & errors */
.field-help {
  font-size: 0.85rem;
  color: #777;
  margin: 6px 0 0;
}
.field-error {
  color: #BE1E2D;
  font-size: 0.875rem;
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* reCAPTCHA */
.recaptcha-wrapper {
  margin-top: 4px;
}

/* Submit area */
.form-actions {
  margin-top: 28px;
  border-top: 1px solid #e6e6e6;
  padding-top: 24px;
}
/* Submit button — override global .btn.custom padding/line-height with higher specificity */
.disabilities-page .disabilities-submit-btn.btn.custom,
.disabilities-page .disabilities-submit-btn {
  min-width: 180px;
  min-height: 52px;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 14px 36px !important;
  line-height: 1.4 !important;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .1s;
  background-color: #BE1E2D !important;
  background-image: none !important;
  border-color: #9d1f20 !important;
  color: #fff !important;
  text-decoration: none;
}
.disabilities-page .disabilities-submit-btn:hover {
  background-color: #9d1f20 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(157,31,32,.35);
}
.disabilities-page .disabilities-submit-btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Success Screen ───────────────────────────────────────────────────────── */
.disabilities-success {
  text-align: center;
  padding: 48px 24px;
}
.success-icon {
  font-size: 5rem;
  color: #2e7d32;
  margin-bottom: 16px;
}
.success-title {
  color: #2e7d32;
  font-size: 2rem;
  margin: 0 0 12px;
}
.success-msg {
  color: #555;
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 500px;
  margin: 0 auto 28px;
}

/* ══════════════════════════════════════════════════════════════════════════
   HIGH CONTRAST MODE  (body.high-contrast)
   WCAG AA/AAA: all text/bg pairs ≥ 4.5:1
   ══════════════════════════════════════════════════════════════════════ */
body.high-contrast .disabilities-page,
body.high-contrast .disabilities-shortcuts-section {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}
body.high-contrast .form-control {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}
body.high-contrast .form-label,
body.high-contrast .disabilities-header h1,
body.high-contrast .disabilities-intro,
body.high-contrast .shortcuts-section-title,
body.high-contrast .field-help {
  color: #fff !important;
}
body.high-contrast .shortcut-btn {
  background: #000 !important;
  border: 2px solid #fff !important;
  color: #fff !important;
}
body.high-contrast .shortcut-icon { filter: brightness(10); }
body.high-contrast .shortcut-btn.active,
body.high-contrast .shortcut-btn[aria-pressed="true"] {
  background: #ffff00 !important;
  color: #000 !important;
  border-color: #fff !important;
}
body.high-contrast .shortcut-label { color: inherit !important; }
body.high-contrast .btn.custom,
body.high-contrast .disabilities-submit-btn {
  background: #ffff00 !important;
  color: #000 !important;
  border: 2px solid #fff !important;
}
body.high-contrast .a11y-btn {
  background: #000 !important;
  color: #fff !important;
  border: 1px solid #fff !important;
}
body.high-contrast .a11y-btn:hover,
body.high-contrast .a11y-btn:focus {
  background: #ffff00 !important;
  color: #000 !important;
}
body.high-contrast .disabilities-a11y-toolbar { background: #111 !important; border-bottom: 1px solid #fff; }
body.high-contrast kbd { background: #333; color: #fff; border-color: #fff; }
body.high-contrast .shortcuts-table th { background: #222 !important; color: #fff !important; }
body.high-contrast .shortcuts-table td { background: #000 !important; color: #fff !important; border-color: #555 !important; }
body.high-contrast .disabilities-modal-box { background: #111 !important; color: #fff !important; border: 2px solid #fff; }
body.high-contrast .success-icon { color: #0f0 !important; }
body.high-contrast .success-title { color: #0f0 !important; }
body.high-contrast .success-msg { color: #fff !important; }
body.high-contrast .field-error { color: #ff6b6b !important; }
body.high-contrast .alert-warning { background: #111 !important; border-color: #ff0 !important; color: #ff0 !important; }
body.high-contrast *:focus,
body.high-contrast *:focus-visible {
  outline: 3px solid #ff0 !important;
  outline-offset: 3px !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE / SCREEN MAGNIFICATION
   All units in rem/% so 200% browser zoom stays valid (WCAG 1.4.4)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .shortcuts-grid { gap: 8px; }
  .shortcut-btn { min-width: 70px; min-height: 70px; padding: 8px; }
  .shortcut-icon { font-size: 1.6rem; }
  .disabilities-a11y-toolbar { padding: 6px 10px; font-size: 0.8rem; }
  .a11y-btn { padding: 5px 10px; min-height: 36px; }
  .disabilities-page { padding: 16px; }
}
@media (max-width: 480px) {
  .disabilities-a11y-toolbar { 
    display: grid !important; 
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 8px !important; 
    padding: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .a11y-toolbar-label { 
    display: none !important;
  }
  .a11y-btn {
    padding: 8px 4px !important;
    min-width: 0 !important;
    font-size: 0.75rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
  .a11y-btn span[aria-hidden="true"] {
    font-size: 1.4rem !important;
    margin-bottom: 0 !important;
  }
  /* Hide the newly added button labels on mobile */
  .btn-label { display: none !important; }

  .shortcut-label { display: none !important; }
  .shortcut-btn { min-width: 60px !important; min-height: 60px !important; padding: 4px !important; }
  .shortcut-icon { font-size: 2rem !important; margin: 0 !important; }
  .shortcut-key-hint { display: none !important; }
  .disabilities-submit-btn { width: 100% !important; }
  .input-wrapper .form-control { padding-left: 50px !important; }
}

/* High zoom (200%) — ensure no horizontal overflow */
@media (min-resolution: 192dpi), (max-width: 360px) {
  .disabilities-a11y-toolbar { 
    grid-template-columns: 1fr 1fr;
  }
  .a11y-toolbar-label { 
    grid-column: span 2;
  }
  .shortcuts-grid { justify-content: center; }
}
