/* ── CRM SPA Custom Styles ────────────────────────────────────────────────── */

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

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar { transition: width 0.3s ease, transform 0.3s ease; }
#sidebar.collapsed { width: 4.5rem; }
#sidebar.collapsed .hidden-collapsed { display: none; }
#sidebar.collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
#sidebar.collapsed .nav-item svg { margin: 0; }
#sidebar.collapsed .sidebar-brand-container { padding-left: 0.75rem; padding-right: 0.75rem; justify-content: center; }
#sidebar.collapsed .sidebar-footer-info { justify-content: center; margin-bottom: 0.5rem; }
#sidebar.collapsed .sidebar-logoutBtn { justify-content: center; padding-left: 0; padding-right: 0; }
#sidebar.collapsed #sidebar-toggle-btn svg { transform: rotate(180deg); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-item:hover { background: #f1f5f9; color: #1e293b; }
.nav-item.active { background: #eff6ff; color: #2563eb; }
.nav-item.active svg { stroke: #2563eb; }

/* ── Drawer ──────────────────────────────────────────────────────────────── */
#drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
#drawer-overlay.open { opacity: 1; visibility: visible; }

#drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(480px, 100vw);
  background: #fff;
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
}
#drawer.open { transform: translateX(0); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.125rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  pointer-events: all;
  animation: toast-in 0.3s ease forwards;
  max-width: 340px;
}
.toast.removing { animation: toast-out 0.3s ease forwards; }
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-info    { background: #2563eb; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateX(32px) scale(0.95); }
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.client-row {
  transition: background 0.15s;
  cursor: pointer;
}
.client-row:hover td { filter: brightness(0.96); }

/* ── Cards / Stats ───────────────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.1); transform: translateY(-2px); }

/* ── Asesor Bar ──────────────────────────────────────────────────────────── */
.asesor-bar-fill {
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.3rem;
}
.form-input {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.form-input:disabled { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }

/* ── Login ───────────────────────────────────────────────────────────────── */
#view-login {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}
#view-login::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 20%, rgba(59,130,246,0.18) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(99,102,241,0.15) 0%, transparent 50%);
}

/* ── Badge ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

/* ── History Timeline ────────────────────────────────────────────────────── */
.timeline-item { position: relative; padding-left: 1.5rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 0.375rem; top: 1.5rem;
  bottom: 0; width: 2px;
  background: #e2e8f0;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute;
  left: 0; top: 0.375rem;
  width: 0.75rem; height: 0.75rem;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #3b82f6;
}

/* ── Responsive tweaks ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { position: fixed; top: 0; left: 0; height: 100vh; z-index: 30; transform: translateX(-100%); }
  #sidebar.mobile-open { transform: translateX(0); }
  #main-content { margin-left: 0 !important; }
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fade-up 0.35s ease forwards; }

.section-view { display: none; }
.section-view.active { display: block; }
