/* =============================================
   CLICK HUB — DESIGN SYSTEM
   Manrope + Click Brand Colors
   ============================================= */

:root {
  --yellow:    #ffc200;
  --blue:      #02adf5;
  --green:     #51be54;
  --purple:    #a16afe;
  --black:     #000000;
  --white:     #ffffff;

  --sidebar-bg:    #0d0d0d;
  --sidebar-text:  rgba(255,255,255,0.6);
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active-bg: rgba(2,173,245,0.15);
  --sidebar-active-text: #02adf5;

  --primary: #02adf5;
  --primary-hover: #019de0;
  --primary-light: rgba(2,173,245,0.10);
  --accent: #ffc200;

  --bg:        #f5f6fa;
  --surface:   #ffffff;
  --border:    #e8eaed;
  --border-light: #f0f2f5;

  --text-primary:   #0d0d0d;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --sidebar-width: 220px;
  --topbar-height: 58px;

  --transition: 0.18s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---- LAYOUT SHELL ---- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); }
.sidebar-toggle svg { width: 18px; height: 18px; }

.breadcrumb {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 7px 14px;
  width: 100%;
  max-width: 420px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2,173,245,0.10);
}
.search-bar svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar kbd {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Manrope', sans-serif;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 160px;
  justify-content: flex-end;
}

.topbar-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.topbar-btn:hover { background: var(--bg); color: var(--text-primary); }
.topbar-btn svg { width: 18px; height: 18px; }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--yellow);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), #ff9900);
  color: var(--black);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 4px;
}

/* ---- VIEW CONTAINER ---- */
.view-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px;
  background: var(--bg);
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- UTILITY ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.font-medium { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* Scrollbar personalizado */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

/* =============================================
   DARK MODE
   ============================================= */
[data-theme="dark"] {
  --bg:           #0f172a;
  --surface:      #1a2535;
  --border:       #263448;
  --border-light: #1a2535;

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --primary-light:  rgba(2,173,245,0.15);
  --sidebar-hover:  rgba(255,255,255,0.05);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
  --shadow:    0 4px 12px rgba(0,0,0,0.45), 0 2px 4px rgba(0,0,0,0.25);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.55), 0 4px 8px rgba(0,0,0,0.35);
}

/* ---- Inputs / Select ---- */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #1a2535 !important;
  color: #e2e8f0 !important;
  border-color: #263448 !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #64748b !important; }

