/* =============================================================
   style.css — Catálogo Pessoal
   Design: Admin Dashboard · Tema Claro/Escuro
   Fonte: Syne (display) + JetBrains Mono (code/dados)
   ============================================================= */

/* --- Variáveis: Tema Escuro (padrão) ----------------------- */
:root,
[data-theme="dark"] {
  --bg-base:      #0d0f14;
  --bg-surface:   #13161d;
  --bg-elevated:  #1a1e28;
  --bg-hover:     #1f2433;

  --accent:       #f97316;   /* laranja vibrante */
  --accent-dim:   #7c3b12;
  --accent-text:  #fff;

  --text-primary:   #e8eaf0;
  --text-secondary: #7a8099;
  --text-muted:     #454c66;

  --border:       #232840;
  --border-light: #1e2235;

  --star-filled:  #f97316;
  --star-empty:   #2e3450;

  --flash-ok-bg:  #0d2818;
  --flash-ok-txt: #4ade80;
  --flash-err-bg: #2a0d0d;
  --flash-err-txt:#f87171;

  --chart-notas: #38bdf8;   /* azul para série Notas */

  --sidebar-w: 220px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
}

/* --- Variáveis: Tema Claro ---------------------------------- */
[data-theme="light"] {
  --bg-base:      #f0f2f7;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f7f8fc;
  --bg-hover:     #edf0f7;

  --accent:       #ea6c00;
  --accent-dim:   #fde8d4;
  --accent-text:  #fff;

  --text-primary:   #111827;
  --text-secondary: #4b5675;
  --text-muted:     #a0aabf;

  --border:       #dde1ef;
  --border-light: #e8eaf5;

  --star-filled:  #ea6c00;
  --star-empty:   #d1d5e8;

  --flash-ok-bg:  #dcfce7;
  --flash-ok-txt: #166534;
  --flash-err-bg: #fee2e2;
  --flash-err-txt:#991b1b;

  --chart-notas: #0284c7;   /* azul mais escuro no tema claro */

  --shadow: 0 2px 16px rgba(0,0,0,.08);
}

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

html { font-size: 15px; }

body {
  font-family: 'Syne', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background .25s, color .25s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout (sidebar + main) ------------------------------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar ----------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  font-size: 1.4rem;
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

[data-theme="light"] .nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-email {
  font-size: .75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.btn-theme, .btn-logout {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.btn-theme:hover, .btn-logout:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

/* --- Main content ------------------------------------------ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 36px;
  min-height: 100vh;
}

/* --- Page header ------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

.page-title span {
  color: var(--accent);
}

/* --- Cards de stat (dashboard) ----------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

/* --- Tabelas ----------------------------------------------- */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background .12s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-url {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Badges / Pills ---------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: transparent;
}

[data-theme="light"] .badge-accent {
  background: #fde8d4;
  color: #ea6c00;
}

/* --- Estrelas --------------------------------------------- */
.star { font-size: .95rem; }
.star.filled { color: var(--star-filled); }
.star.empty  { color: var(--star-empty); }

/* --- Botões ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
}

.btn:hover { opacity: .88; transform: translateY(-1px); text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: #7f1d1d;
  color: #fca5a5;
}

.btn-sm {
  padding: 5px 12px;
  font-size: .78rem;
}

/* --- Formulários ------------------------------------------ */
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 720px;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Syne', sans-serif;
  font-size: .9rem;
  transition: border-color .15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control option {
  background: var(--bg-elevated);
}

/* Tags multi-select */
.tags-check-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-check-label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
}

.tag-check-label:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-check-label input { display: none; }

.tag-check-label.checked {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .tag-check-label.checked {
  background: #fde8d4;
  border-color: #ea6c00;
  color: #ea6c00;
}

/* Ranking stars input */
.star-input-wrap { display: flex; gap: 4px; }

.star-input {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--star-empty);
  transition: color .1s;
  user-select: none;
}

.star-input.on { color: var(--star-filled); }

/* --- Flash messages --------------------------------------- */
.flash {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-weight: 600;
  font-size: .88rem;
}

.flash-ok  { background: var(--flash-ok-bg);  color: var(--flash-ok-txt); }
.flash-erro{ background: var(--flash-err-bg); color: var(--flash-err-txt); }

/* --- Actions column --------------------------------------- */
.td-actions { display: flex; gap: 6px; white-space: nowrap; }

/* --- Empty state ------------------------------------------ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }

/* --- Login page ------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-brand {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 28px;
  letter-spacing: .03em;
}

.login-brand span { color: var(--accent); }

/* --- Arquivo info ----------------------------------------- */
.file-info {
  font-size: .78rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

/* --- Gráficos (dashboard) ---------------------------------- */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap--donut {
  height: 260px;
}

.section-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
}

/* --- Responsivo mínimo ------------------------------------ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .charts-grid { grid-template-columns: 1fr; }
}
