/* =========================================================
   VARIABLES PROPIAS (NO ROMPEN BOOTSTRAP)
   ========================================================= */
:root {
  --app-primary: #e53935;
  --app-primary-dark: #b71c1c;
  --app-sidebar-bg: #020617;
  --app-sidebar-width: 260px;
  --app-radius: 0.75rem;
  --app-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --app-shadow-md: 0 8px 20px rgba(15, 23, 42, 0.18);
}

/* Que html y body ocupen todo el alto */
html, body {
  height: 100%;
}

/* =========================================================
   OVERRIDES SUAVES A BOOTSTRAP
   ========================================================= */

/* Colores de botón primario (Aceptar/Guardar) */
.btn-primary {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--app-primary-dark);
  border-color: var(--app-primary-dark);
}

/* Botón XS */
.btn-xs {
  --bs-btn-padding-y: 0.15rem;
  --bs-btn-padding-x: 0.4rem;
  --bs-btn-font-size: 0.75rem;
}

/* Botón sólo icono */
.btn-icon {
  padding-inline: 0.5rem;
}

/* Card principal */
.main-card {
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
  border: none;
}

/* Tablas */
.table-wrapper {
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
  background: #ffffff;
}
.table thead {
  background-color: #f1f5f9;
}
.table thead th {
  font-weight: 600;
  color: #4b5563;
  border-bottom-width: 1px;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table-actions {
  white-space: nowrap;
}

/* Badges de estatus */
.badge-status {
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
}
.badge-status.success {
  background-color: #dcfce7;
  color: #166534;
}
.badge-status.warning {
  background-color: #fef9c3;
  color: #92400e;
}
.badge-status.danger {
  background-color: #fee2e2;
  color: #b91c1c;
}
.badge-status.info {
  background-color: #e0f2fe;
  color: #0369a1;
}

/* =========================================================
   LAYOUT ERP CON SIDEBAR
   ========================================================= */

.layout-wrapper {
  min-height: 100vh;
  background-color: #f3f4f6;
}

/* SIDEBAR FIJO A LA IZQUIERDA */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;                   /* ocupa todo el alto */
  width: var(--app-sidebar-width);
  background-color: var(--app-sidebar-bg);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  padding-block: 1rem;
  z-index: 1030;
}

.sidebar-header {
  padding-inline: 1.5rem;
  padding-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logo {
  max-width: 220px;
  height: 40px;
  object-fit: contain;
}

/* Botón hamburguesa */
.sidebar-toggle {
  border-color: rgba(255,255,255,0.2);
  padding: 0.25rem 0.4rem;
  line-height: 1;
}

/* NAV con scroll interno */
.sidebar-nav {
  flex: 1 1 auto;              /* ocupa todo lo que queda */
  overflow-y: auto;            /* AQUÍ está el scroll interno */
  margin: 0;
  padding: 0.75rem 0;
}

.sidebar-nav-inner {
  padding-bottom: 1rem;
}

/* Título de sección */
.sidebar-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1.5rem 0.25rem;
  color: #9ca3af;
  opacity: 0.9;
}

/* Links del menú */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1.5rem;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.94rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.sidebar-link i,
.sidebar-link svg {
  width: 1.2rem;
  text-align: center;
}

.sidebar-link:hover {
  background-color: rgba(148, 163, 184, 0.18);
  color: #ffffff;
}

.sidebar-link.active {
  background-color: rgba(229, 57, 53, 0.16);
  border-left: 3px solid var(--app-primary);
  padding-left: calc(1.5rem - 3px);
}