/* ---- Topbar / Search ---- */
[data-theme="dark"] .topbar { background: var(--surface); border-bottom-color: var(--border); }
[data-theme="dark"] .search-bar { background: #0f172a; border-color: #263448; }
[data-theme="dark"] .search-bar kbd { background: #0f172a; border-color: #263448; color: #64748b; }

/* ---- Scrollbar ---- */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #263448; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #344860; }

/* ============================================
   INLINE STYLE OVERRIDES (bg colors)
   Colores hardcodeados más comunes del app
   ============================================ */

/* Blanco puro */
[data-theme="dark"] [style*="background:#fff;"],
[data-theme="dark"] [style*="background: #fff;"],
[data-theme="dark"] [style*="background:#ffffff;"],
[data-theme="dark"] [style*="background: #ffffff;"] { background: #1a2535 !important; }
/* Blanco al final del atributo (sin ; final) */
[data-theme="dark"] [style$="background:#fff"],
[data-theme="dark"] [style$="background: #fff"],
[data-theme="dark"] [style$="background:#ffffff"],
[data-theme="dark"] [style$="background: #ffffff"] { background: #1a2535 !important; }

/* Grises claros — fondos de filas, secciones */
[data-theme="dark"] [style*="background:#f8fafc"] { background: #1a2535 !important; }
[data-theme="dark"] [style*="background:#f8f9fb"] { background: #141e2e !important; }
[data-theme="dark"] [style*="background:#f5f7fa"] { background: #141e2e !important; }
[data-theme="dark"] [style*="background:#f5f9ff"] { background: rgba(2,173,245,0.08) !important; }
[data-theme="dark"] [style*="background:#f5f6fa"] { background: #141e2e !important; }
[data-theme="dark"] [style*="background:#f1f5f9"] { background: #1a2535 !important; }
[data-theme="dark"] [style*="background:#f0f2f5"] { background: #1a2535 !important; }
[data-theme="dark"] [style*="background:#e2e8f0"] { background: #263448 !important; }
[data-theme="dark"] [style*="background:#edf2f7"] { background: #1a2535 !important; }

/* Rojo claro — alertas, vencidas */
[data-theme="dark"] [style*="background:#fef2f2"] { background: rgba(220,38,38,0.14) !important; }
[data-theme="dark"] [style*="background:#fff1f2"] { background: rgba(220,38,38,0.14) !important; }
[data-theme="dark"] [style*="background:#fee2e2"] { background: rgba(220,38,38,0.14) !important; }

/* Verde claro — pagadas, success */
[data-theme="dark"] [style*="background:#f0fdf4"] { background: rgba(81,190,84,0.12) !important; }
[data-theme="dark"] [style*="background:#dcfce7"] { background: rgba(81,190,84,0.14) !important; }
[data-theme="dark"] [style*="background:#bbf7d0"] { background: rgba(81,190,84,0.14) !important; }

/* Amarillo claro — warnings */
[data-theme="dark"] [style*="background:#fffbeb"] { background: rgba(255,194,0,0.12) !important; }
[data-theme="dark"] [style*="background:#fefce8"] { background: rgba(255,194,0,0.12) !important; }
[data-theme="dark"] [style*="background:#fde68a"] { background: rgba(255,194,0,0.14) !important; }

/* Azul claro — info, links */
[data-theme="dark"] [style*="background:#eff6ff"] { background: rgba(2,173,245,0.12) !important; }
[data-theme="dark"] [style*="background:#dbeafe"] { background: rgba(2,173,245,0.12) !important; }
[data-theme="dark"] [style*="background:#bfdbfe"] { background: rgba(2,173,245,0.14) !important; }
[data-theme="dark"] [style*="background:#e0f2fe"] { background: rgba(2,173,245,0.12) !important; }

/* Morado claro */
[data-theme="dark"] [style*="background:#f5f3ff"] { background: rgba(161,106,254,0.12) !important; }
[data-theme="dark"] [style*="background:#ede9fe"] { background: rgba(161,106,254,0.12) !important; }

/* ============================================
   TEXT COLOR OVERRIDES
   Textos oscuros que no se ven en fondo dark
   ============================================ */
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color:#0a1628"],
[data-theme="dark"] [style*="color:#0a0f1e"],
[data-theme="dark"] [style*="color:#0d0d0d"],
[data-theme="dark"] [style*="color:#000000"],
[data-theme="dark"] [style*="color:#111827"],
[data-theme="dark"] [style*="color:#1e293b"],
[data-theme="dark"] [style*="color:#1a1a2e"] { color: #e2e8f0 !important; }

[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color:#374151"],
[data-theme="dark"] [style*="color:#4b5563"],
[data-theme="dark"] [style*="color:#475569"] { color: #94a3b8 !important; }

[data-theme="dark"] [style*="color:#6b7280"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color:#9ca3af"],
[data-theme="dark"] [style*="color:#94a3b8"] { color: #64748b !important; }

/* ---- Border overrides ---- */
[data-theme="dark"] [style*="border:1px solid #e2e8f0"] { border-color: #263448 !important; }
[data-theme="dark"] [style*="border:1px solid #e8eaed"] { border-color: #263448 !important; }
[data-theme="dark"] [style*="border:1px solid #f1f5f9"] { border-color: #1e2d40 !important; }
[data-theme="dark"] [style*="border-top:1px solid #f1f5f9"] { border-top-color: #1e2d40 !important; }
[data-theme="dark"] [style*="border-bottom:1px solid #f1f5f9"] { border-bottom-color: #1e2d40 !important; }
[data-theme="dark"] [style*="border:1px solid #fecaca"] { border-color: rgba(220,38,38,0.35) !important; }
[data-theme="dark"] [style*="border:1px solid #bbf7d0"] { border-color: rgba(81,190,84,0.35) !important; }
[data-theme="dark"] [style*="border:1px solid #fde68a"] { border-color: rgba(255,194,0,0.35) !important; }

/* ---- Modales / overlays ---- */
[data-theme="dark"] #_compartirModalWrap > div,
[data-theme="dark"] .modal-content { background: #1a2535 !important; }

/* ---- Transición suave ---- */
body, .topbar, .card, .kpi-card, .sidebar, .view-container, .main-area {
  transition: background 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}
