/* GPL — Sistema de Gestão de Pagamentos de Leilão | Deep Dark Theme */

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

:root {
  --bg-primary:     #0b0e14;
  --bg-sidebar:     #151921;
  --accent:         #007bff;
  --text-primary:   #e6e6e6;
  --text-secondary: #8b949e;
  --bg-card:        #1c2130;
  --border-color:   #2d333b;
}

/* ── Base ───────────────────────────────────────────────── */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
}

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

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.sidebar-subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.sidebar-nav {
  list-style: none;
  padding: 0.75rem 0;
  flex: 1;
}

.sidebar-nav li {
  margin: 0.125rem 0;
}

.sidebar-nav li button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  text-align: left;
}

.sidebar-nav li button:hover {
  background-color: rgba(0, 123, 255, 0.08);
  color: var(--text-primary);
}

.sidebar-nav li button.active {
  background-color: rgba(0, 123, 255, 0.14);
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: 250px;
  flex: 1;
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

/* ── Pages ───────────────────────────────────────────────── */
section[id^="page-"] {
  display: none;
}

section[id^="page-"].active {
  display: block;
}

/* ── Page Title ──────────────────────────────────────────── */
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

/* ── Form ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-label .optional {
  font-weight: normal;
  color: var(--text-secondary);
}

.form-control,
.form-select {
  display: block;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: auto;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.form-control::placeholder {
  color: var(--text-secondary);
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

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

.btn-primary:hover {
  background-color: #0056b3;
}

/* ── Actions Bar ─────────────────────────────────────────── */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.counter-badge {
  display: inline-block;
  background-color: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  margin-left: 0.3rem;
}

/* ── Alert ───────────────────────────────────────────────── */
.alert-danger {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background-color: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #f87171;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* ── Spinner ─────────────────────────────────────────────── */
#spinner-monitoramento {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Table ───────────────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

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

.table-monitoramento thead th {
  background-color: var(--bg-sidebar);
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.table-monitoramento tbody tr:nth-child(odd) {
  background-color: var(--bg-card);
}

.table-monitoramento tbody tr:nth-child(even) {
  background-color: #161b27;
}

.table-monitoramento tbody tr:hover {
  background-color: rgba(0, 123, 255, 0.07);
}

.table-monitoramento tbody td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge-sem-placa {
  display: inline-block;
  background-color: #dc3545;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.06em;
}

.placa-badge {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.875rem;
  background: rgba(0, 123, 255, 0.1);
  border: 1px solid rgba(0, 123, 255, 0.3);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }

  .sidebar-header .sidebar-logo,
  .sidebar-header .sidebar-subtitle,
  .sidebar-nav li button span {
    display: none;
  }

  .main-content {
    margin-left: 60px;
    padding: 1.5rem 1rem;
  }
}

/* ── Observações ──────────────────────────────────────────── */
textarea.form-control {
  resize: vertical;
  min-height: 70px;
  font-family: inherit;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  font-style: italic;
}

/* ── Obs Tooltip na Tabela ────────────────────────────────── */
.obs-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.obs-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: rgba(0, 123, 255, 0.15);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(0, 123, 255, 0.3);
  transition: background-color 0.15s;
}

.obs-icon:hover {
  background-color: rgba(0, 123, 255, 0.3);
}

.obs-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1c2130;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  white-space: normal;
  min-width: 180px;
  max-width: 280px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: opacity 0.2s, visibility 0.2s;
  pointer-events: none;
  margin-bottom: 6px;
  word-wrap: break-word;
}

.obs-cell:hover .obs-tooltip {
  visibility: visible;
  opacity: 1;
}

.obs-empty {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

/* Validação condicional visual */
textarea.form-control.obs-required {
  border-color: #f0ad4e;
}

textarea.form-control.obs-required:focus {
  box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.25);
  border-color: #f0ad4e;
}
