/* Horas Estudadas - Style v3 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --text: #1a202c;
  --text2: #4a5568;
  --text3: #a0aec0;
  --primary: #FF6B6B;
  --primary-light: #ffe0e0;
  --secondary: #4ECDC4;
  --secondary-light: #e0faf8;
  --accent: #667EEA;
  --success: #48BB78;
  --warning: #F6AD55;
  --danger: #FC8181;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}



body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
}

/* HEADER */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  gap: 16px;
  box-shadow: var(--shadow);
}
.logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
}
.nav-desktop {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  user-select: none;
}
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--primary); color: #fff; }

/* MAIN & SECTIONS */
main { max-width: 760px; margin: 0 auto; padding: 24px 16px; }
.section { display: none; }
.section.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.container { display: flex; flex-direction: column; gap: 20px; }

/* STREAK */
.streak-card {
  background: linear-gradient(135deg, var(--primary), #ff8e53);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(255,107,107,0.35);
}
.streak-icon { font-size: 1.5rem; }
.streak-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.streak-label { font-size: 0.875rem; opacity: 0.9; }
.streak-best { margin-left: auto; font-size: 0.8rem; opacity: 0.8; white-space: nowrap; }

/* TIMER */
.timer-area { display: flex; justify-content: center; padding: 8px 0; }
.timer-ring {
  position: relative;
  width: 220px;
  height: 220px;
}
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-prog {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 553;
  stroke-dashoffset: 553;
  transition: stroke-dashoffset 0.5s ease;
}
.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timer-display { font-size: 2.2rem; font-weight: 700; letter-spacing: 2px; }
.timer-sub { font-size: 0.8rem; color: var(--text2); margin-top: 4px; }

/* SUBJECT ROW */
.subject-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.select {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color var(--transition);
}
.select:focus { outline: none; border-color: var(--primary); }

/* TIMER CONTROLS */
.timer-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
}
.btn-ctrl {
  border: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}
.btn-ctrl:hover { transform: scale(1.08); }
.btn-play {
  width: 64px;
  height: 64px;
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 16px rgba(255,107,107,0.4);
}
.btn-reset, .btn-save {
  width: 48px;
  height: 48px;
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text2);
}
.btn-save { background: var(--secondary-light); border-color: var(--secondary); color: var(--secondary); }

/* PROGRESS */
.progress-section { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.875rem; font-weight: 600; color: var(--text); }
.progress-bar { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 99px; transition: width 0.5s ease; }

