/* ============================================
   CRONOGRAMA DELEGADO — ESTILO COMPLETO
   Tema: Jurídico / Clássico / Profissional
   Fonte: Playfair Display + DM Sans
============================================ */

:root {
  --bg:          #0d0d0f;
  --bg2:         #13131a;
  --bg3:         #1a1a24;
  --border:      #2a2a3a;
  --border2:     #3a3a50;
  --text:        #e8e6df;
  --text2:       #a09e96;
  --text3:       #6a6860;
  --gold:        #c9a84c;
  --gold2:       #e8c97a;
  --gold-dim:    rgba(201,168,76,.15);
  --red:         #c0392b;
  --green:       #1e8a5e;
  --radius:      12px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
  --transition:  .22s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ============ HEADER ============ */
.site-header {
  text-align: center;
  padding: 64px 24px 48px;
  background: linear-gradient(180deg, #0a0a10 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(201,168,76,.08) 0%, transparent 70%);
  pointer-events: none;
}

.header-badge {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .25em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.site-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 900;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 6px;
}

.site-title span {
  color: var(--gold);
  display: block;
}

.site-subtitle {
  font-size: 14px;
  color: var(--text3);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.header-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 18px;
  font-size: 13px;
  color: var(--text2);
}

.stat-pill span {
  color: var(--gold2);
  font-weight: 600;
}

/* ---- SYNC BUTTON ---- */
.header-sync {
  margin-top: 20px;
}

.btn-sync {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 8px 28px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sync:hover { background: var(--gold-dim); }
.btn-sync:disabled { opacity: .5; cursor: not-allowed; }

.btn-sync .spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(201,168,76,.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ NAV TABS ============ */
.tab-nav {
  display: flex;
  gap: 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 16px 24px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: var(--transition);
}

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

.tab-btn.active {
  color: var(--gold2);
  border-bottom-color: var(--gold);
}

/* ============ MAIN ============ */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .3s ease; }

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

/* ============ PANEL HEADER ============ */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

/* ============ BUTTONS ============ */
.btn-primary {
  background: var(--gold);
  color: #0d0d0f;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover { background: var(--gold2); transform: translateY(-1px); }

.btn-secondary {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 22px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover { border-color: var(--text2); color: var(--text); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: var(--transition);
}

.btn-icon:hover { color: var(--text); background: var(--bg3); }

.link-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============ WEEK GRID ============ */
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.day-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.day-card:hover { border-color: var(--border2); }

.day-header {
  padding: 14px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-name {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}

.day-hours {
  font-size: 12px;
  color: var(--text3);
}

.day-tasks {
  padding: 12px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 3px solid;
  background: rgba(255,255,255,.03);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: var(--transition);
  position: relative;
}

.task-card:hover { background: rgba(255,255,255,.06); }
.task-card.concluida { opacity: .45; }
.task-card.concluida .task-topico { text-decoration: line-through; }

.task-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: var(--transition);
}

.task-check.checked { background: currentColor; }
.task-check.checked::after { content: '✓'; color: #0d0d0f; font-weight: 700; }

.task-info { flex: 1; min-width: 0; }

.task-materia {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .8;
  margin-bottom: 2px;
}

.task-topico {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.task-time {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text3);
}

.task-tipo {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: var(--text2);
  text-transform: capitalize;
}

.task-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: var(--transition);
}

.task-card:hover .task-actions { opacity: 1; }

.day-empty {
  color: var(--text3);
  font-size: 13px;
  text-align: center;
  padding: 16px;
  font-style: italic;
}

/* ============ MATÉRIAS GRID ============ */
.materias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.materia-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  border-top: 3px solid;
  transition: var(--transition);
  position: relative;
}

.materia-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: var(--shadow); }

.materia-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.materia-nome {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  cursor: pointer;
}

.materia-nome:focus {
  outline: none;
  border-bottom: 1px dashed var(--gold);
}

.materia-cat {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 16px;
}

.materia-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.materia-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.materia-stat-label {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.materia-stat-val {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  color: var(--text);
  font-weight: 500;
}

.materia-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.materia-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .6s ease;
}

.materia-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ============ METAS ============ */
.metas-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meta-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.meta-card:hover { border-color: var(--border2); }
.meta-card.concluida { opacity: .5; }
.meta-card.concluida .meta-desc { text-decoration: line-through; }

.meta-check {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border2);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 13px;
}

.meta-check.checked {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.meta-body { flex: 1; }

.meta-desc {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}

.meta-info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--text2);
}

.meta-tag.alta { background: rgba(192,57,43,.2); color: #e05a4b; }
.meta-tag.media { background: rgba(201,168,76,.15); color: var(--gold2); }
.meta-tag.baixa { background: rgba(30,138,94,.15); color: #4ecb94; }

.meta-actions { display: flex; gap: 4px; }

/* ============ PROGRESSO ============ */
.progresso-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.progresso-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.progresso-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.progresso-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.progresso-numero {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 6px;
}

.progresso-label {
  font-size: 12px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.chart-bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chart-bar-label {
  width: 160px;
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.chart-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease;
}

.chart-bar-val {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text3);
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .25s ease;
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
}

@keyframes slideUp { from { transform: translateY(20px); opacity:0; } to { transform: none; opacity:1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
  border-radius: 6px;
}

.modal-close:hover { color: var(--text); background: var(--bg3); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============ FORM ============ */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 7px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.form-group input[type="range"] {
  padding: 0;
  accent-color: var(--gold);
}

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

.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
}

.radio-label input { width: auto; accent-color: var(--gold); }

.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-opt {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
}

.color-opt.selected,
.color-opt:hover { border-color: white; transform: scale(1.15); }

/* ============ FOOTER ============ */
.site-footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 13px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 20px;
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 999;
  animation: toastIn .3s ease;
}

@keyframes toastIn { from { transform: translateY(16px); opacity:0; } to { transform:none; opacity:1; } }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text3);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; margin-bottom: 20px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  .week-grid { grid-template-columns: 1fr; }
  .materias-grid { grid-template-columns: 1fr; }
  .progresso-cards { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .chart-bar-label { width: 100px; }
  .tab-btn { padding: 14px 16px; font-size: 13px; }
}
