/**
 *   REPLICA SYSTEM
 * Design Inspired by:  .com
 */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
  /* Paleta de Cores   */
  --bg: #10141b;
  --bg-secondary: #141922;
  --panel: #141922;
  --panel2: #1c2330;
  --panel-hover: #262c36;
  
  /* Acentos   (Laranja/Amarelo) */
  --accent: #ffa400;
  --accent-light: #ffb833;
  --accent-dark: #cc8400;
  --accent-rgb: 255, 164, 0;
  
  /* Texto */
  --text: #ffffff;
  --text-secondary: #9ca3af;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  
  /* Borders e Linhas */
  --line: rgba(38, 44, 54, 0.4);
  --line-light: rgba(38, 44, 54, 0.6);
  --line-hover: rgba(255, 164, 0, 0.3);
  
  /* Sombras */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-accent: 0 0 15px rgba(255, 164, 0, 0.2);
  
  /* Raio de Borda */
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  
  /* Tipografia */
  --font-display: 'Roboto', system-ui, -apple-system, sans-serif;
  --font-body: 'Roboto', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Transições */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 250ms ease-in-out;
}

/* ============================================
   RESET E BASE
   ============================================ */

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

html, body {
  height: 100%;
  width: 100%;
  background-color: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   TIPOGRAFIA
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5em;
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: all var(--transition-fast);
}

a:hover {
  color: var(--accent-light);
}

/* ============================================
   LAYOUT SHELL
   ============================================ */

.shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR (Estilo  )
   ============================================ */

.sidebar {
  width: 240px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  transition: transform var(--transition-base);
}

.sb-top {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.sb-brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-nav {
  flex: 1;
  padding: 15px 10px;
  overflow-y: auto;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  color: var(--text-secondary);
  border-radius: var(--radius);
  margin-bottom: 4px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sb-link:hover {
  background-color: var(--panel2);
  color: var(--accent);
  text-decoration: none;
}

.sb-link.active {
  background-color: var(--accent);
  color: #000;
}

.sb-link.active .sb-ico {
  opacity: 1;
}

.sb-ico {
  font-size: 18px;
  opacity: 0.7;
}

.sb-bottom {
  padding: 15px 10px;
  border-top: 1px solid var(--line);
}

.sb-link.danger {
  color: #ef4444;
}

.sb-link.danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius);
}

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

.crumbs {
  font-weight: 600;
  color: var(--accent);
}

.content {
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================
   CARDS (Estilo  )
   ============================================ */

.card {
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--line-light);
}

.card.hero {
  background: linear-gradient(to right, #1c2330, #141922);
  border-left: 4px solid var(--accent);
}

.hero-h1 {
  color: var(--accent);
  margin-bottom: 8px;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.input, .select, textarea {
  background-color: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius);
  outline: none;
  width: 100%;
  transition: all var(--transition-fast);
}

.input:focus, .select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 164, 0, 0.2);
}

/* ============================================
   BOTÕES
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background-color: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 8px;
}

.btn:hover {
  background-color: var(--panel-hover);
  border-color: var(--line-light);
}

.btn.primary {
  background-color: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn.primary:hover {
  background-color: var(--accent-light);
  border-color: var(--accent-light);
  transform: translateY(-1px);
}

/* ============================================
   UTILITIES & COMPONENTS
   ============================================ */

.row { display: flex; align-items: center; }
.gap { gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }


/* Filtros da aba Relatórios */
.filters-row {
  align-items: flex-end;
}

/* Container genérico para gráficos */
.chart-container {
  width: 100%;
  height: 400px;
}

/* Desktop: filtros em linha e mais compactos */
@media (min-width: 769px) {
  .filters-row.wrap {
    flex-wrap: nowrap;
  }

  .filters-row .input,
  .filters-row .select {
    width: auto;
    min-width: 160px;
    flex: 0 0 auto;
  }

  .filters-row .btn {
    white-space: nowrap;
  }
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.mini {
  background-color: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.mini .k {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.mini .v {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

/* Estilo para listas de criaturas e itens */
.media-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.media-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg);
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.media-img img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.media-qty {
  font-weight: 700;
  color: var(--accent);
}

.media-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Auth Pages */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

.brand {
  text-align: center;
  margin-bottom: 24px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--panel2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 1000;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .shell {
    flex-direction: column;
  }

  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.25rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  .toolbar {
    padding: 8px 12px;
  }

  .card {
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .stat-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .stat .k {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .stat .v {
    font-size: 16px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 0.875rem;
  }

  .input, .select, textarea {
    padding: 8px 10px;
    font-size: 0.875rem;
  }

  .chart-container {
    height: 300px;
  }
}

/* ============================================
   DETALHES DA HUNT (EXPANDIDO)
   ============================================ */

.expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  padding: 0 20px;
  background-color: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.card.expanded .expand {
  max-height: 3000px; /* Suficiente para o conteúdo */
  padding: 20px;
  border-top: 1px solid var(--line);
  margin-top: 15px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.card-row .title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.mt {
  margin-top: 20px;
}

.mt .k {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* Modal Estilos */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.open {
  display: flex;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%;
  max-width: 450px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

/* Toolbar (usado em algumas telas) */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.toolbar h1 {
  margin-bottom: 0;
}

/* ============================================
   ESTATÍSTICAS (DASHBOARD)
   ============================================ */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stat {
  background-color: var(--bg);
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-align: center;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.stat .k {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.stat .v {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
