/* public/css/app.css */
body {
  min-height: 100vh;
}

/* Enlaces: gris oscuro en vez del azul por defecto de Bootstrap
   (mismo criterio que el resto del tema — ver overrides de .nav-link
   y .btn-primary más abajo). No afecta a los <a class="btn ...">
   porque las clases de botón tienen más especificidad que el
   selector de elemento "a". */
a {
  color: #343a40;
}

a:hover,
a:focus {
  color: #000;
}

/* ============================================================
   Pestañas (nav-tabs/nav-pills) fuera del sidebar — p. ej.
   Disponibilidad, Tarifas de alquiler, ficha de Vehículo. Bootstrap
   por defecto pinta el texto y el estado activo en azul; se prefiere
   un gris claro/neutro (ver .app-sidebar .nav-link.active más arriba
   para el mismo criterio en el menú lateral).
   ============================================================ */
.nav-link {
  color: #495057;
}

.nav-link:hover,
.nav-link:focus {
  color: #212529;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: #212529;
  background-color: #f1f3f5;
  border-color: #dee2e6 #dee2e6 #f1f3f5;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: #212529;
  background-color: #e9ecef;
}

/* ============================================================
   Botón "Guardar" — el resto de los botones de acción pasaron de
   btn-primary a btn-success (verde); btn-primary se reserva
   específicamente para los botones de guardar, con un azul propio
   (#5664a5) en vez del azul por defecto de Bootstrap.
   ============================================================ */
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: #5664a5;
  --bs-btn-border-color: #5664a5;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #48548c;
  --bs-btn-hover-border-color: #444f83;
  --bs-btn-focus-shadow-rgb: 110, 122, 173;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #444f83;
  --bs-btn-active-border-color: #404a7a;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #5664a5;
  --bs-btn-disabled-border-color: #5664a5;
}

/* Botones outline-primary (p. ej. "Asignar" en Reservación, filtros
   secundarios) — mismo tono azul #5664a5 en vez del azul de Bootstrap. */
.btn-outline-primary {
  --bs-btn-color: #5664a5;
  --bs-btn-border-color: #5664a5;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #5664a5;
  --bs-btn-hover-border-color: #5664a5;
  --bs-btn-focus-shadow-rgb: 86, 100, 165;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #5664a5;
  --bs-btn-active-border-color: #5664a5;
  --bs-btn-disabled-color: #5664a5;
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: #5664a5;
  --bs-gradient: none;
}

/* ============================================================
   Layout con sidebar (inspirado en el layout de proOffice/AdminLTE:
   menú lateral oscuro agrupado por módulo + top bar delgado).
   Ver vistas/layout/{header,nav,footer}.php.
   ============================================================ */

:root {
  --sidebar-width: 250px;
  --sidebar-width-mini: 64px;
  --sidebar-bg: #1e2a3a;
  --sidebar-bg-hover: #2c3c50;
  --sidebar-text: #c9d4e0;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #3d7dfa;
  --topbar-height: 56px;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.app-wrapper.no-sidebar {
  display: block;
}

/* ── Sidebar ── */
.app-sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width .15s ease, flex-basis .15s ease, transform .2s ease;
  z-index: 1030;
}

.app-sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background: rgba(0, 0, 0, .15);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

.app-sidebar-brand .brand-text {
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
}

.app-sidebar-nav {
  padding: .5rem 0 1rem;
}

.app-sidebar .nav-link {
  color: var(--sidebar-text);
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  border-radius: 0;
  white-space: nowrap;
  overflow: hidden;
}

.app-sidebar .nav-link i:first-child {
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 1.05rem;
}

.app-sidebar .nav-label {
  margin-left: .6rem;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link:focus {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
}

.app-sidebar .nav-link.active {
  background: #e9ecef;
  color: #1e2a3a;
}

.app-sidebar .nav-group-toggle .nav-chevron {
  transition: transform .15s ease;
  font-size: .75rem;
}

.app-sidebar .nav-group-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.app-sidebar .nav-group-items {
  list-style: none;
  margin: 0;
  padding: 0;
  background: rgba(0, 0, 0, .12);
}

.app-sidebar .nav-group-items .nav-link {
  padding-left: 2.1rem;
  font-size: .92rem;
}

/* ── Modo "mini" (solo íconos), equivalente al sidebar-mini de AdminLTE ── */
@media (min-width: 992px) {
  .app-wrapper.sidebar-mini .app-sidebar {
    width: var(--sidebar-width-mini);
    flex-basis: var(--sidebar-width-mini);
  }
  .app-wrapper.sidebar-mini .app-sidebar-brand .brand-text,
  .app-wrapper.sidebar-mini .app-sidebar .nav-label,
  .app-wrapper.sidebar-mini .app-sidebar .nav-chevron {
    display: none;
  }
  .app-wrapper.sidebar-mini .app-sidebar .nav-group-items {
    display: none !important;
  }
}

/* ── Top bar ── */
.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-main-full {
  width: 100%;
}

.app-topbar {
  height: var(--topbar-height);
  padding: 0 1rem;
  background: #1e2a3a;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  position: sticky;
  top: 0;
  z-index: 1020;
}

/* Botón de contraer/expandir sidebar — antes btn-outline-secondary
   (gris oscuro sobre gris oscuro, ilegible con el fondo nuevo). */
.app-topbar #sidebarToggle {
  color: #c9d4e0;
  border-color: rgba(255, 255, 255, .3);
  background: transparent;
}

