/* ==========================================================================
   Trajetória Questões - Design System & Visual Identity
   Inspirado na identidade visual oficial da Trajetória (trajetoria.app.br)
   ========================================================================== */

:root {
  /* Cores Principais Trajetória */
  --bg-dark: #09090b;
  --bg-card: rgba(18, 19, 23, 0.88);
  --bg-card-hover: rgba(26, 27, 33, 0.95);
  --bg-input: rgba(13, 14, 17, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(0, 229, 117, 0.35);
  
  /* Verde Neon Trajetória */
  --primary: #00e575;
  --primary-hover: #00c853;
  --primary-glow: rgba(0, 229, 117, 0.3);
  --primary-text: #09090b;

  --success: #00e575;
  --success-dark: #00b848;
  --success-glow: rgba(0, 229, 117, 0.35);

  --danger: #ef4444;
  --danger-dark: #dc2626;
  --danger-glow: rgba(239, 68, 68, 0.35);

  --warning: #f59e0b;
  --purple: #a855f7;
  
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 9999px;

  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-card: 0 16px 36px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px var(--primary-glow);
}

/* Modo Claro (Light Theme) */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(0, 184, 72, 0.35);

  --primary: #00b848;
  --primary-hover: #008a36;
  --primary-glow: rgba(0, 184, 72, 0.25);
  --primary-text: #ffffff;

  --success: #00b848;
  --success-dark: #008a36;
  --success-glow: rgba(0, 184, 72, 0.25);

  --danger: #ef4444;
  --danger-dark: #dc2626;
  --danger-glow: rgba(239, 68, 68, 0.25);

  --warning: #d97706;
  --purple: #9333ea;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 25px rgba(0, 184, 72, 0.2);
}

[data-theme="light"] body {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 184, 72, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 90% 90%, rgba(0, 184, 72, 0.03) 0%, transparent 40%);
}