/* CONTENIDO PRINCIPAL A LA DERECHA */
.content-wrapper {
  margin-left: var(--app-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-wrapper .content-header {
  background-color: #ffffff;
  box-shadow: var(--app-shadow-sm);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.content-wrapper .content-header-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.content-wrapper .content-body {
  padding: 1.5rem;
}

/* === MODO COLAPSADO (hamburguesa) === */
body.sidebar-collapsed .sidebar {
  width: 72px;
}

body.sidebar-collapsed .content-wrapper {
  margin-left: 72px;
}

body.sidebar-collapsed .sidebar-section-title {
  display: none;
}

body.sidebar-collapsed .sidebar-link span {
  display: none;
}

body.sidebar-collapsed .sidebar-link {
  justify-content: center;
}

/* Scrollbar visible en el sidebar (WebKit) */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 3px;
}

/* =========================================================
   LOGIN / AUTH
   ========================================================= */

.auth-page {
  min-height: 100vh;
  display: flex;
}

.auth-bg {
  flex: 1;
  background-size: cover;
  background-position: center;
}

.auth-panel {
  flex: 0 0 420px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(circle at top, #ffffff 0, #e5e7eb 70%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: #ffffff;
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-md);
  padding: 2.25rem 2.5rem;
}

.auth-logo {
  display: block;
  margin: 0 auto 1rem;
  max-width: 220px;
}
.auth-title {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 600;
}
.auth-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 1.6rem;
}

/* Campos de login */
.auth-card .form-label {
  font-size: 0.9rem;
  font-weight: 500;
}
.auth-card .form-control {
  border-radius: 0.5rem;
}

/* FORMULARIOS */
.form-actions {
  margin-top: 0.5rem;
}

/* ALERTAS SUAVES */
.alert-soft-info {
  background-color: #e0f2fe;
  color: #075985;
  border-color: transparent;
}
.alert-soft-success {
  background-color: #dcfce7;
  color: #166534;
  border-color: transparent;
}
.alert-soft-warning {
  background-color: #fef9c3;
  color: #92400e;
  border-color: transparent;
}
.alert-soft-danger {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: transparent;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* En pantallas chicas dejamos el sidebar fijo pero sin márgen al contenido;
   si quieres luego lo hacemos tipo overlay con .sidebar-open */
@media (max-width: 991.98px) {
  .content-wrapper {
    margin-left: 72px; /* aprovechamos el modo "colapsado" como default móvil */
  }

  body.sidebar-collapsed .content-wrapper {
    margin-left: 0;
  }
}

@media (max-width: 767.98px) {
  .auth-page {
    flex-direction: column;
  }
  .auth-bg {
    display: none;
  }
}
/* ============================
   ESTILOS PARA IMPRESIÓN
=============================== */
@media print {

  /* Tamaño de hoja: Carta (Letter) */
  @page {
    size: letter;
    margin: 12mm 15mm;
  }

  /* Ocultar sidebar y elementos no necesarios */
  .sidebar {
    display: none !important;
  }

  .sidebar-toggle,
  .btn,
  .no-print {
    display: none !important;
  }

  /* Quitar márgen del contenido y ocupar todo el ancho */
  .content-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body {
    background: #ffffff !important;
  }

  .content-header {
    box-shadow: none !important;
    border-bottom: 1px solid #e5e7eb;
  }

  /* Evitar que las cards se corten feo entre páginas */
  .card {
    page-break-inside: avoid;
  }
}
/* ============================
   IMPRESIÓN – UNA SOLA HOJA CARTA
=============================== */
@media print {

    @page {
        size: letter;
        margin: 8mm 10mm;
    }

    /* Ocultar elementos innecesarios */
    .sidebar,
    .sidebar-toggle,
    .btn,
    .no-print {
        display: none !important;
    }

    /* Expandir el contenido */
    body,
    .content-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
    }

    .content-header {
        padding-bottom: 4px !important;
        margin-bottom: 6px !important;
        border-bottom: 1px solid #ccc !important;
    }

    /* Tipografía más compacta */
    body {
        font-size: 11px !important;
        line-height: 1.2 !important;
    }

    h1, h2, h3, h4, h5 {
        margin: 0 0 4px 0 !important;
        padding: 0 !important;
    }

    h5.card-title {
        font-size: 13px !important;
        margin-bottom: 4px !important;
    }

    /* Cards compactas */
    .card {
        margin-bottom: 6px !important;
        padding: 8px !important;
        page-break-inside: avoid;
    }

    .card-body {
        padding: 6px !important;
    }

    /* Tablas compactas */
    table {
        font-size: 10px !important;
        margin-top: 3px !important;
    }

    .table td, .table th {
        padding: 3px !important;
    }

    /* Reducir foto del chofer */
    .driver-photo-print {
        width: 70px !important;
        height: 70px !important;
    }

    /* Reducir QR */
    .qr-print {
        width: 120px !important;
        height: 120px !important;
    }

    /* Limitar secciones largas */
    .print-limit {
        max-height: 160px !important;
        overflow: hidden !important;
    }

    /* Evitar espacios grandes */
    .mb-3, .mb-2, .mb-1, .mt-3, .mt-2, .mt-1 {
        margin: 4px !important;
    }
}
/* =========================
   IMPRESIÓN: Cliente y Datos del viaje lado a lado
   ========================= */
@media print {

  /* Fuerza dos columnas en esa fila específica */
  .print-two-cols{
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 24px !important;
  }

  .print-two-cols > [class*="col-"]{
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
  }

  /* Opcional: evita saltos feos dentro del bloque */
  .print-two-cols h6,
  .print-two-cols p{
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}
/* =========================
   IMPRESIÓN: layout compacto en 2 columnas (principal + lateral)
   ========================= */
@media print {

  /* Quita sidebar y márgenes extra (si aplica) */
  .sidebar, .no-print { display: none !important; }
  .content-wrapper { margin: 0 !important; padding: 0 !important; }
  .content-body { padding: 0 !important; }

  /* Fuerza el row principal a 2 columnas */
  .content-body > .row{
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 14px !important;
  }

  /* Columna principal (izq) */
  .content-body > .row > .col-xl-8{
    flex: 0 0 68% !important;
    max-width: 68% !important;
    width: 68% !important;
  }

  /* Columna lateral (der) */
  .content-body > .row > .col-xl-4{
    flex: 0 0 32% !important;
    max-width: 32% !important;
    width: 32% !important;
  }

  /* Evita que "Chofer" y "QR" se separen y caigan en otra hoja */
  .content-body > .row > .col-xl-4 .card{
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* Compactar tarjetas / textos */
  .card { margin-bottom: 10px !important; }
  .card-body { padding: 10px !important; }
  .card-title { margin-bottom: 8px !important; }

  /* QR y foto más compactos */
  .qr-print { width: 150px !important; height: 150px !important; }
  .driver-photo-print { width: 90px !important; height: 90px !important; }

  /* Reduce espacios en párrafos */
  p { margin-bottom: 6px !important; }
}
.auth-page{
  min-height: 100vh;
  display: flex;
  background:#f5f6f8;
}

/* Columna izquierda (imagen) */
.auth-bg{
  width: 55%;
  min-height: 100vh;
  background-image: url('/Media/empresa/principal.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Columna derecha (login) */
.auth-panel{
  width: 45%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #eef0f3; /* opcional */
}

/* Card */
.auth-card{
  width: 100%;
  max-width: 420px;
  padding: 28px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.12);
}
@media (max-width: 992px){
  .auth-bg{ display:none; }
  .auth-panel{ width:100%; }
  .auth-card{ max-width: 480px; }
}
/* ====== IMPRESIÓN ====== */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}
