/* ============================================================
   UberConsorcio — tema base
   Paleta: blanco, negro, azul Consorcio (#004FFE).
   Inspirado en CoreUI sobre Bootstrap 5.
============================================================ */

:root {
  --uc-blue:        #004FFE;
  --uc-blue-700:    #003DCC;
  --uc-blue-50:     #E8EFFF;
  --uc-black:       #0B0E14;
  --uc-gray-50:     #F6F7FB;
  --uc-gray-100:    #ECEEF4;
  --uc-gray-200:    #DCE0EA;
  --uc-gray-400:    #9AA3B7;
  --uc-gray-600:    #5A6378;
  --uc-gray-800:    #2A2F3C;
  --uc-text:        #11141C;
  --uc-text-muted:  #6B7280;
  --uc-shadow-sm:   0 1px 2px 0 rgba(11, 14, 20, 0.04), 0 1px 3px 0 rgba(11, 14, 20, 0.06);
  --uc-shadow-md:   0 4px 12px -2px rgba(11, 14, 20, 0.08), 0 2px 6px -1px rgba(11, 14, 20, 0.05);
  --uc-radius:      10px;
  --uc-radius-sm:   8px;
}

/* ── Tipografía ─────────────────────────────────────────────── */
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  color: var(--uc-text);
  background: var(--uc-gray-50);
  margin: 0;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.01em; font-weight: 600; }

/* ── Override Bootstrap primary al azul de marca ───────────── */
.btn-primary {
  --bs-btn-bg:           var(--uc-blue);
  --bs-btn-border-color: var(--uc-blue);
  --bs-btn-hover-bg:           var(--uc-blue-700);
  --bs-btn-hover-border-color: var(--uc-blue-700);
  --bs-btn-active-bg:           var(--uc-blue-700);
  --bs-btn-active-border-color: var(--uc-blue-700);
  --bs-btn-disabled-bg:         var(--uc-blue);
  --bs-btn-disabled-border-color: var(--uc-blue);
}
.btn-outline-primary {
  --bs-btn-color:        var(--uc-blue);
  --bs-btn-border-color: var(--uc-blue);
  --bs-btn-hover-bg:     var(--uc-blue);
  --bs-btn-hover-border-color: var(--uc-blue);
  --bs-btn-active-bg:    var(--uc-blue);
  --bs-btn-active-border-color: var(--uc-blue);
}
.bg-primary  { background-color: var(--uc-blue) !important; }
.text-primary{ color:            var(--uc-blue) !important; }
.link-primary, a {
  color: var(--uc-blue);
}
a:hover { color: var(--uc-blue-700); }

.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--uc-blue);
  box-shadow: 0 0 0 .2rem rgba(0, 79, 254, .15);
}
.form-check-input:checked {
  background-color: var(--uc-blue);
  border-color: var(--uc-blue);
}

/* ── Layout principal ───────────────────────────────────────── */
.uc-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.uc-sidebar {
  width: 244px;
  background: var(--uc-blue);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1030;
}

.uc-sidebar__brand {
  padding: 1rem 1.25rem 0.875rem;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.375rem;
}
.uc-sidebar__brand .uc-logo-wordmark,
.uc-sidebar__brand .uc-logo-mark {
  width: 175px;
  height: auto;
  display: block;
  opacity: 1;
}

