/* ============================================================
   style.css — Tronux Design System (Plataforma Slate Gray Dark Theme)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Outfit:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ── Default / Light Mode ── */
:root {
  --font-heading: 'Outfit', sans-serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tronux Cobre Palette */
  --cobre-base: #894225;
  --cobre-light: #b05733;
  --cobre-dark: #662f19;
  --cobre-gradient: linear-gradient(135deg, #894225 0%, #b05733 100%);
  --cobre-glow: rgba(137, 66, 37, 0.25);

  --bg-main: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-dark: #030303;

  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-faint: #94A3B8;
  --text-inverse: #FFFFFF;

  --accent-gold: #894225;
  --accent-gold-hover: #662f19;
  --accent-gold-light: rgba(137, 66, 37, 0.08);

  --border-light: #E2E8F0;
  --border-focus: #894225;

  --status-pago-bg: #ECFDF5;
  --status-pago-text: #047857;
  --status-pago-border: #A7F3D0;

  --status-aberto-bg: #FFFBEB;
  --status-aberto-text: #B45309;
  --status-aberto-border: #FDE68A;

  --status-vencido-bg: #FEF2F2;
  --status-vencido-text: #B91C1C;
  --status-vencido-border: #FECACA;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --transition-normal: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease;
}

/* ── Dark Mode Overrides (Plataforma Tronux Theme) ── */
[data-theme="dark"] {
  --bg-main: #0E131F;
  --bg-surface: #141C2B;
  --bg-subtle: #1C273A;
  --bg-dark: #070A10;

  --text-main: #F8FAFC;
  --text-muted: #9CA3AF;
  --text-faint: #64748B;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: #894225;

  --accent-gold: #b05733;
  --accent-gold-hover: #894225;
  --accent-gold-light: rgba(137, 66, 37, 0.15);

  --status-pago-bg: rgba(16, 185, 129, 0.12);
  --status-pago-text: #34D399;
  --status-pago-border: rgba(52, 211, 153, 0.25);

  --status-aberto-bg: rgba(245, 158, 11, 0.12);
  --status-aberto-text: #FBBF24;
  --status-aberto-border: rgba(251, 191, 36, 0.25);

  --status-vencido-bg: rgba(239, 68, 68, 0.12);
  --status-vencido-text: #F87171;
  --status-vencido-border: rgba(248, 113, 113, 0.25);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.7);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] body {
  background: radial-gradient(ellipse at 50% -20%, #2D3E55 0%, #131B2A 50%, #090D15 100%);
  background-attachment: fixed;
}

/* ── Typography Helpers ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.mono {
  font-family: var(--font-mono);
}

/* ── Topbar / Header ── */
.topbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.topbar-inner {
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.topbar-brand img {
  height: 24px;
  width: auto;
  object-fit: contain;
  filter: brightness(0);
  transition: filter 0.25s ease;
}

[data-theme="dark"] .topbar-brand img {
  filter: brightness(0) invert(1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar-user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ── Layout & Containers ── */
.container {
  max-width: 1160px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

/* ── Cards & Surfaces ── */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  transition: background-color 0.25s ease;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

.card-body {
  padding: 1.75rem;
}

/* ── Metrics Grid ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-height: 112px;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.metric-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold-light);
  color: var(--accent-gold);
  flex-shrink: 0;
}

.metric-icon-blue {
  background: rgba(59, 130, 246, 0.12);
  color: #3B82F6;
}

.metric-icon-success {
  background: var(--status-pago-bg);
  color: var(--status-pago-text);
}

.metric-icon-danger {
  background: var(--status-vencido-bg);
  color: var(--status-vencido-text);
}

.metric-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.metric-value-sm {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value-success {
  color: var(--status-pago-text);
  font-size: 1.15rem;
  font-weight: 700;
}

.metric-value-danger {
  color: var(--status-vencido-text);
  font-size: 1.15rem;
  font-weight: 700;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.1rem;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  line-height: 1.25;
}

.upcoming-date {
  font-weight: 700;
  color: var(--accent-gold);
  font-size: 0.75rem;
  flex-shrink: 0;
  font-family: var(--font-mono, monospace);
}

.upcoming-name {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-normal);
  white-space: nowrap;
}

.btn-gold {
  background: var(--cobre-gradient);
  color: #FFFFFF;
  border: none;
}

.btn-gold:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--cobre-glow);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-light);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-loading {
  pointer-events: none;
  opacity: 0.75;
}

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

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--cobre-base);
  box-shadow: 0 0 0 3px rgba(137, 66, 37, 0.15);
}

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

/* ── Password Wrapper & Toggle Eye Button ── */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper input {
  padding-right: 2.75rem !important;
}

.btn-toggle-password {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-toggle-password:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.08);
}

/* ── Modern Table ── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

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

.table th {
  background-color: var(--bg-subtle);
  padding: 0.85rem 1.25rem;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-main);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background-color: var(--bg-subtle);
}

/* ── Status Badges ── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}

.badge-status.pago {
  background-color: var(--status-pago-bg);
  color: var(--status-pago-text);
  border: 1px solid var(--status-pago-border);
}

.badge-status.a-vencer {
  background-color: rgba(59, 130, 246, 0.12);
  color: #2563EB;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .badge-status.a-vencer {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-status.em-aberto, .badge-status.vencido {
  background-color: var(--status-vencido-bg);
  color: var(--status-vencido-text);
  border: 1px solid var(--status-vencido-border);
}

/* ── Tabs Component ── */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.75rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.85rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 420px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--cobre-base);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: var(--transition-normal);
}

.toast.toast-success {
  border-left-color: #10B981;
}

.toast.toast-error {
  border-left-color: #EF4444;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-main);
  font-weight: 500;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.1rem;
}

.toast-close:hover {
  color: var(--text-main);
}

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Modal Overlay & Dialog ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 3, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-surface);
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  transform: scale(0.95);
  transition: var(--transition-normal);
  color: var(--text-main);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}
