/* ══════════════════════════════════════════════
   Tema: Editorial · Serifado · Ocre + Carvão
══════════════════════════════════════════════ */

/* Tokens */
:root {
  --bg:          #0f0e0c;
  --bg-2:        #171612;
  --bg-3:        #1f1d18;
  --border:      #2e2b23;
  --border-2:    #3d3929;

  --text:        #f0ead8;
  --text-2:      #a09880;
  --text-3:      #6b6450;

  --accent:      #c9983e;
  --accent-dim:  #7d5f25;
  --accent-glow: rgba(201,152,62,.18);

  --red:         #c0392b;
  --green:       #5a9e6f;

  --font-serif:  'DM Serif Display', Georgia, serif;
  --font-sans:   'Syne', sans-serif;
  --font-mono:   'DM Mono', monospace;

  --radius:      6px;
  --radius-lg:   12px;
  --sidebar-w:   230px;
  --transition:  .18s cubic-bezier(.4,0,.2,1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  display: flex;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 28px 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 24px; line-height: 1; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--accent);
  letter-spacing: -.5px;
}

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

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: none; border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 600;
  letter-spacing: .5px; text-transform: uppercase;
  transition: var(--transition);
}
.nav-item .nav-icon { font-size: 16px; line-height: 1; }
.nav-item:hover  { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }

.sidebar-footer {
  padding: 16px 24px 0;
  border-top: 1px solid var(--border);
}
.version-tag {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text-3);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 48px 52px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 40% at 80% 10%, rgba(201,152,62,.05) 0%, transparent 60%),
    var(--bg);
}

/* Section */
.section { display: none; animation: fadeUp .28s ease; }
.section.active { display: block; }

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

.section-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 36px;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 38px; letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
}
.section-sub {
  color: var(--text-3);
  font-size: 13px; margin-top: 4px;
  font-family: var(--font-mono);
}

/* Stats Grind */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex; flex-direction: column; gap: 8px;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--border-2);
}
.stat-card.accent::before { background: var(--accent); }
.stat-card:hover { border-color: var(--border-2); transform: translateY(-2px); }

.stat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-3);
}
.stat-value {
  font-family: var(--font-serif);
  font-size: 44px; line-height: 1;
  color: var(--text);
}
.stat-card.accent .stat-value { color: var(--accent); }

/* Popular List */
.sub-heading {
  font-family: var(--font-serif);
  font-size: 22px; margin-bottom: 16px;
  color: var(--text-2);
}
.popular-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.popular-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.popular-list .pop-count {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 10px; border-radius: 20px;
}

/* Barra de Pesquisa */
.search-bar { margin-bottom: 20px; }
.search-bar input {
  width: 100%; max-width: 440px;
  padding: 10px 16px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 14px; outline: none;
  transition: var(--transition);
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-3); }

/* Filter Tabs */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tab-btn {
  padding: 7px 18px;
  border: 1px solid var(--border); border-radius: 20px;
  background: transparent; color: var(--text-2);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  transition: var(--transition);
}
.tab-btn:hover  { border-color: var(--border-2); color: var(--text); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #0f0e0c; }

/* Table */
.table-wrapper {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: auto;
}
.data-table { width: 100%; border-collapse: collapse; }

.data-table thead th {
  padding: 13px 16px;
  background: var(--bg-3);
  text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-3); }
.data-table td {
  padding: 12px 16px;
  color: var(--text-2);
  font-size: 13px;
}
.data-table td:first-child {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text-3);
}

/* Status badge */
.badge {
  display: inline-block;
  padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
}
.badge-active  { background: rgba(90,158,111,.15); color: var(--green); }
.badge-done    { background: rgba(96,96,96,.15);   color: var(--text-3); }

/* Botões de Ação */
.actions-cell { display: flex; gap: 6px; }
.btn-icon {
  padding: 5px 10px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: transparent; color: var(--text-2);
  font-size: 12px; transition: var(--transition);
}
.btn-icon:hover         { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover  { border-color: var(--red);    color: var(--red); }
.btn-icon.success:hover { border-color: var(--green);  color: var(--green); }

/* Botões */
.btn-primary {
  padding: 10px 22px;
  background: var(--accent); color: #0f0e0c;
  border: none; border-radius: var(--radius);
  font-weight: 700; font-size: 13px; letter-spacing: .4px;
  transition: var(--transition);
}
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }

.btn-secondary {
  padding: 10px 22px;
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 600; font-size: 13px;
  transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--border-2); color: var(--text); }

.btn-danger {
  padding: 10px 22px;
  background: var(--red); color: #fff;
  border: none; border-radius: var(--radius);
  font-weight: 700; font-size: 13px;
  transition: var(--transition);
}
.btn-danger:hover { filter: brightness(1.1); }

/* Modais */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn .18s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  padding: 32px 36px;
  animation: slideUp .22s ease;
}
.modal-box--sm { max-width: 380px; }

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

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 26px; color: var(--text);
}
.modal-close {
  background: none; border: none;
  color: var(--text-3); font-size: 18px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-form { display: flex; flex-direction: column; gap: 18px; }

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

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-3);
}
.form-group input,
.form-group select {
  padding: 10px 14px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 14px; outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }
.form-group select option { background: var(--bg-2); }

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 8px;
}

.confirm-msg { color: var(--text-2); margin-bottom: 24px; line-height: 1.6; }

/* Toast */
.toast {
  position: fixed; bottom: 32px; right: 32px;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  z-index: 9999;
  animation: slideLeft .22s ease;
  max-width: 340px;
}
.toast.hidden { display: none; }
.toast.success { background: var(--green);  color: #fff; }
.toast.error   { background: var(--red);    color: #fff; }
.toast.info    { background: var(--accent); color: #0f0e0c; }

@keyframes slideLeft {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Empty State */
.empty-row td {
  text-align: center; padding: 40px 16px !important;
  color: var(--text-3); font-style: italic;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Responsivo */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { width: 60px; padding: 20px 0; }
  .brand-name, .nav-item span:last-child, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .main-content { margin-left: 60px; padding: 32px 24px; }
  .form-row { grid-template-columns: 1fr; }
}
