/* Sistema de Aprendizado — estilos */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0a0a;
  color: #e8e8e8;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-top: max(20px, env(safe-area-inset-top));
  min-height: 100vh;
}

.container { max-width: 1100px; margin: 0 auto; }

header {
  border-bottom: 2px solid #E8292A;
  padding-bottom: 16px;
  margin-bottom: 24px;
}
h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.subtitle { color: #888; font-size: 13px; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid #222;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 12px 20px;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab.active { color: #fff; border-bottom-color: #E8292A; }
.tab:hover { color: #fff; }
.panel { display: none; }
.panel.active { display: block; animation: fadein 0.2s ease; }

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

/* Notify banner */
.notify-banner {
  background: #1f1a0a;
  border: 1px solid #5a4a10;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.notify-actions { display: flex; gap: 8px; flex-shrink: 0; }

.stale-notice {
  background: #2a1410;
  border: 1px solid #5a2010;
  border-left: 3px solid #e74c3c;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #ffb1a3;
}

/* REGISTRO */
.register-card {
  background: #141414;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}
.register-card h2 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #fff;
}
.discipline-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
@media (max-width: 900px) {
  .discipline-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .discipline-grid { grid-template-columns: repeat(2, 1fr); }
  .input-row { grid-template-columns: 1fr !important; }
  body { padding: 12px; }
}
.discipline-btn {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #aaa;
  padding: 14px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
  text-align: center;
}
.discipline-btn:hover { border-color: #444; color: #fff; }
.discipline-btn.selected {
  background: #E8292A;
  border-color: #E8292A;
  color: #fff;
}
.discipline-btn.locked { opacity: 0.4; cursor: not-allowed; }

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.input-group label {
  display: block;
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.input-group input, .input-group select {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.input-group input:focus, .input-group select:focus {
  outline: none;
  border-color: #E8292A;
}

.btn-primary {
  background: #E8292A;
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: #1a1a1a;
  color: #aaa;
  border: 1px solid #2a2a2a;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.btn-secondary:hover { color: #fff; border-color: #444; }

/* SEMANA */
.week-summary {
  background: #141414;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.week-title { font-size: 14px; color: #aaa; }
.discipline-bar { margin-bottom: 16px; }
.bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
}
.bar-name { font-size: 14px; font-weight: 600; }
.bar-stats { font-size: 12px; color: #888; }
.bar-track {
  height: 8px;
  background: #1a1a1a;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s;
}
.bar-fill.green { background: #2ecc71; }
.bar-fill.yellow { background: #f39c12; }
.bar-fill.red { background: #e74c3c; }
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 8px;
}
.status-badge.green { background: #2ecc71; color: #000; }
.status-badge.yellow { background: #f39c12; color: #000; }
.status-badge.red { background: #e74c3c; color: #fff; }

/* HISTÓRICO */
.history-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.history-filter select {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.history-count { color: #888; font-size: 12px; margin-left: auto; }
.entries-list {
  background: #141414;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 16px 24px;
  max-height: 600px;
  overflow-y: auto;
}
.entry {
  display: grid;
  grid-template-columns: 120px 1fr 90px 70px 30px;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #1a1a1a;
  font-size: 13px;
  align-items: center;
}
.entry:last-child { border-bottom: none; }
.entry-date { color: #888; }
.entry-discipline { font-weight: 600; }
.entry-time { color: #aaa; }
.entry-duration { color: #E8292A; font-weight: 700; }
.entry-via-timer { color: #2ecc71; font-size: 10px; margin-left: 4px; }
.delete-btn {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 18px;
  transition: color 0.15s;
}
.delete-btn:hover { color: #e74c3c; }

/* CHECK-IN */
.checkin-card {
  background: #141414;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.checkin-question { margin-bottom: 20px; }
.checkin-question label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
}
.checkin-question textarea {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #fff;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
}
.checkin-question textarea:focus {
  outline: none;
  border-color: #E8292A;
}
.checkin-saved-mark {
  font-size: 11px;
  color: #2ecc71;
  text-align: right;
  margin-bottom: 16px;
  opacity: 0;
  transition: opacity 0.3s;
}
.checkin-saved-mark.visible { opacity: 1; }

.empty-state {
  text-align: center;
  color: #555;
  padding: 40px 20px;
  font-size: 13px;
}

.export-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.export-area {
  margin-top: 24px;
  padding: 16px;
  background: #1a1a1a;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}
.export-hint { font-size: 11px; color: #888; margin-bottom: 8px; }
.export-area pre {
  color: #ccc;
  font-size: 12px;
  white-space: pre-wrap;
  font-family: "SF Mono", Monaco, monospace;
  max-height: 300px;
  overflow-y: auto;
  word-break: break-word;
}

.insights {
  background: #1a1a1a;
  border-left: 3px solid #E8292A;
  padding: 12px 16px;
  margin-top: 16px;
  border-radius: 4px;
  font-size: 13px;
  color: #ccc;
  line-height: 1.6;
}
.insights strong { color: #fff; }

/* CRONÔMETRO */
.timer-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #141414 100%);
  border: 2px solid #E8292A;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 20px;
  text-align: center;
  transition: border-color 0.3s;
}
.timer-card.paused { border-color: #f39c12; }
.timer-card.idle { border-color: #2a2a2a; }
.timer-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.timer-discipline {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  min-height: 28px;
}
.timer-display {
  font-size: 56px;
  font-weight: 800;
  font-family: "SF Mono", Monaco, "Courier New", monospace;
  color: #E8292A;
  letter-spacing: 2px;
  margin: 12px 0;
  font-variant-numeric: tabular-nums;
}
.timer-display.paused { color: #f39c12; }
.timer-display.idle { color: #444; }
.timer-display.running {
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { text-shadow: 0 0 0 rgba(232, 41, 42, 0); }
  50% { text-shadow: 0 0 20px rgba(232, 41, 42, 0.4); }
}

.timer-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.timer-btn {
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  min-width: 120px;
  font-family: inherit;
}
.timer-btn.start { background: #2ecc71; color: #000; }
.timer-btn.pause { background: #f39c12; color: #000; }
.timer-btn.stop { background: #E8292A; color: #fff; }
.timer-btn.cancel { background: #333; color: #aaa; }
.timer-btn:hover:not(:disabled) { opacity: 0.85; transform: translateY(-1px); }
.timer-btn:active:not(:disabled) { transform: translateY(0); }
.timer-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.timer-meta {
  font-size: 12px;
  color: #666;
  margin-top: 12px;
  min-height: 18px;
}
.timer-meta span { color: #aaa; }

.divider {
  text-align: center;
  color: #444;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 24px 0 16px;
  position: relative;
}
.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #222;
}
.divider::before { left: 0; }
.divider::after { right: 0; }

/* ANALYTICS */
.analytics-card {
  background: #141414;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.analytics-card .card-header { margin-bottom: 16px; }
.analytics-card h2 { font-size: 15px; margin-bottom: 4px; color: #fff; }
.analytics-card .card-sub { font-size: 12px; color: #888; }

.heatmap-grid { display: grid; gap: 3px; }
.heatmap-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: center; }
.heatmap-row-label { font-size: 12px; color: #aaa; text-align: right; padding-right: 4px; }
.heatmap-cells { display: grid; gap: 2px; grid-auto-flow: column; grid-auto-columns: 1fr; min-width: 0; }
.heatmap-cell {
  aspect-ratio: 1;
  background: #1a1a1a;
  border-radius: 2px;
  min-width: 8px;
  cursor: default;
}
.heatmap-cell.l1 { background: #5a1014; }
.heatmap-cell.l2 { background: #8a1820; }
.heatmap-cell.l3 { background: #b8202b; }
.heatmap-cell.l4 { background: #E8292A; }

.histo {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 4px;
  align-items: end;
  min-height: 140px;
  margin-top: 8px;
}
.histo-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 140px;
  position: relative;
}
.histo-bar-fill {
  background: #E8292A;
  border-radius: 3px 3px 0 0;
  width: 100%;
  min-height: 1px;
  transition: height 0.3s;
}
.histo-label {
  font-size: 9px;
  color: #666;
  text-align: center;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.histo-value {
  font-size: 9px;
  color: #aaa;
  text-align: center;
  position: absolute;
  top: -14px;
  width: 100%;
}

.trend {
  display: flex;
  align-items: end;
  gap: 6px;
  min-height: 160px;
  padding-top: 20px;
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.trend-stack {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  height: 160px;
  border-radius: 3px;
  overflow: hidden;
  background: #1a1a1a;
}
.trend-seg { width: 100%; transition: height 0.3s; }
.trend-label { font-size: 9px; color: #666; text-align: center; }

.trend-legend {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
  font-size: 11px;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.footer {
  text-align: center;
  color: #444;
  font-size: 11px;
  padding: 24px 0 12px;
  margin-top: 32px;
  border-top: 1px solid #1a1a1a;
}