.uc-context-badge {
  margin: 0.875rem 0.875rem 0;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--uc-radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.uc-context-badge span {
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uc-context-badge form button {
  background: none;
  border: none;
  padding: 0;
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}
.uc-context-badge form button:hover { color: #fff; }

.uc-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.625rem 0.75rem;
}
.uc-sidebar__nav .uc-nav-section {
  padding: 0.625rem 0.75rem 0.25rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
}
.uc-sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.45rem 0.75rem;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: var(--uc-radius-sm);
  margin-bottom: 0.0625rem;
  transition: background-color .12s ease, color .12s ease;
}
.uc-sidebar__nav a:hover {
  background: rgba(255,255,255,0.10);
  color: #fff;
}
.uc-sidebar__nav a.active {
  background: #fff;
  color: var(--uc-blue);
  font-weight: 600;
}
.uc-sidebar__nav a .uc-nav-icon {
  width: 18px;
  height: 18px;
  font-size: 0.95rem;
  flex-shrink: 0;
  opacity: .9;
}

.uc-sidebar__footer {
  border-top: 1px solid rgba(255,255,255,0.14);
  padding: 0.625rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.uc-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: var(--uc-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.uc-sidebar__footer .uc-user-name { color: #fff; font-weight: 600; font-size: 0.82rem; line-height: 1.2; }
.uc-sidebar__footer .uc-user-role { color: rgba(255,255,255,0.7); font-size: 0.7rem; }
.uc-sidebar__footer form button {
  background: none;
  border: 0;
  padding: 0;
  color: rgba(255,255,255,0.7);
  font-size: 0.78rem;
  cursor: pointer;
}
.uc-sidebar__footer form button:hover { color: #fff; }

/* ── Contenido principal ────────────────────────────────────── */
.uc-main {
  flex: 1;
  margin-left: 244px;
  display: flex;
  flex-direction: column;
}
.uc-topbar {
  height: 60px;
  padding: 0 1.75rem;
  background: #fff;
  border-bottom: 1px solid var(--uc-gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.uc-topbar h1, .uc-topbar .uc-page-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--uc-text);
}
.uc-content {
  padding: 1.5rem 1.75rem 2.5rem;
  flex: 1;
}

/* ── Compatibilidad con .topbar legacy de las views ───────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.topbar h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ── Cards refinadas ────────────────────────────────────────── */
.card {
  border: 1px solid var(--uc-gray-100);
  border-radius: var(--uc-radius);
  box-shadow: var(--uc-shadow-sm);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--uc-gray-100);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
}

/* ── Tablas refinadas ───────────────────────────────────────── */
.table > :not(caption) > * > * { padding: 0.65rem 0.75rem; }
.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--uc-text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--uc-gray-100);
}
.table-light, .table > :not(caption) > * > th.table-light {
  --bs-table-bg: var(--uc-gray-50);
  border-bottom: 1px solid var(--uc-gray-100);
}
.table-hover > tbody > tr:hover > * {
  background-color: var(--uc-gray-50);
}

/* ── Badges sobrios ─────────────────────────────────────────── */
.badge {
  font-weight: 500;
  font-size: 0.74rem;
  padding: 0.32em 0.6em;
  border-radius: 6px;
  letter-spacing: 0.005em;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-label { font-size: 0.85rem; font-weight: 500; color: var(--uc-gray-800); }
.form-control, .form-select {
  border-color: var(--uc-gray-200);
  border-radius: var(--uc-radius-sm);
}

/* ── Login ──────────────────────────────────────────────────── */
.uc-auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  background: #fff;
}
.uc-auth-side {
  background: var(--uc-blue);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2.75rem 3rem;
  position: relative;
  overflow: hidden;
}
.uc-auth-side::after {
  content: '';
  position: absolute;
  bottom: -180px; right: -180px;
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 60%);
  border-radius: 50%;
}
.uc-auth-side__brand {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.uc-auth-side__brand .uc-logo-wordmark,
.uc-auth-side__brand .uc-logo-mark {
  width: 200px;
  height: auto;
  display: block;
}
.uc-auth-side__footer {
  font-size: 0.78rem;
  opacity: 0.65;
  letter-spacing: 0.02em;
}
.uc-auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.uc-auth-form > div { width: 100%; max-width: 380px; }

/* ── KPI cards (Dashboard) ──────────────────────────────────── */
.uc-kpi {
  background: #fff;
  border: 1px solid var(--uc-gray-100);
  border-radius: var(--uc-radius);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: var(--uc-shadow-sm);
  height: 100%;
}
.uc-kpi__label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--uc-text-muted); font-weight: 600; }
.uc-kpi__value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.uc-kpi__hint  { font-size: 0.72rem; color: var(--uc-text-muted); }

/* ── Dashboard widgets ─────────────────────────────────── */
.uc-panel {
  border: 1px solid var(--uc-gray-100);
  border-radius: var(--uc-radius);
  box-shadow: var(--uc-shadow-sm);
  background: #fff;
}
.uc-panel > .card-header {
  background: #fff;
  border-bottom: 1px solid var(--uc-gray-100);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--uc-text);
  padding: 0.65rem 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.uc-panel .card-body { padding: 0.9rem; }

.uc-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--uc-text-muted);
}
.uc-empty__title { font-weight: 600; color: var(--uc-text); font-size: 0.95rem; margin-bottom: 0.25rem; }
.uc-empty__hint { font-size: 0.85rem; }

.uc-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--uc-gray-100);
}
.uc-stat-row:last-child { border-bottom: none; padding-bottom: 0; }
.uc-stat-row__label { font-size: 0.85rem; color: var(--uc-text-muted); }
.uc-stat-row__value { font-size: 1rem; font-weight: 600; color: var(--uc-text); }