[data-theme="light"] .tab-btn.active {
  background: #f1f5f9;
  color: var(--primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .badge-pill {
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #334155;
}

[data-theme="light"] .chip-btn {
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #475569;
}

[data-theme="light"] .btn-floating-start {
  background: #f1f5f9 !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  color: var(--text-main) !important;
}

[data-theme="light"] .btn-floating-start:hover {
  background: #e2e8f0 !important;
}

[data-theme="light"] .metric-card {
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .stat-box {
  background: #ffffff;
}

[data-theme="light"] .history-item {
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .history-item:hover {
  background: #f1f5f9;
}

[data-theme="light"] .history-date-badge {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .ad-banner-container,
[data-theme="light"] .sidebar-ad-container {
  background: #ffffff;
  border: 1px dashed rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-card {
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .modal-subject-box,
[data-theme="light"] .modal-stat {
  background: #f8fafc;
}

[data-theme="light"] .modal-stat.highlighted {
  background: rgba(0, 184, 72, 0.08);
}

[data-theme="light"] .pix-qrcode-container {
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .pix-input-group input {
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

[data-theme="light"] .btn-primary {
  color: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 229, 117, 0.07) 0%, transparent 60%),
    radial-gradient(circle at 90% 90%, rgba(0, 229, 117, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  -webkit-font-smoothing: antialiased;
}

/* Page Layout Wrapper */
.page-layout-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Sidebar Ads (Sticky & Clean nos Cantos - Tela Inteira) */
.sidebar-ad-container {
  width: 160px;
  height: calc(100vh - 48px);
  min-height: 600px;
  background: rgba(18, 19, 23, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: sticky;
  top: 24px;
  flex-shrink: 0;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.sidebar-ad-box {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 520px;
}

.sidebar-ad-container .ad-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.sidebar-ad-container .ad-placeholder-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Hide sidebars on screens smaller than 1340px to preserve perfect central app layout */
@media (max-width: 1340px) {
  .sidebar-ad-container {
    display: none !important;
  }
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 0 1 960px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-link {
  display: block;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.logo-link:hover {
  transform: scale(1.05);
}

.trajetoria-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
  display: block;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 16px rgba(0, 229, 117, 0.2);
}

.logo-area h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-main);
  line-height: 1.1;
}

.logo-area h1 .highlight {
  color: var(--primary);
}

.logo-area .subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* Header Right Group & CTA */
.header-right-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-platform-cta {
  background: rgba(0, 229, 117, 0.08) !important;
  border: 1px solid var(--border-highlight) !important;
  color: var(--primary) !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  padding: 8px 16px !important;
  border-radius: var(--radius-pill) !important;
  transition: var(--transition-fast) !important;
}

.btn-platform-cta:hover {
  background: rgba(0, 229, 117, 0.2) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 12px rgba(0, 229, 117, 0.3) !important;
}

.btn-pix-donate {
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  color: #fbbf24 !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  padding: 8px 16px !important;
  border-radius: var(--radius-pill) !important;
  transition: var(--transition-fast) !important;
}

.btn-pix-donate:hover {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35) !important;
  color: #fff !important;
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .btn-theme-toggle {
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #475569;
}

[data-theme="light"] .btn-theme-toggle:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

/* Tabs */
.nav-tabs {
  display: flex;
  gap: 6px;
  background: rgba(13, 14, 18, 0.8);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: #18191e;
  color: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Main Content */
.main-content {
  width: 100%;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.25s ease-out forwards;
}

.tab-content.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card General */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
}

.card-header {
  margin-bottom: 22px;
}

.card-header h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.card-header h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.card-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Badge Pill (Identidade Trajetória) */
.badge-pill-container {
  margin-bottom: 12px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: rgba(24, 24, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
  color: #e4e4e7;
  letter-spacing: 0.3px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(18, 19, 24, 0.95);
}

/* Quick Subjects Chips */
.quick-subjects-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.quick-title {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 600;
}

.chips-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-btn {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.chip-btn:hover {
  background: rgba(0, 229, 117, 0.12);
  color: var(--primary);
  border-color: var(--border-highlight);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

/* Botão Primário Trajetória (Verde Neon com texto escuro) */
.btn-primary {
  background: linear-gradient(135deg, #00e575, #00c853);
  color: #09090b;
  box-shadow: 0 4px 18px rgba(0, 229, 117, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #05f07d, #00b848);
  box-shadow: 0 6px 24px rgba(0, 229, 117, 0.55);
}

.form-actions-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .form-actions-row {
    grid-template-columns: 1fr;
  }
}

.btn-floating-start {
  background: rgba(24, 24, 28, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: var(--text-main) !important;
}

.btn-floating-start:hover {
  background: rgba(35, 36, 42, 0.95) !important;
  border-color: var(--border-highlight) !important;
  color: var(--primary) !important;
}

.btn-floating-glow {
  background: linear-gradient(135deg, #00e575, #00c853) !important;
  color: #09090b !important;
  box-shadow: 0 0 16px rgba(0, 229, 117, 0.4) !important;
  font-weight: 700 !important;
}

.btn-secondary {
  background: rgba(24, 24, 28, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(35, 36, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.btn-lg {
  padding: 15px 28px;
  font-size: 1rem;
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
}

/* ACTIVE SESSION CARD */
.session-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.badge-subject {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(0, 229, 117, 0.12);
  color: var(--primary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.session-topic {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Live Metrics Grid */
.live-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .live-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background: rgba(13, 14, 18, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.metric-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

.metric-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-accent { color: var(--primary) !important; }

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e575, #00b848);
  border-radius: 10px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* BIG QUESTION ACTION BUTTONS */
.question-buttons-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 10px 0;
}

@media (max-width: 580px) {
  .question-buttons-container {
    grid-template-columns: 1fr;
  }
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  border-radius: var(--radius-xl);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.action-btn:active {
  transform: scale(0.96);
}

/* Acerto Button - Trajetória Green */
.btn-success-glow {
  background: linear-gradient(135deg, rgba(0, 229, 117, 0.12), rgba(0, 184, 72, 0.22));
  border-color: rgba(0, 229, 117, 0.4);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 229, 117, 0.15);
}

.btn-success-glow:hover {
  background: linear-gradient(135deg, rgba(0, 229, 117, 0.25), rgba(0, 184, 72, 0.4));
  border-color: var(--success);
  box-shadow: 0 12px 35px var(--success-glow);
  transform: translateY(-2px);
}

.btn-success-glow .action-btn-icon {
  color: var(--success);
  background: rgba(0, 229, 117, 0.18);
}

/* Erro Button */
.btn-danger-glow {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(220, 38, 38, 0.22));
  border-color: rgba(239, 68, 68, 0.4);
  color: #fff;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.15);
}

.btn-danger-glow:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.4));
  border-color: var(--danger);
  box-shadow: 0 12px 35px var(--danger-glow);
  transform: translateY(-2px);
}

.btn-danger-glow .action-btn-icon {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.18);
}

.action-btn-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  transition: transform 0.2s ease;
}

.action-btn:hover .action-btn-icon {
  transform: scale(1.1);
}

.action-btn-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.shortcut-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

/* Session Footer Actions */
.session-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.btn-finish {
  background: linear-gradient(135deg, #00e575, #00c853);
  color: #09090b;
  box-shadow: 0 4px 16px rgba(0, 229, 117, 0.4);
}

.btn-finish:hover {
  background: linear-gradient(135deg, #05f07d, #00b848);
  box-shadow: 0 6px 20px rgba(0, 229, 117, 0.6);
}

/* TAB 2: HISTÓRICO & ANALYTICS */

/* Filter Toolbar */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-buttons {
  display: flex;
  gap: 6px;
  background: rgba(13, 14, 18, 0.8);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.filter-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-btn:hover {
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--primary);
  color: #09090b;
  font-weight: 700;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Stats Overview Grid */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 820px) {
  .stats-overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-overview-grid {
    grid-template-columns: 1fr;
  }
}

.stat-box {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-blue { background: rgba(0, 229, 117, 0.12); color: var(--primary); }
.icon-green { background: rgba(0, 229, 117, 0.12); color: var(--success); }
.icon-accent { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.icon-purple { background: rgba(168, 85, 247, 0.12); color: var(--purple); }

.stat-title {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

.stat-number {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

/* Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

@media (max-width: 820px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.chart-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  height: 240px;
}

/* Subject Performance List */
.subject-bars-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 6px;
}

.subject-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subject-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.subject-bar-name {
  font-weight: 600;
  color: var(--text-main);
}

.subject-bar-stats {
  color: var(--text-muted);
  font-weight: 500;
}

.subject-progress-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.subject-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* History List Card */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: rgba(13, 14, 18, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition-fast);
}

.history-item:hover {
  background: rgba(24, 25, 30, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.history-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  min-width: 70px;
}

.history-date-day {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.history-date-time {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.history-details h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.history-details p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.history-item-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.history-score-badge {
  text-align: right;
}

.history-score-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  display: block;
}

.history-score-ratio {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-icon-delete {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.btn-icon-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
}

.modal-card {
  background: #121317;
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 22px;
  text-align: center;
}

.modal-trophy-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px auto;
  background: rgba(0, 229, 117, 0.15);
  border: 1px solid var(--border-highlight);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(0, 229, 117, 0.25);
}

.modal-header h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-subject-box {
  background: rgba(13, 14, 18, 0.8);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-subject {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-topic {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.modal-stat {
  background: rgba(13, 14, 18, 0.6);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-stat.highlighted {
  grid-column: span 2;
  background: rgba(0, 229, 117, 0.08);
  border-color: var(--border-highlight);
}

.modal-stat .label {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-weight: 600;
}

.modal-stat .val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
}

.modal-badge-feedback {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.88rem;
  background: rgba(0, 229, 117, 0.12);
  color: var(--primary);
  border: 1px solid var(--border-highlight);
}

.modal-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ==========================================================================
   Footer & AdSense Container Styles
   ========================================================================== */
.app-footer {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  border-top: 1px solid var(--border-color);
}

.ad-banner-container {
  width: 100%;
  text-align: center;
  background: rgba(13, 14, 18, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.ad-placeholder-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-educational-content h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.footer-educational-content p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-brand a {
  color: var(--primary);
  text-decoration: none;
}

.footer-brand a:hover {
  text-decoration: underline;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}

.footer-link-btn:hover {
  color: var(--primary);
  text-decoration: underline;
}

.legal-modal-card {
  max-width: 600px;
  text-align: left;
}

.legal-modal-body {
  text-align: left;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.legal-modal-body h4 {
  font-size: 0.98rem;
  color: var(--text-main);
  margin: 14px 0 4px 0;
}

/* ==========================================================================
   Mini Floating Widget / Document Picture-in-Picture (PiP) Styles
   ========================================================================== */

body.pip-body {
  padding: 10px;
  background: #09090b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.pip-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  height: 100%;
  justify-content: space-between;
}

.pip-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(18, 19, 23, 0.95);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.pip-subject {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pip-topic {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pip-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
}

.pip-metric-box {
  background: rgba(13, 14, 18, 0.9);
  border: 1px solid var(--border-color);
  padding: 6px 4px;
  border-radius: 8px;
}

.pip-metric-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 600;
  display: block;
}

.pip-metric-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
}

.pip-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 100px;
}

.pip-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 12px 6px;
  user-select: none;
  transition: transform 0.1s ease;
}

.pip-btn:active {
  transform: scale(0.94);
}

.pip-btn-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
}

.pip-btn-shortcut {
  font-size: 0.68rem;
  opacity: 0.85;
  margin-top: 2px;
}

.pip-footer {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

/* PIX Donation Modal Styles */
.pix-modal-card {
  max-width: 440px;
  text-align: center;
}

.modal-pix-icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
  line-height: 1;
}

.pix-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.pix-qrcode-container {
  background: #ffffff;
  padding: 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pix-qrcode-img {
  width: 170px;
  height: 170px;
  display: block;
  object-fit: contain;
}

.pix-scan-hint {
  font-size: 0.72rem;
  color: #52525b;
  font-weight: 600;
}

.pix-key-box {
  width: 100%;
  text-align: left;
}

.pix-key-label {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.pix-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.pix-input-group input {
  flex: 1;
  background: rgba(13, 14, 18, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.pix-input-group input:focus {
  border-color: var(--primary);
}

.pix-simple-key {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.pix-simple-key code {
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-main);
  font-family: monospace;
  font-size: 0.74rem;
  border: 1px solid var(--border-color);
}

.btn-copy-link {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-copy-link:hover {
  color: #fff;
}

/* Utilities */
.hidden {
  display: none !important;
}
