/**
 * Meus Inquilinos - Estilos Mobile-First Sofisticados
 */

:root {
  --primary: #0F3934;
  --primary-light: #164e47;
  --primary-dark: #092421;
  --accent: #10B981;
  --accent-light: #d1fae5;
  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --border-color: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #DC2626;
  --danger-bg: #fef2f2;
  --warning: #D97706;
  --warning-bg: #fffbeb;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
}

.app-body {
  padding-bottom: 90px; /* Espaço para o menu inferior mobile */
}

.app-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Barra de Upgrade */
.upgrade-banner {
  background: #092421;
  color: #FFFFFF;
  padding: 10px 16px;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.upgrade-banner-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.btn-upgrade-pill {
  background: #10B981;
  color: #092421;
  border: none;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

/* Topbar */
.app-topbar, .admin-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 80;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 800;
  font-size: 18px;
}
.brand-icon {
  font-size: 22px;
}
.badge-premium {
  background: #fef08a;
  color: #854d0e;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.badge-free {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid #cbd5e1;
  cursor: pointer;
}
.btn-icon-user {
  text-decoration: none;
  font-size: 18px;
  margin-left: 8px;
}

/* Admin Nav */
.admin-nav-bar {
  background: #0f172a;
  padding: 8px 0;
  overflow-x: auto;
}
.admin-nav-links {
  display: flex;
  gap: 16px;
  white-space: nowrap;
}
.admin-nav-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}
.admin-nav-links a.active, .admin-nav-links a:hover {
  color: #FFFFFF;
  background: #1e293b;
}

/* Bottom Nav Mobile */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  flex: 1;
}
.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}
.nav-item.active {
  color: var(--primary);
}

/* Cabeçalhos de Página */
.page-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 16px;
}
.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}
.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Botões */
.btn-primary-block {
  display: block;
  width: 100%;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary-block:hover {
  background: var(--primary-light);
}
.btn-primary-sm {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
}
.btn-link-block {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  text-decoration: underline;
}
.btn-wa-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #25D366;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  text-decoration: none;
}
.btn-outline-action {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
}
.btn-share-link {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.kpi-value {
  font-size: 20px;
  font-weight: 800;
  margin: 4px 0 2px;
}
.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

/* Section Cards */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}
.occupancy-pill {
  background: var(--accent-light);
  color: #065f46;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.occupancy-stats-row {
  display: flex;
  gap: 12px;
  justify-content: space-around;
  padding-top: 8px;
}
.stat-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-num {
  font-size: 18px;
  font-weight: 800;
}
.stat-txt {
  font-size: 11px;
  color: var(--text-muted);
}

/* Área de Atenção */
.attention-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.attention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border-left: 4px solid #cbd5e1;
}
.attention-item.item-danger {
  background: var(--danger-bg);
  border-left-color: var(--danger);
}
.attention-item.item-warning {
  background: var(--warning-bg);
  border-left-color: var(--warning);
}
.attention-item.item-neutral {
  background: #f1f5f9;
  border-left-color: #94a3b8;
}
.attention-info {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.attention-info small {
  color: var(--text-muted);
  margin-top: 2px;
}
.attention-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* Badges & Status */
.badge-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.status-paid {
  background: var(--success-bg);
  color: var(--success);
}
.status-late {
  background: var(--danger-bg);
  color: var(--danger);
}
.status-pending {
  background: var(--warning-bg);
  color: var(--warning);
}

/* Filtros */
.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.filter-tab {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.filter-tab.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

/* Cards de Aluguel e Cobrança */
.charge-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}
.charge-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.charge-tenant-title {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}
.charge-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.charge-val {
  font-size: 17px;
  font-weight: 800;
  display: block;
}
.charge-due {
  font-size: 11px;
  color: var(--text-muted);
}
.charge-item-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.charge-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Formulários */
.app-form, .auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-row {
  display: flex;
  gap: 12px;
}
.col-6 { flex: 1; }
.col-8 { flex: 2; }
.col-4 { flex: 1; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  font-size: 14px;
  outline: none;
}
.form-input-lg {
  padding: 14px;
  font-size: 16px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}
.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Tabelas */
.table-responsive {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}
.data-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
}

/* Modais */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}
@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
}
.modal-sheet {
  background: var(--bg-surface);
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .modal-sheet {
    border-radius: var(--radius-lg);
  }
}
.btn-close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-weight: 700;
}
.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Benefícios Premium */
.premium-benefits-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 20px;
  font-size: 14px;
}

/* Alertas */
.alert {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}
.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a7f3d0;
}
.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde68a;
}

/* Auth Cards */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 16px;
  background: #f1f5f9;
}
.auth-container {
  width: 100%;
  max-width: 420px;
}
.auth-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}
.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}
.auth-brand-icon {
  font-size: 40px;
  margin-bottom: 8px;
}
.auth-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Página Pública de Cobrança */
.charge-public-body {
  background: #f1f5f9;
  padding: 20px 16px;
  display: flex;
  justify-content: center;
}
.charge-public-container {
  width: 100%;
  max-width: 500px;
}
.charge-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}
.charge-header {
  text-align: center;
  margin-bottom: 20px;
}
.charge-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 12px;
}
.charge-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}
.charge-property {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 4px;
}
.charge-ref {
  font-size: 13px;
  color: var(--text-muted);
}
.charge-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
  font-size: 14px;
}
.charge-row {
  display: flex;
  justify-content: space-between;
}
.charge-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 8px 0;
}
.charge-total-box {
  background: #f8fafc;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.total-label {
  font-weight: 700;
  font-size: 15px;
}
.total-value {
  font-weight: 800;
  font-size: 22px;
  color: var(--primary);
}
.pix-payment-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
  text-align: center;
}
.pix-key-wrapper {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.pix-key-text {
  flex: 1;
  background: #FFFFFF;
  border: 1px dashed #059669;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-copy-pix {
  background: #059669;
  color: #FFFFFF;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
}