.app-topbar #sidebarToggle:hover,
.app-topbar #sidebarToggle:focus {
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .4);
}

/* Dropdown de usuario — antes btn-light (blanco sobre blanco, se
   perdía contra el fondo del topbar). El menú desplegable en sí sigue
   siendo blanco/Bootstrap por defecto, que ya contrasta bien. */
.app-topbar .dropdown-toggle {
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
}

.app-topbar .dropdown-toggle:hover,
.app-topbar .dropdown-toggle:focus,
.app-topbar .dropdown-toggle.show {
  color: #fff;
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .3);
}

.app-content {
  padding: 1.25rem;
  flex: 1 1 auto;
}

/* ── Pie de página ── (al estilo del .main-footer de proOffice: franja
   angosta con la versión de un lado y el copyright del otro — ver
   vistas/layout/app_footer.php). Versión a la izquierda, copyright a
   la derecha (a propósito al revés que en proOffice, así lo pidió el
   cliente). */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .5rem 1rem;
  padding: .6rem 1.25rem;
  border-top: 1px solid #dee2e6;
  background: #fff;
  font-size: .82rem;
  color: #6c757d;
  flex-shrink: 0;
}

.app-footer a {
  color: #5664a5;
}

.app-footer a:hover,
.app-footer a:focus {
  color: #444f83;
}

/* ── Cajón (drawer) en móviles ── */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 2px 0 12px rgba(0, 0, 0, .25);
  }
  .app-wrapper.sidebar-open .app-sidebar {
    transform: translateX(0);
  }
}

/* ============================================================
   Disponibilidad — vista "Día" con horas (vistas/disponibilidad/index.php).
   Línea de tiempo de 24h por vehículo, estilo Google Calendar: cada
   evento se posiciona con left/width en % sobre las 24 horas del día.
   ============================================================ */
.disp-timeline-wrap {
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  overflow: hidden;
  background: #fff;
}

.disp-timeline-header,
.disp-timeline-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid #eee;
}

.disp-timeline-header {
  background: #f8f9fa;
  font-size: .75rem;
  color: #6c757d;
}

.disp-timeline-row:last-child {
  border-bottom: none;
}

.disp-timeline-label {
  flex: 0 0 110px;
  max-width: 110px;
  padding: .4rem .5rem;
  font-size: .82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  border-right: 1px solid #eee;
}

.disp-timeline-track {
  position: relative;
  flex: 1 1 auto;
  min-height: 34px;
}

.disp-timeline-header .disp-timeline-track {
  min-height: 22px;
}

.disp-track-bloqueada {
  background: repeating-linear-gradient(45deg, #2b2f33, #2b2f33 8px, #1c1f22 8px, #1c1f22 16px);
}

.disp-hour-mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.disp-hour-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #eee;
}

.disp-evento {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: .25rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 .3rem;
  color: #fff;
  cursor: default;
}

.disp-evento-label {
  font-size: .7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Dashboard — calendario mensual de movimientos (vistas/dashboard/index.php).
   Grid de 7 columnas tipo almanaque; cada celda de día muestra
   insignias por tipo de movimiento (no logs de auditoría).
   ============================================================ */
.dash-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.dash-cal-dow {
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  color: #6c757d;
  padding: .25rem 0;
}

.dash-cal-cell {
  min-height: 108px;
  border: 1px solid #eee;
  border-radius: .25rem;
  padding: .3rem;
  background: #fff;
  text-decoration: none;
  color: inherit;
  display: block;
}

.dash-cal-cell:hover {
  background: #f8f9fa;
}

.dash-cal-cell.dash-cal-fuera-de-mes {
  background: #fafafa;
  color: #adb5bd;
}

.dash-cal-cell.dash-cal-hoy {
  border-color: #3d7dfa;
  box-shadow: inset 0 0 0 1px #3d7dfa;
}

.dash-cal-cell.dash-cal-seleccionado {
  background: #eaf1ff;
}

.dash-cal-num {
  font-size: .78rem;
  font-weight: 600;
}

.dash-cal-badges {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: .25rem;
}

.dash-cal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Etiqueta corta ("Gasto Alquiler", "Reserva Juan Pérez"...) dentro de
   una celda del calendario — reemplaza el punto de color por texto
   legible truncado (ver DashboardCalendarService::etiquetaCorta()). */
.dash-cal-etiqueta {
  display: block;
  font-size: .68rem;
  line-height: 1.2;
  padding: 1px 4px;
  border-radius: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-cal-etiqueta.dash-cal-mas {
  background: #eee;
  color: #6c757d;
}

/* ============================================================
   Vistas imprimibles (facturas, contratos de alquiler — ver
   vistas/ventas/imprimir.php y vistas/contratos_alquiler/imprimir.php).
   Página fuera del layout con sidebar (mismo criterio que login,
   $sinNav = true), con una barra de acciones que se oculta al
   imprimir (.no-print) y un documento centrado tipo hoja.
   ============================================================ */
.print-toolbar {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: .75rem 1rem;
}

.print-sheet {
  max-width: 800px;
  margin: 1.5rem auto;
  padding: 2rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: .375rem;
}

@media print {
  .no-print {
    display: none !important;
  }
  .print-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    border: none;
  }
  body {
    background: #fff !important;
  }
}
