/* ═══════════════════════════════════════════════════════════
   ACCESSIBILITY.CSS — EstudaAI
   Temas, tamanhos de fonte, alto contraste e painel ⚙️
   ═══════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════
   TEMA CLARO
════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg: #f0f2f8;
  --surface: #ffffff;
  --surface2: #e8eaf4;
  --border: #d0d4e8;
  --text: #1a1d2e;
  --text-dim: #4a5070;
  --text-muted: #8892b0;
  --accent: #3b6ee8;
  --accent2: #7c5af0;
  --accent3: #059669;
  --gold: #d97706;
  --danger: #dc2626;
}

[data-theme="light"] body::before {
  background:
    radial-gradient(
      ellipse 80% 60% at 10% 0%,
      rgba(59, 110, 232, 0.07) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 60% 50% at 90% 100%,
      rgba(124, 90, 240, 0.05) 0%,
      transparent 60%
    );
}

/* Sobrescritas pontuais para o tema claro */
[data-theme="light"] #sidebar {
  background: var(--surface);
}
[data-theme="light"] #tab-bar {
  background: var(--bg);
}
[data-theme="light"] .tab.active {
  background: var(--surface);
}
[data-theme="light"] .msg.ai .msg-bubble {
  background: var(--surface2);
}
[data-theme="light"] .msg-avatar {
  background: var(--surface2);
}
[data-theme="light"] #chat-header {
  background: var(--surface);
}
[data-theme="light"] #user-input {
  background: var(--surface);
}
[data-theme="light"] #input-area {
  background: var(--bg);
}
[data-theme="light"] #quick-prompts {
  background: var(--bg);
}
[data-theme="light"] .qp {
  background: var(--surface);
}
[data-theme="light"] .stat-card {
  background: var(--surface);
}
[data-theme="light"] .cal-grid {
  background: var(--surface);
}
[data-theme="light"] .ach-card {
  background: var(--surface);
}
[data-theme="light"] .table-wrap {
  background: var(--surface);
}
[data-theme="light"] th {
  background: var(--surface2);
}
[data-theme="light"] #toast {
  background: var(--surface);
}

/* ════════════════════════════════════════════════════════════
   ALTO CONTRASTE — TEMA ESCURO
════════════════════════════════════════════════════════════ */
[data-contrast="high"] {
  --bg: #000000;
  --surface: #0a0a0a;
  --surface2: #111111;
  --border: #ffffff;
  --text: #ffffff;
  --text-dim: #eeeeee;
  --text-muted: #cccccc;
  --accent: #00aaff;
  --accent2: #cc88ff;
  --accent3: #00ff99;
  --gold: #ffcc00;
  --danger: #ff4444;
}

[data-contrast="high"] * {
  outline-color: #ffffff !important;
}

[data-contrast="high"] .msg.ai .msg-bubble {
  border: 2px solid #ffffff;
}
[data-contrast="high"] .tab.active {
  border-width: 2px;
}
[data-contrast="high"] .nav-btn.active {
  outline: 2px solid var(--accent);
}
[data-contrast="high"] input,
[data-contrast="high"] textarea,
[data-contrast="high"] button {
  border: 2px solid var(--border) !important;
}
[data-contrast="high"] .cal-day.today {
  border: 3px solid var(--accent) !important;
}
[data-contrast="high"] .prog-bar {
  border: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════════════
   ALTO CONTRASTE — TEMA CLARO
════════════════════════════════════════════════════════════ */
[data-theme="light"][data-contrast="high"] {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface2: #ebebeb;
  --border: #000000;
  --text: #000000;
  --text-dim: #111111;
  --text-muted: #333333;
  --accent: #0000cc;
  --accent2: #6600cc;
  --accent3: #006600;
  --gold: #885500;
  --danger: #cc0000;
}

/* ════════════════════════════════════════════════════════════
   TAMANHO DE FONTE — NORMAL (padrão)
════════════════════════════════════════════════════════════ */
[data-fontsize="normal"] {
  font-size: 14px;
}

/* ════════════════════════════════════════════════════════════
   TAMANHO DE FONTE — GRANDE
════════════════════════════════════════════════════════════ */
[data-fontsize="large"] {
  font-size: 17px;
}

[data-fontsize="large"] .msg-bubble {
  font-size: 16px;
}
[data-fontsize="large"] .tab {
  font-size: 16px;
}
[data-fontsize="large"] .nav-btn {
  font-size: 16px;
}
[data-fontsize="large"] .qp {
  font-size: 14px;
}
[data-fontsize="large"] td {
  font-size: 16px;
}
[data-fontsize="large"] .ach-desc {
  font-size: 14px;
}
[data-fontsize="large"] #user-input {
  font-size: 16px;
}
[data-fontsize="large"] .streak-count {
  font-size: 32px;
}
[data-fontsize="large"] .stat-val {
  font-size: 32px;
}
[data-fontsize="large"] .section-title {
  font-size: 23px;
}

