:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --font-family: "Inter", system-ui, -apple-system, sans-serif;

  --status-success-bg: #dcfce7;
  --status-success-text: #166534;
  --status-error-bg: #fee2e2;
  --status-error-text: #991b1b;
  --navbar-bg: #111827;
}

body.dark {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --status-success-bg: #064e3b;
  --status-success-text: #6ee7b7;
  --status-error-bg: #7f1d1d;
  --status-error-text: #fca5a5;
  --navbar-bg: #020617;
}

/* Dark mode specific tweaks */
body.dark .badge-gray {
  background-color: #334155;
  color: #e2e8f0;
}
body.dark .badge-blue {
  background-color: #1e3a8a;
  color: #93c5fd;
}
body.dark .badge-purple {
  background-color: #581c87;
  color: #d8b4fe;
}
body.dark #readme-preview {
  color: #cbd5e1;
}
body.dark #readme-preview h1,
body.dark #readme-preview h2,
body.dark #readme-preview h3,
body.dark #readme-preview th,
body.dark #readme-preview td,
body.dark #readme-preview blockquote {
  border-color: #334155;
}
body.dark #readme-preview th {
  background-color: #0f172a;
}
body.dark #readme-preview tr {
  background-color: #1e293b;
  border-color: #334155;
}
body.dark #readme-preview tr:nth-child(2n) {
  background-color: #0f172a;
}
body.dark #readme-preview pre {
  background-color: #0f172a;
  border: 1px solid #334155;
}
body.dark #readme-preview code {
  background-color: #334155;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Navbar */
.navbar {
  background-color: #111827;
  color: white;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
}
.brand span {
  font-weight: 400;
  color: #9ca3af;
}

.navbar .nav-link {
  color: #e5e7eb;
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
}
.navbar .nav-link:hover {
  color: white;
}

/* Navbar dropdown (DB submenu) */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-caret {
  font-size: 0.8rem;
  opacity: 0.9;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  margin-top: 0;
  padding: 0.4rem;
  padding-top: 0.35rem;
  border-radius: 0 0 0.5rem 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-top: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  z-index: 3000;
}

/* Sem gap: o submenu encosta no trigger para não perder hover ao mover o mouse */
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.4rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-dropdown-menu a:hover {
  background: var(--bg-color);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.container-wide {
  max-width: 98%;
  padding: 0 1rem;
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}
.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Typography & Badges */
h1 {
  font-size: 1.875rem;
  font-weight: 800;
  margin-bottom: 1rem;
}
h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-main);
}
h3 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 0.375rem;
  font-weight: 600;
}
.badge-gray {
  background-color: #f3f4f6;
  color: #4b5563;
}
.badge-red {
  background-color: var(--status-error-bg);
  color: var(--status-error-text);
}
.badge-green {
  background-color: var(--status-success-bg);
  color: var(--status-success-text);
}
.badge-blue {
  background-color: #dbeafe;
  color: #1e40af;
}
.badge-purple {
  background-color: #f3e8ff;
  color: #6b21a8;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
  font-size: 0.875rem;
}
.btn-primary {
  background-color: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-dark {
  background-color: #1f2937;
  color: white;
}
.btn-dark:hover {
  background-color: #111827;
}

.btn-success {
  background-color: #059669;
  color: white;
}
.btn-success:hover {
  background-color: #047857;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Console Output */
.console-box {
  background-color: #111827;
  color: #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-top: 1.5rem;
}
.console-header {
  background-color: #1f2937;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #9ca3af;
  border-bottom: 1px solid #374151;
}
.console-body {
  padding: 1rem;
  font-family: "Menlo", "Monaco", "Courier New", monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Utilities */
.text-right {
  text-align: right;
}
.text-sm {
  font-size: 0.6rem;
}
.text-muted {
  color: var(--text-muted);
}
.mt-2 {
  margin-top: 0.5rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  items-align: flex-start;
}
.gap-2 {
  gap: 0.5rem;
}
.hidden {
  display: none;
}

/* Readme Preview override - GitHub-like Style */
#readme-preview {
  font-size: 16px;
  line-height: 1.6;
  color: #24292f;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

#readme-preview h1,
#readme-preview h2,
#readme-preview h3 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
}

#readme-preview h1 {
  font-size: 2em;
  border-bottom: 1px solid #d0d7de;
  padding-bottom: 0.3em;
}
#readme-preview h2 {
  font-size: 1.5em;
  border-bottom: 1px solid #d0d7de;
  padding-bottom: 0.3em;
}
#readme-preview h3 {
  font-size: 1.25em;
}

#readme-preview p {
  margin-bottom: 16px;
}

#readme-preview code {
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  background-color: #afb8c133;
  border-radius: 6px;
  font-family:
    ui-monospace,
    SFMono-Regular,
    SF Mono,
    Menlo,
    Consolas,
    Liberation Mono,
    monospace;
}

#readme-preview pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: #f6f8fa;
  border-radius: 6px;
  margin-bottom: 16px;
}
#readme-preview pre code {
  background-color: transparent;
  padding: 0;
}

#readme-preview table {
  border-spacing: 0;
  border-collapse: collapse;
  margin-bottom: 16px;
  width: 100%;
  display: block;
  overflow: auto;
}

#readme-preview table th,
#readme-preview table td {
  padding: 6px 13px;
  border: 1px solid #d0d7de;
}

#readme-preview table th {
  font-weight: 600;
  background-color: #f6f8fa;
}

#readme-preview table tr {
  background-color: #ffffff;
  border-top: 1px solid #d8dee4;
}

#readme-preview table tr:nth-child(2n) {
  background-color: #f6f8fa;
}

#readme-preview blockquote {
  padding: 0 1em;
  color: #57606a;
  border-left: 0.25em solid #d0d7de;
  margin: 0 0 16px 0;
}

#readme-preview ul,
#readme-preview ol {
  padding-left: 2em;
  margin-bottom: 16px;
}

/* Dashboard Styles */
.dashboard-card {
  border: none;
  border-radius: 12px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  overflow: hidden;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-card {
  text-align: center;
  padding: 1.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.5rem;
}

.dashboard-table th {
  background-color: var(--bg-color);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.nav-tabs .nav-link {
  color: var(--text-muted);
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 1rem 1.5rem;
}

.nav-tabs .nav-link:hover {
  color: var(--primary-color);
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  background: transparent;
}

body.dark .dashboard-table th {
  background-color: #1e293b;
}

.badge-pill {
  padding-right: 0.6em;
  padding-left: 0.6em;
  border-radius: 10rem;
}

/* Dark Mode Tables */
body.dark table th {
  background-color: #1e293b !important;
  color: #e2e8f0;
  border-color: #334155 !important;
}
body.dark table td {
  border-color: #334155 !important;
  color: #cbd5e1;
}
body.dark table tr:hover {
  background-color: #1e293b !important;
}
body.dark .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.05);
}
body.dark input[type="text"],
body.dark input[type="number"] {
  background-color: #1e293b;
  border-color: #334155;
  color: #f3f4f6;
}