.uc-rating { text-align: center; padding: 0.25rem 0; }
.uc-rating__score { font-size: 2rem; font-weight: 700; color: var(--uc-blue); line-height: 1; }
.uc-rating__score .text-muted { font-size: 1rem; font-weight: 500; margin-left: 0.15rem; }
.uc-rating__stars { color: #f5b700; font-size: 1.05rem; letter-spacing: 0.1em; margin-top: 0.15rem; }
.uc-rating__hint { font-size: 0.72rem; color: var(--uc-text-muted); margin-top: 0.15rem; }

/* Tendencia semanal — barras CSS */
.uc-trend {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 110px;
  gap: 0.4rem;
}
.uc-trend__day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  height: 100%;
}
.uc-trend__bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  width: 100%;
  justify-content: center;
}
.uc-trend__bar {
  width: 35%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
}
.uc-trend__bar--created { background: var(--uc-blue); }
.uc-trend__bar--completed { background: #1A8754; }
.uc-trend__label {
  font-size: 0.7rem;
  color: var(--uc-text-muted);
  text-transform: capitalize;
}

.uc-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

/* Barras horizontales de progreso (top categorías) */
.uc-progress {
  width: 100%;
  height: 6px;
  background: var(--uc-gray-100);
  border-radius: 3px;
  overflow: hidden;
}
.uc-progress__bar {
  height: 100%;
  background: var(--uc-blue);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Stack horizontal segmentado (criticidad por edificio) */
.uc-stack {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--uc-gray-100);
}
.uc-stack__seg {
  height: 100%;
  transition: width 0.3s ease;
}

/* ── Mobile topbar y drawer ─────────────────────────────────── */
.uc-mobile-topbar {
  display: none; /* solo visible en mobile via media query */
  position: sticky;
  top: 0;
  z-index: 1029;
  background: var(--uc-blue);
  color: #fff;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 1rem;
  box-shadow: var(--uc-shadow-sm);
}
.uc-mobile-topbar__toggle {
  background: none;
  border: 0;
  color: #fff;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  padding: 0;
  border-radius: var(--uc-radius-sm);
}
.uc-mobile-topbar__toggle:hover { background: rgba(255,255,255,0.12); }
.uc-mobile-topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.uc-mobile-topbar__brand img {
  height: 24px;
  width: auto;
}
.uc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 14, 20, 0.45);
  z-index: 1029;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.uc-backdrop.is-open {
  display: block;
  opacity: 1;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 992px) {
  .uc-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .uc-sidebar.is-open {
    transform: translateX(0);
  }
  .uc-main         { margin-left: 0; }
  .uc-mobile-topbar { display: flex; }
  .uc-content      { padding: 1rem 1rem 2rem; }
  .topbar          { flex-wrap: wrap; gap: 0.5rem; }
  .topbar h1       { font-size: 1.15rem; }
  .uc-auth-shell   { grid-template-columns: 1fr; }
  .uc-auth-side    { display: none; }
}

/* Pantallas chicas (teléfonos, < 576px): título full-width arriba,
   acción primaria del topbar también full-width abajo. Ayuda a que
   el botón "+ Nuevo X" no quede pegado al título y sea más fácil de tocar. */
@media (max-width: 576px) {
  .uc-content      { padding: 0.875rem 0.875rem 2rem; }
  .topbar          { flex-direction: column; align-items: stretch; }
  .topbar > *      { width: 100%; }
  .topbar .btn, .topbar > a { width: 100%; text-align: center; }
  .card            { border-radius: 8px; }
  /* Filtros y formularios verticales — Bootstrap col-md-* ya stackea
     en <768px. Reforzamos el spacing entre filas. */
  .row.g-2 > [class*="col-"] { margin-bottom: 0.5rem; }
  /* Tablas en mobile: padding más chico para que entren más columnas
     antes de scroll horizontal. La table-responsive sigue scrolleando
     si no entran. */
  .table-sm > :not(caption) > * > * { padding: 0.4rem 0.4rem; }
  /* Botones de acción dentro de tablas: stack vertical para que el
     usuario no se equivoque de target. */
  td .btn + .btn,
  td .btn + form,
  td form + .btn,
  td form + form { margin-top: 0.25rem; }
  td .btn, td form .btn { display: block; width: 100%; }
}

/* En mobile el body no debe scrollear cuando el drawer está abierto */
body.uc-no-scroll { overflow: hidden; }