/* ════════════════════════════════════════════════════════════
   TAMANHO DE FONTE — EXTRA GRANDE
════════════════════════════════════════════════════════════ */
[data-fontsize="xlarge"] {
  font-size: 20px;
}

[data-fontsize="xlarge"] .msg-bubble {
  font-size: 19px;
  line-height: 1.75;
}
[data-fontsize="xlarge"] .tab {
  font-size: 18px;
}
[data-fontsize="xlarge"] .nav-btn {
  font-size: 18px;
}
[data-fontsize="xlarge"] .qp {
  font-size: 16px;
}
[data-fontsize="xlarge"] td {
  font-size: 18px;
}
[data-fontsize="xlarge"] th {
  font-size: 14px;
}
[data-fontsize="xlarge"] .ach-name {
  font-size: 17px;
}
[data-fontsize="xlarge"] .ach-desc {
  font-size: 15px;
}
[data-fontsize="xlarge"] #user-input {
  font-size: 18px;
}
[data-fontsize="xlarge"] .streak-count {
  font-size: 36px;
}
[data-fontsize="xlarge"] .stat-val {
  font-size: 36px;
}
[data-fontsize="xlarge"] .section-title {
  font-size: 26px;
}
[data-fontsize="xlarge"] .logo-text {
  font-size: 22px;
}
[data-fontsize="xlarge"] .inp {
  font-size: 17px;
}

/* ════════════════════════════════════════════════════════════
   BOTÃO DE ENGRENAGEM ⚙️
════════════════════════════════════════════════════════════ */
#settings-btn {
  position: fixed;
  top: 5px;
  right: 16px;
  z-index: 600;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#settings-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(30deg) scale(1.05);
}

#settings-btn.open {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(79, 138, 255, 0.1);
  transform: rotate(60deg);
}

/* ════════════════════════════════════════════════════════════
   PAINEL DE ACESSIBILIDADE
════════════════════════════════════════════════════════════ */
#settings-panel {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 599;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  /* estado fechado */
  transform: translateY(-10px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#settings-panel.open {
  transform: none;
  opacity: 1;
  pointer-events: all;
}

/* Cabeçalho do painel */
.settings-title {
  font-family: "Syne", sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Grupo de opções (tema / fonte) */
.option-group {
  display: flex;
  gap: 8px;
}

.opt-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.opt-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.opt-btn.active {
  border-color: var(--accent);
  background: rgba(79, 138, 255, 0.13);
  color: var(--accent);
  font-weight: 700;
}

.opt-btn .opt-icon {
  font-size: 18px;
  line-height: 1;
}

/* Ícones do tamanho da fonte (A pequeno / médio / grande) */
.font-btn .opt-icon {
  font-weight: 700;
  line-height: 1;
}
.font-btn:nth-child(1) .opt-icon {
  font-size: 15px;
}
.font-btn:nth-child(2) .opt-icon {
  font-size: 19px;
}
.font-btn:nth-child(3) .opt-icon {
  font-size: 24px;
}

/* Toggle de alto contraste */
.contrast-toggle {
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.contrast-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}

.contrast-toggle.active {
  border-color: var(--accent3);
  background: rgba(52, 211, 153, 0.1);
  color: var(--accent3);
  font-weight: 700;
}

/* Pill do toggle */
.toggle-pill {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--border);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.contrast-toggle.active .toggle-pill {
  background: var(--accent3);
}

.toggle-pill::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.contrast-toggle.active .toggle-pill::after {
  transform: translateX(16px);
}

/* ════════════════════════════════════════════════════════════
   OVERLAY (fecha o painel ao clicar fora)
════════════════════════════════════════════════════════════ */
#settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 598;
  display: none;
}

#settings-overlay.open {
  display: block;
}
