/* San Mares — Sistema de Gestão de Condomínio */
/* Estilo baseado no JudicialMonitor */

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

:root {
  --blue: #1e40af;
  --blue-dark: #1e3a8a;
  --blue-light: #dbeafe;
  --green: #16a34a;
  --green-light: #dcfce7;
  --yellow: #f59e0b;
  --yellow-light: #fef3c7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #374151;
  --gray-900: #111827;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 10px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f4f8;
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── NAVBAR ── */
.navbar {
  background: var(--blue-dark);
  color: white;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 24px;
  flex-shrink: 0;
}
.navbar-icon { font-size: 20px; }
.navbar-title { font-weight: 700; font-size: 15px; white-space: nowrap; }
.navbar-nav {
  display: flex;
  list-style: none;
  gap: 2px;
  flex: 1;
}
.navbar-nav a {
  display: block;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.navbar-nav a:hover,
.navbar-nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  flex-shrink: 0;
}

/* ── CONTAINER ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
}
.text-muted { color: var(--gray-500); font-size: 13px; }
.text-center { text-align: center; }

/* ── CARD ── */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── STAT CARDS ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 0;
}
.cards-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.stat-card {
  padding: 16px;
  border-left: 4px solid var(--blue);
  text-align: center;
}
.stat-icon { font-size: 24px; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--gray-900); }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ── AÇÕES RÁPIDAS ── */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--gray-700);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s;
}
.action-btn:hover {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue-dark);
}
.action-icon { font-size: 20px; }

/* ── TABELAS ── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--gray-50); }
.table tfoot td { padding: 10px 12px; }
.table.table-leituras th { padding: 8px 6px; font-size: 10px; }
.table.table-leituras td { padding: 6px 6px; }
.sub-header th { background: white; font-size: 10px; font-weight: 600; color: var(--gray-500); text-transform: none; }
.row-pago { opacity: 0.65; }

.input-leitura {
  width: 90px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  text-align: right;
}
.input-leitura:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(30,64,175,0.1);
}
.estimativa { font-size: 13px; min-width: 90px; }

/* ── FORMULÁRIOS ── */
.field-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field-group label { font-size: 12px; font-weight: 600; color: var(--gray-700); }
input[type=text], input[type=email], input[type=number], input[type=password],
select, textarea {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
  background: white;
}
small.text-muted { font-size: 11px; color: var(--gray-500); }
.form-row { display: flex; gap: 12px; }
.form-row .field-group { flex: 1; }

/* ── BOTÕES ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-full { width: 100%; }

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: none;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-sm:hover { opacity: 0.8; }
.btn-blue { background: #dbeafe; color: #1d4ed8; }
.btn-green { background: #dcfce7; color: #15803d; }
.btn-success { background: #bbf7d0; color: #166534; }
.btn-red { background: #fee2e2; color: #b91c1c; }

.actions-cell { white-space: nowrap; display: flex; gap: 4px; }

/* ── BADGES ── */
.badge {
  display: inline-block;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-green { background: var(--green-light); color: #15803d; }
.badge-blue { background: var(--blue-light); color: #1d4ed8; }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-red { background: var(--red-light); color: #b91c1c; }

/* ── ALERTAS ── */
.alert {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}
.alert-success { background: var(--green-light); color: #166534; border: 1px solid #86efac; }
.alert-error { background: var(--red-light); color: #991b1b; border: 1px solid #fca5a5; }

/* ── INFO BANNER ── */
.info-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #1e3a8a;
}

/* ── LOGIN ── */
.login-page {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-container { width: 100%; max-width: 400px; }
.login-card {
  background: white;
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.login-logo { font-size: 52px; text-align: center; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 800; text-align: center; color: var(--gray-900); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--gray-500); text-align: center; margin-bottom: 24px; }
.login-footer { color: rgba(255,255,255,0.5); font-size: 12px; text-align: center; margin-top: 24px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .cards-grid-3 { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .navbar-nav { display: none; }
  .container { padding: 16px 12px; }
  .page-header { flex-direction: column; gap: 12px; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 8px 6px; }
  .actions-cell { flex-direction: column; }
}