/* SESSIONS */
.sessions-list { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.session-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.session-row:last-child { border-bottom: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sname { flex: 1; font-weight: 500; }
.sdur { color: var(--text2); font-size: 0.8rem; }

/* MOTIVATION */
.motivation-card {
  background: linear-gradient(135deg, var(--secondary), #38b2ac);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.9rem;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 4px 16px rgba(78,205,196,0.3);
}

/* SECTION HEADER */
.section-header { display: flex; justify-content: space-between; align-items: center; }
.section-header h2 { font-size: 1.25rem; font-weight: 700; display: flex; gap: 8px; align-items: center; }

/* WEEKLY OVERVIEW */
.weekly-overview { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.week-grid { display: flex; gap: 8px; align-items: flex-end; height: 120px; }
.week-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.week-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.week-bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.5s ease; opacity: 0.7; }
.week-day.today .week-bar { opacity: 1; }
.week-lbl { font-size: 0.7rem; color: var(--text2); }
.week-val { font-size: 0.65rem; color: var(--text3); }
.week-day.today .week-lbl { color: var(--primary); font-weight: 700; }

/* GOALS */
.goals-list { display: flex; flex-direction: column; gap: 12px; }
.goal-card { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.goal-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gname { flex: 1; font-weight: 600; }
.ghours { font-size: 0.875rem; color: var(--text2); }
.btn-del { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; border-radius: 4px; transition: color var(--transition); }
.btn-del:hover { color: var(--danger); }

/* STATS */
.stats-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-val { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.stat-lbl { font-size: 0.75rem; color: var(--text2); margin-top: 4px; }
.period-toggle { display: flex; gap: 4px; }
.period-btn { padding: 6px 14px; border: 2px solid var(--border); background: var(--surface2); color: var(--text2); border-radius: 20px; cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all var(--transition); }
.period-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chart-wrap { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); overflow: hidden; }
.bar-chart { display: flex; gap: 3px; align-items: flex-end; height: 140px; overflow: hidden; }
.bar-wrap { flex: 1; min-width: 0; display: flex; align-items: flex-end; height: 100%; }
.bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; opacity: 0.7; transition: height 0.5s ease; min-height: 4px; }
.bar.bar-today { opacity: 1; background: var(--secondary); }
.bar-labels { display: flex; gap: 3px; margin-top: 6px; overflow: hidden; }
.bar-labels span { flex: 1; min-width: 0; text-align: center; font-size: 0.6rem; color: var(--text3); white-space: nowrap; overflow: hidden; }
.distribution { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.dist-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 0.875rem; }
.dist-name { flex: 1; }
.dist-pct { color: var(--text2); width: 36px; text-align: right; }
.mini-bar { flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.mini-bar div { height: 100%; border-radius: 99px; }

/* REPORTS */
.report-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.month-nav { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cal-header { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; margin-bottom: 8px; }
.cal-header span { text-align: center; font-size: 0.7rem; color: var(--text3); font-weight: 600; }
.cal-body { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-empty { aspect-ratio: 1; }
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: default;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.cal-day span { font-weight: 500; }
.cal-day small { font-size: 0.6rem; color: var(--text2); margin-top: 2px; }
.cal-day.has-data { border-color: var(--secondary); }
.cal-day.cal-today { border: 2px solid var(--primary); font-weight: 700; }

/* SETTINGS */
.settings-group { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.settings-group h3 { font-size: 1rem; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.setting-row { display: flex; align-items: center; justify-content: space-between; }
.setting-row label { font-size: 0.875rem; color: var(--text2); }
.setting-row input[type="number"] {
  width: 80px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
}
.subj-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.subj-row:last-child { border-bottom: none; }
.btn-icon-sm { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; color: var(--text2); font-size: 0.8rem; transition: var(--transition); }
.btn-icon-sm:hover { color: var(--accent); }
.btn-icon-sm.danger:hover { color: var(--danger); }
.danger-zone { display: flex; flex-direction: column; gap: 10px; }

/* BUTTONS */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all var(--transition); }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 2px solid var(--border); padding: 10px 18px; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: var(--transition); }
.btn-secondary:hover { border-color: var(--text2); }
.btn-danger { background: var(--primary-light); color: var(--primary); border: 2px solid var(--primary); padding: 10px 18px; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: var(--transition); }
.btn-danger:hover { background: var(--primary); color: #fff; }
.btn-icon { background: var(--surface2); border: 2px solid var(--border); color: var(--text2); width: 40px; height: 40px; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); flex-shrink: 0; }
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
.mt { margin-top: 14px; }
.empty { color: var(--text3); font-size: 0.875rem; text-align: center; padding: 20px 0; }

/* MODALS */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; }
.modal-overlay.active { display: block; }
.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 300;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 420px;
  animation: slideUp 0.2s ease;
}
.modal.active { display: block; }
@keyframes slideUp { from { transform: translate(-50%,-44%); opacity:0; } to { transform: translate(-50%,-50%); opacity:1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 0; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.btn-close { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 1rem; padding: 4px; border-radius: 4px; }
.btn-close:hover { color: var(--text); }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-body label { font-size: 0.8rem; font-weight: 600; color: var(--text2); margin-bottom: -6px; }
.modal-body input[type="text"], .modal-body input[type="number"], .modal-body select {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  width: 100%;
  transition: border-color var(--transition);
}
.modal-body input:focus, .modal-body select:focus { outline: none; border-color: var(--primary); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; }
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: var(--transition); }
.color-dot.sel { border-color: var(--text); transform: scale(1.15); }
.color-dot:hover { transform: scale(1.1); }

/* TOAST */
.toast-container { position: fixed; bottom: 90px; right: 16px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 4px solid var(--text2);
  animation: slideIn 0.3s ease;
  min-width: 220px;
}
@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }
.toast.hide { animation: slideOut 0.3s ease forwards; }
@keyframes slideOut { to { transform: translateX(120%); opacity:0; } }
.toast-success { border-color: var(--success); }
.toast-warning { border-color: var(--warning); }
.toast-error   { border-color: var(--danger); }
.toast-info    { border-color: var(--accent); }

/* MOBILE NAV */
.nav-mobile {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  color: var(--text2);
  font-size: 0.7rem;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  user-select: none;
}
.nav-item i { font-size: 1.1rem; }
.nav-item.active { color: var(--primary); }
.nav-item:hover { color: var(--primary); }

/* RESPONSIVE */
@media (max-width: 640px) {
  .nav-desktop { display: none; }
  .nav-mobile { display: flex; justify-content: space-around; }
  body { padding-bottom: 90px; }
  .stats-cards { grid-template-columns: repeat(2,1fr); }
  .report-cards { grid-template-columns: repeat(3,1fr); }
  main { padding: 16px 12px; }
  .timer-ring { width: 190px; height: 190px; }
  .timer-display { font-size: 1.8rem; }
}
@media (max-width: 400px) {
  .report-cards { grid-template-columns: 1fr 1fr; }
  .stats-cards { grid-template-columns: 1fr 1fr; }
}
