/* ── VendaLeads — Custom CSS ──────────────────────────────────────── */

/* Offset para navbar fixa em todos os anchors */
:target,
[id] { scroll-margin-top: 72px; }

:root {
  --green:          #16a34a;
  --green-dark:     #15803d;
  --green-light:    #dcfce7;
  --dark-brand:     #0f172a;
  --dark-secondary: #1e293b;
  --sidebar-w:      240px;
  --navbar-h:       60px;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --text-main:      #0f172a;
  --text-muted:     #64748b;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 40px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  --radius:         12px;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

/* ── Colors ───────────────────────────────────────────────────────── */
.text-green      { color: var(--green) !important; }
.bg-green        { background-color: var(--green) !important; }
.bg-green-soft   { background-color: rgba(22,163,74,.10) !important; }
.btn-green       { background-color: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn-green:hover { background-color: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-outline-green { color: var(--green); border-color: var(--green); font-weight: 500; }
.btn-outline-green:hover { background-color: var(--green); color: #fff; }
.border-green    { border-color: var(--green) !important; }
.btn-white        { background-color: #fff; border-color: #e2e8f0; color: var(--text-main); box-shadow: var(--shadow-sm); }
.btn-white:hover  { background-color: #f8fafc; border-color: #cbd5e1; color: var(--text-main); }
.bg-dark-brand    { background-color: var(--dark-brand) !important; }
.bg-dark-secondary{ background-color: var(--dark-secondary) !important; }

/* ── Landing Page ─────────────────────────────────────────────────── */
/* Hero styles are inline in index.php for isolation */

.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 40%, #f0f9ff 100%);
  display: flex;
  align-items: center;
}

/* ── App Layout ───────────────────────────────────────────────────── */
.app-body {
  background: var(--surface-2);
}

.app-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  z-index: 1030;
  display: flex;
  align-items: center;
  background: var(--dark-brand) !important;
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 1px 0 rgba(0,0,0,.3), 0 4px 20px rgba(0,0,0,.25);
}

.app-layout {
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
}

.app-sidebar {
  width: var(--sidebar-w);
  min-height: calc(100vh - var(--navbar-h));
  position: sticky;
  top: var(--navbar-h);
  display: flex;
  flex-direction: column;
  background: var(--dark-secondary);
  transition: width .25s ease;
  overflow: hidden;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.05);
}

.app-sidebar.collapsed { width: 58px; }
.app-sidebar.collapsed .sidebar-link span,
.app-sidebar.collapsed .sidebar-section-label,
.app-sidebar.collapsed .sidebar-footer .sidebar-footer-name { display: none; }
.app-sidebar.collapsed .sidebar-link { justify-content: center; padding: 10px 0; }

.app-content {
  min-height: calc(100vh - var(--navbar-h));
  background: var(--surface-2);
  max-width: calc(100vw - var(--sidebar-w));
  overflow-x: hidden;
}

/* ── Sidebar Nav ──────────────────────────────────────────────────── */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 14px 12px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: rgba(255,255,255,.60);
  text-decoration: none;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  transition: all .15s ease;
  position: relative;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.95);
}

.sidebar-link.active {
  background: var(--green);
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(22,163,74,.35);
}

.sidebar-link i { font-size: 1.05rem; flex-shrink: 0; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ── Navbar Brand ─────────────────────────────────────────────────── */
.navbar-brand-vl {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.navbar-brand-vl .accent { color: var(--green); }

/* ── Avatars ──────────────────────────────────────────────────────── */
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar-md { width: 40px; height: 40px; font-size: .9rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }

/* ── Page Header ──────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -.02em;
}
.page-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 16px 20px !important;
  font-weight: 600;
}

/* ── KPI Cards ────────────────────────────────────────────────────── */
.kpi-card {
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
}
.kpi-card .kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.kpi-card .kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text-main);
  line-height: 1;
}
.kpi-card .kpi-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.kpi-delta        { font-size: .72rem; font-weight: 600; }
.kpi-delta.up     { color: #16a34a; }
.kpi-delta.down   { color: #ef4444; }

/* ── Stat Cards (admin) ───────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.04em; }
.stat-card .stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }

/* ── Pipeline ─────────────────────────────────────────────────────── */
.pipeline-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
  min-height: 600px;
}

.pipeline-column {
  min-width: 240px;
  max-width: 240px;
  background: #f1f5f9;
  border-radius: var(--radius);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.pipeline-column-header {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.pipeline-cards {
  padding: 8px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipeline-cards.drag-over { background: rgba(22,163,74,.08); border-radius: 0 0 var(--radius) var(--radius); }

.pipeline-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  cursor: grab;
  transition: box-shadow .15s, transform .15s;
  font-size: .825rem;
}
.pipeline-card:hover   { box-shadow: var(--shadow-md); }
.pipeline-card.dragging{ opacity: .5; transform: rotate(2deg); cursor: grabbing; }

/* ── Badges ───────────────────────────────────────────────────────── */
.notif-badge { font-size: .6rem !important; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-xs {
  padding: 2px 8px;
  font-size: .7rem;
  line-height: 1.5;
  border-radius: 4px;
}

/* ── Typography ───────────────────────────────────────────────────── */
.smaller  { font-size: .75rem; }
.opacity-60 { opacity: .6; }
.opacity-90 { opacity: .9; }
.fw-700 { font-weight: 700; }

/* ── Forms ────────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: #d1d5db;
  border-radius: 8px;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
  outline: none;
}
.form-label { font-weight: 500; font-size: .875rem; color: var(--text-main); }

/* ── Tables ───────────────────────────────────────────────────────── */
.table { font-size: .875rem; }
.table th { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: #f8fafc; }
.table tbody tr { transition: background .1s; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table td, .table th { vertical-align: middle; padding: 12px 14px; }

/* ── Nav tabs ─────────────────────────────────────────────────────── */
.nav-tabs {
  border-bottom: 2px solid var(--border);
  gap: 4px;
}
.nav-tabs .nav-link {
  border: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .875rem;
  padding: 8px 16px;
  border-radius: 6px 6px 0 0;
  transition: all .15s;
}
.nav-tabs .nav-link:hover { color: var(--text-main); background: rgba(0,0,0,.04); }
.nav-tabs .nav-link.active {
  color: var(--green) !important;
  font-weight: 600;
  background: transparent;
  border-bottom: 2px solid var(--green) !important;
  margin-bottom: -2px;
}

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius) !important; border: 1px solid; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

/* ── IA loading spinner ───────────────────────────────────────────── */
@keyframes pulse-green {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}
.ia-btn { transition: .15s; }
.ia-btn:disabled { animation: pulse-green 1.5s ease infinite; }

/* ── Dropdown menus ───────────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.dropdown-item {
  border-radius: 6px;
  font-size: .875rem;
  padding: 7px 12px;
  transition: background .12s;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.active, .dropdown-item:active { background: var(--green); color: #fff; }

/* ── Admin Visit Bar ──────────────────────────────────────────────── */
.admin-visit-bar {
  background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  padding: 6px 20px;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1040;
}
.app-navbar-visited { top: 32px !important; }
.app-sidebar-visited { top: calc(var(--navbar-h) + 32px) !important; }
.app-layout-visited { margin-top: calc(var(--navbar-h) + 32px) !important; }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }

/* ── Progress bar ─────────────────────────────────────────────────── */
.progress { height: 6px; border-radius: 99px; background: #e2e8f0; }
.progress-bar { border-radius: 99px; background: var(--green); }

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    top: var(--navbar-h);
    left: -280px;
    z-index: 1020;
    height: calc(100vh - var(--navbar-h));
    transition: left .25s ease;
    box-shadow: none;
  }
  .app-sidebar.mobile-open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .app-content { max-width: 100vw; }
  .pipeline-container { min-height: 400px; }
}

/* ── Utility ──────────────────────────────────────────────────────── */
.rounded-xl { border-radius: var(--radius) !important; }
.gap-2 { gap: 8px; }
.cursor-pointer { cursor: pointer; }
.transition { transition: all .15s ease; }

/* ── Admin Layout ─────────────────────────────────────────────────── */
:root { --admin-sidebar: 240px; }

.admin-sidebar {
  width: var(--admin-sidebar);
  height: 100vh;
  background: #0f172a;
  position: fixed;
  top: 0; left: 0;
  display: flex; flex-direction: column;
  z-index: 1000;
  border-right: 1px solid rgba(255,255,255,.05);
  overflow: hidden;
}
.admin-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.admin-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
  box-shadow: 0 2px 8px rgba(22,163,74,.4);
  flex-shrink: 0;
}
.admin-brand-name { font-weight: 800; font-size: .95rem; color: #fff; letter-spacing: -.02em; }
.admin-brand-name span { color: #16a34a; }
.admin-brand-role { font-size: .68rem; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

.admin-nav {
  flex: 1; padding: 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.admin-nav-section {
  font-size: .65rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.25);
  padding: 12px 8px 4px;
}
.admin-nav-link {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.55); padding: 9px 10px; border-radius: 8px;
  text-decoration: none; font-size: .85rem; font-weight: 500;
  transition: all .15s ease;
}
.admin-nav-link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.admin-nav-link:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.admin-nav-link.active { background: #16a34a; color: #fff; box-shadow: 0 2px 8px rgba(22,163,74,.3); }
.admin-nav-link-danger { color: rgba(239,68,68,.7) !important; }
.admin-nav-link-danger:hover { background: rgba(239,68,68,.1) !important; color: #ef4444 !important; }
.admin-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.admin-sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; gap: 2px; }

.admin-main { margin-left: var(--admin-sidebar); min-height: 100vh; background: #f4f6fa; }

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 500;
  box-shadow: 0 1px 0 #e2e8f0, 0 2px 8px rgba(0,0,0,.04);
}
.admin-topbar-title { font-weight: 700; font-size: 1.05rem; color: #0f172a; letter-spacing: -.02em; }
.admin-topbar-sub { font-size: .78rem; color: #64748b; }

.badge-status-ativo     { background: #dcfce7; color: #16a34a; }
.badge-status-trial     { background: #fef9c3; color: #b45309; }
.badge-status-suspenso  { background: #fee2e2; color: #dc2626; }
.badge-status-cancelado { background: #f1f5f9; color: #64748b; }
.status-pill { padding: 3px 12px; border-radius: 99px; font-size: .73rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.trend-up   { color: #16a34a; font-size: .75rem; font-weight: 600; }
.trend-down { color: #dc2626; font-size: .75rem; font-weight: 600; }

@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
}
