/* =============================================
   PROPOSTA FLEX - Estilos Principais
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ---- Variáveis ---- */
:root {
  --primary:       #1a7fd4;
  --primary-dark:  #1565b8;
  --primary-light: #e8f3fd;
  --secondary:     #2ec4a5;
  --accent:        #f4a227;
  --danger:        #e05252;
  --success:       #27ae60;
  --warning:       #f4a227;
  --info:          #1a7fd4;

  --sidebar-bg:    #0f2942;
  --sidebar-hover: #1a3d5c;
  --sidebar-active:#1a7fd4;
  --sidebar-text:  #a8c0d6;
  --sidebar-width: 250px;

  --bg:            #f0f4f8;
  --bg-card:       #ffffff;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --border-radius: 12px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md:     0 4px 20px rgba(0,0,0,.12);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---- Layout ---- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 16px; font-weight: 700; color: #fff; line-height: 1.2;
}
.sidebar-logo-text span { display: block; font-size: 10px; font-weight: 400; color: var(--sidebar-text); }
.sidebar-nav { padding: 16px 0; flex: 1; }
.sidebar-section {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  color: var(--sidebar-text); text-transform: uppercase;
  padding: 12px 20px 6px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-nav a.active {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--primary);
}
.sidebar-nav a .nav-icon { font-size: 17px; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  color: var(--sidebar-text); font-size: 13px;
  padding: 8px 0; text-decoration: none;
  transition: color .2s;
}
.sidebar-footer a:hover { color: #fff; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 16px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 10px; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 0;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card);
  padding: 0 28px;
  height: 64px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
  display: none;
  background: none; border: none;
  font-size: 22px; cursor: pointer; color: var(--text);
  padding: 6px;
}
.page-content { padding: 28px; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.kpi-icon.blue  { background: #dbeeff; }
.kpi-icon.green { background: #d4f5eb; }
.kpi-icon.orange{ background: #fef3dd; }
.kpi-icon.red   { background: #fde8e8; }
.kpi-icon.teal  { background: #d4f5f0; }
.kpi-body {}
.kpi-label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px; font-weight: 500;
  border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all .2s; white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #219a52; }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover  { background: #c0392b; }
.btn-warning   { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 7px; border-radius: 8px; }
.btn-whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.btn-whatsapp:hover { background: #1ebe5d; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px; color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,127,212,.12); }
.form-control::placeholder { color: #b0bec5; }
.form-control.is-invalid { border-color: var(--danger); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { padding: 12px 14px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
.table-actions { display: flex; align-items: center; gap: 6px; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-rascunho  { background: #f1f5f9; color: #64748b; }
.badge-enviado   { background: #dbeeff; color: #1a5fa8; }
.badge-aprovado  { background: #d4f5eb; color: #1a7a4a; }
.badge-reprovado { background: #fde8e8; color: #b91c1c; }

/* ---- Alerts ---- */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 20px; }
.alert-success { background: #d4f5eb; color: #1a7a4a; border: 1px solid #a7f0d0; }
.alert-error   { background: #fde8e8; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-info    { background: var(--primary-light); color: #1a5fa8; border: 1px solid #bfdbfe; }

/* ---- Auth Pages ---- */
.auth-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f2942 0%, #1a4a7a 50%, #1a7fd4 100%);
  padding: 24px;
}
.auth-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 420px;
  padding: 40px 36px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon {
  width: 54px; height: 54px;
  background: var(--primary); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; font-weight: 700; margin-bottom: 12px;
}
.auth-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { font-size: 12px; color: var(--text-muted); }

/* ---- Dashboard charts ---- */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.dashboard-grid.full { grid-template-columns: 1fr; }
.chart-container { position: relative; height: 260px; }

/* ---- Modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 200;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px;
  box-shadow: var(--shadow-md);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); padding: 4px; line-height: 1; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Proposta pública ---- */
.proposta-publica {
  max-width: 780px; margin: 0 auto; padding: 40px 20px;
}
.proposta-header {
  background: var(--sidebar-bg); color: #fff;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: 32px 36px;
}
.proposta-body { background: #fff; padding: 32px 36px; border-radius: 0 0 var(--border-radius) var(--border-radius); box-shadow: var(--shadow-md); }
.proposta-actions { display: flex; gap: 12px; justify-content: center; margin-top: 28px; }
.proposta-actions .btn { padding: 12px 32px; font-size: 15px; }

/* ---- Itens proposta ---- */
.itens-table th, .itens-table td { padding: 10px 12px; }
.itens-table thead { background: var(--bg); }

/* ---- Filter bar ---- */
.filter-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control { min-width: 150px; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 42px; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ---- Pagination / misc ---- */
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.fw-600 { font-weight: 600; }
.font-sm { font-size: 12px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---- Seguir-up hoje badge ---- */
.followup-hoje { display: inline-block; padding: 3px 10px; background: #fef3dd; color: #b45309; border-radius: 20px; font-size: 11px; font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    width: 250px;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 28px 20px; }
  .proposta-header, .proposta-body { padding: 24px 20px; }
  .table-actions { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-control { min-width: 0; width: 100%; }
}

/* ---- Overlay sidebar mobile ---- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ---- Print ---- */
@media print {
  .sidebar, .topbar, .proposta-actions, .btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .proposta-publica { padding: 0; max-width: 100%; }
}
