/* =========================================================
   main.css — Estilos personalizados
   Intelligence Mobil App · NODO
   ========================================================= */

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

/* Variables base */
:root {
  --mobil-blue:       #0062AA;
  --mobil-blue-dark:  #004A82;
  --mobil-blue-light: #E8F3FB;
  --mobil-red:        #E2001A;
  --mobil-red-light:  #FDE8EB;
  --bg:               #F4F7FB;
  --sidebar-w:        240px;
}

* { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: #1e293b; margin: 0; }

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

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: #0f172a;
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
  transition: transform .3s ease;
}
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: #94a3b8;
  cursor: pointer; border-left: 3px solid transparent;
  transition: all .2s; font-size: 14px; font-weight: 500;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nav-item.active { color: #fff; border-left-color: var(--mobil-red); background: rgba(226,0,26,.08); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }

/* ── Main content con sidebar ── */
.main-with-sidebar { margin-left: var(--sidebar-w); min-height: 100vh; }

/* ── Topbar ── */
.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: 50;
}

/* ── Cards ── */
.card {
  background: #fff; border-radius: 12px;
  border: 1px solid #e2e8f0; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-hover { transition: box-shadow .2s, transform .2s; }
.card-hover:hover { box-shadow: 0 4px 16px rgba(0,98,170,.12); transform: translateY(-2px); }

/* ── KPI cards ── */
.kpi-card { padding: 20px 24px; }
.kpi-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-value { font-size: 28px; font-weight: 800; line-height: 1; margin: 8px 0 4px; }
.kpi-label { font-size: 12px; font-weight: 500; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.up   { color: #16a34a; }
.kpi-delta.down { color: var(--mobil-red); }
.kpi-delta.neutral { color: #64748b; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-success   { background: #dcfce7; color: #16a34a; }
.badge-warning   { background: #fef9c3; color: #a16207; }
.badge-danger    { background: var(--mobil-red-light); color: var(--mobil-red); }
.badge-neutral   { background: #f1f5f9; color: #64748b; }
.badge-blue      { background: var(--mobil-blue-light); color: var(--mobil-blue); }
.badge-purple    { background: #f3e8ff; color: #7c3aed; }
.badge-teal      { background: #ccfbf1; color: #0d9488; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; background: #f1f5f9; border-radius: 10px; padding: 4px; }
.tab-btn {
  flex: 1; padding: 8px 16px; border: none; background: transparent;
  border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer;
  color: #64748b; transition: all .2s; white-space: nowrap;
}
.tab-btn.active { background: #fff; color: var(--mobil-blue); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tab-btn:hover:not(.active) { color: #334155; }

/* ── Progress bar ── */
.progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* ── Formularios ── */
.form-label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 14px; font-family: inherit; color: #1e293b; background: #fff;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--mobil-blue); box-shadow: 0 0 0 3px rgba(0,98,170,.1);
}
.form-textarea { resize: vertical; min-height: 90px; }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; border: none;
  transition: all .2s; text-decoration: none; font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--mobil-blue); color: #fff; }
.btn-primary:hover { background: var(--mobil-blue-dark); }
.btn-danger  { background: var(--mobil-red);  color: #fff; }
.btn-danger:hover { background: #b5001a; }
.btn-outline { background: transparent; color: var(--mobil-blue); border: 1.5px solid var(--mobil-blue); }
.btn-outline:hover { background: var(--mobil-blue-light); }
.btn-ghost   { background: transparent; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; color: #334155; }
.btn-sm      { padding: 6px 12px; font-size: 12px; }
.btn svg     { width: 16px; height: 16px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  z-index: 200; display: flex; align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  transform: translateY(20px); transition: transform .25s;
  margin: auto;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header { padding: 24px 28px 0; display: flex; align-items: flex-start; justify-content: space-between; }
.modal-body   { padding: 20px 28px 28px; }
.modal-close  { width: 32px; height: 32px; border: none; background: #f1f5f9; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-close:hover { background: #e2e8f0; }
.modal-close svg { width: 16px; height: 16px; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: toastIn .3s ease;
}
.toast.success { background: #16a34a; }
.toast.error   { background: var(--mobil-red); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ── Avatar ── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 13px;
  font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ── Upload slot (simulado) ── */
.upload-slot {
  border: 2px dashed #e2e8f0; border-radius: 10px;
  padding: 20px; text-align: center; cursor: pointer;
  transition: all .2s; background: #f8fafc;
}
.upload-slot:hover { border-color: var(--mobil-blue); background: var(--mobil-blue-light); }
.upload-slot.has-file { border-color: #16a34a; background: #f0fdf4; border-style: solid; }
.upload-slot svg { width: 28px; height: 28px; color: #94a3b8; margin-bottom: 6px; }

/* ── Checklist ── */
.checklist-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #f1f5f9; cursor: pointer;
}
.checklist-item:last-child { border-bottom: none; }
.checkbox {
  width: 20px; height: 20px; border: 2px solid #e2e8f0;
  border-radius: 5px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; transition: all .2s;
}
.checkbox.checked { background: var(--mobil-blue); border-color: var(--mobil-blue); }
.checkbox.checked svg { display: block; }
.checkbox svg { display: none; width: 12px; height: 12px; color: #fff; }

/* ── Timeline de pasos ── */
.step-timeline { position: relative; }
.step-item { display: flex; gap: 16px; padding-bottom: 24px; position: relative; }
.step-item:last-child { padding-bottom: 0; }
.step-item::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: #e2e8f0; }
.step-item:last-child::before { display: none; }
.step-number { width: 32px; height: 32px; border-radius: 50%; background: var(--mobil-blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.step-content { flex: 1; padding-top: 4px; }
.step-content h4 { font-size: 14px; font-weight: 600; color: #1e293b; margin: 0 0 4px; }
.step-content p  { font-size: 13px; color: #64748b; margin: 0; line-height: 1.5; }

/* ── Quiz ── */
.quiz-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  cursor: pointer; transition: all .2s; margin-bottom: 8px;
  font-size: 14px;
}
.quiz-option:hover { border-color: var(--mobil-blue); background: var(--mobil-blue-light); }
.quiz-option.selected { border-color: var(--mobil-blue); background: var(--mobil-blue-light); }
.quiz-option.correct  { border-color: #16a34a; background: #dcfce7; }
.quiz-option.wrong    { border-color: var(--mobil-red); background: var(--mobil-red-light); }
.quiz-radio { width: 18px; height: 18px; border: 2px solid #cbd5e1; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.quiz-option.selected .quiz-radio { border-color: var(--mobil-blue); }
.quiz-option.selected .quiz-radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--mobil-blue); display: block; }
.quiz-option.correct  .quiz-radio { border-color: #16a34a; background: #16a34a; }
.quiz-option.wrong    .quiz-radio { border-color: var(--mobil-red); background: var(--mobil-red); }

/* ── Alert type selector (BTL) ── */
.alert-type-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px; border: 2px solid #e2e8f0; border-radius: 12px;
  cursor: pointer; transition: all .2s; text-align: center;
}
.alert-type-card:hover { border-color: var(--mobil-blue); background: var(--mobil-blue-light); }
.alert-type-card.selected { border-color: var(--mobil-blue); background: var(--mobil-blue-light); }
.alert-type-card svg { width: 28px; height: 28px; }
.alert-type-card span { font-size: 12px; font-weight: 600; color: #374151; }

/* ── Looker Studio placeholder ── */
.looker-placeholder {
  background: #f8fafc; border: 2px dashed #e2e8f0; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; min-height: 420px; color: #94a3b8; text-align: center; padding: 40px;
}
.looker-placeholder svg { width: 48px; height: 48px; }
.looker-placeholder h3 { font-size: 16px; font-weight: 600; color: #64748b; margin: 0; }
.looker-placeholder p  { font-size: 13px; margin: 0; line-height: 1.5; }

/* ── Login split screen ── */
.login-left {
  background: linear-gradient(135deg, #004A82 0%, #0062AA 40%, #1a7fc4 80%, #0062AA 100%);
  position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; width: 400px; height: 400px;
  background: rgba(255,255,255,.04); border-radius: 50%;
  top: -100px; right: -100px;
}
.login-left::after {
  content: ''; position: absolute; width: 300px; height: 300px;
  background: rgba(226,0,26,.08); border-radius: 50%;
  bottom: 60px; left: -80px;
}

/* ── Responsive: mobile sidebar overlay ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-with-sidebar { margin-left: 0; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; display: none; }
  .sidebar-overlay.open { display: block; }
}

/* ── Mobile nav tabs (BTL) ── */
.mobile-tabs { background: #fff; border-bottom: 1px solid #e2e8f0; overflow-x: auto; }
.mobile-tabs::-webkit-scrollbar { display: none; }
.mobile-tab-list { display: flex; min-width: max-content; }
.mobile-tab-btn {
  padding: 14px 20px; font-size: 13px; font-weight: 500;
  color: #64748b; cursor: pointer; border: none; background: transparent;
  border-bottom: 3px solid transparent; transition: all .2s; white-space: nowrap;
}
.mobile-tab-btn.active { color: var(--mobil-blue); border-bottom-color: var(--mobil-blue); font-weight: 600; }

/* ── Section transitions ── */
.section-page { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Shimmer skeleton ── */
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Ticket priority colors ── */
.priority-high   { color: var(--mobil-red); }
.priority-medium { color: #d97706; }
.priority-low    { color: #2563eb; }

/* ── Campaign status line ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Print & share button (BTL) ── */
@media print {
  .no-print { display: none !important; }
  .sidebar, .topbar, .mobile-tabs { display: none !important; }
  .main-with-sidebar { margin-left: 0; }
}

/* ── Chatbot typing animation ── */
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .6; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Chat messages scrollbar ── */
#chatMessages::-webkit-scrollbar { width: 4px; }
#chatMessages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* ── Analytics filter panel border glow ── */
#analyticsFiltersPanel { animation: fadeIn .2s ease; }

/* ── ApexCharts tooltip override ── */
.apexcharts-tooltip { font-family: 'Inter', sans-serif !important; border-radius: 10px !important; box-shadow: 0 8px 24px rgba(0,0,0,.12) !important; }
.apexcharts-tooltip-title { font-weight: 600 !important; background: #f8fafc !important; border-bottom: 1px solid #e2e8f0 !important; }
.apexcharts-legend-text { font-family: 'Inter', sans-serif !important; }

/* ── Line-clamp utility ── */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
