/* ---------------------------------------------- */
/* Importación de fuentes */
/* ---------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

/* ---------------------------------------------- */
/* Variables CSS */
/* ---------------------------------------------- */
:root {
  --primary: #d57b32;
  --primary-dark: #b36628;
  --primary-dark2: #445885;
  --dark: #14120e;
  --dark-light: #2a2722;
  --light: #f8f9fa;
  --gray: #6c757d;
  --light-gray: #e9ecef;
  --white: #ffffff;
  --blue: #203666;
}

/* ---------------------------------------------- */
/* Estilos generales */
/* ---------------------------------------------- */
body {
  font-family: "Montserrat", sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--white);
  color: var(--dark);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  width: 100%;
}

.lead {
  font-size: 25px;
}

/* ---------------------------------------------- */
/* Navbar */
/* ---------------------------------------------- */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--blue) !important;
  padding: 1rem 2rem;
  color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;	
}

.bg-header{
    
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--white);
}

.navbar-menu {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: #91b3fb;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #91b3fb;
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
  background-color: #91b3fb;
}

.nav-link.active {
  color: #91b3fb;
  font-weight: 600;
}

.nav-link.active[href*="/admin/"] {
  color: #91b3fb !important;
}

/* ---------------------------------------------- */
/* User Info */
/* ---------------------------------------------- */
.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-rol {
  background-color: #38589d;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white);
}

.logout-btn {
  background: none;
  border: 1px solid var(--white);
  color: var(--white);
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.logout-btn:hover {
  background-color: #38589d;
  color: white;
  text-decoration: none;
}

/* ---------------------------------------------- */
/* Formularios */
/* ---------------------------------------------- */
.form-control {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  font-family: "Montserrat", sans-serif;
  transition: border-color 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(213, 123, 50, 0.1);
}

#observacionesInput {
  resize: vertical;
  min-height: 60px;
}

/* ---------------------------------------------- */
/* Botones */
/* ---------------------------------------------- */
.btn {
  padding: 1.5rem 1.5rem;
  background-color: var(--blue);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  text-decoration: none;
  margin: 0 15px -20px 0;
  display: ruby-text;
}

.btn:hover {
  background-color: var(--primary-dark2);
  transform: translateY(-1px);
}

#btnLimpiar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

#btnLimpiar i {
  font-size: 1.25rem;
}

.btn-operacion {
    background-color: white !important;
    color: #d57b32 !important;
    border-bottom: solid 8px #d57b32 !important;
    border-top: solid 1px #d57b32 !important;
    border-right: solid 1px #d57b32 !important;
    border-left: solid 1px #d57b32 !important;
}

/* ---------------------------------------------- */
/* Alertas */
/* ---------------------------------------------- */
.alert {
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  border-left: 4px solid transparent;
}

.alert-success {
  background-color: #f0f9f0;
  color: #2a7d2a;
  border-left-color: #2a7d2a;
}

.alert-danger {
  background-color: #fff0f0;
  color: #d32f2f;
  border-left-color: #d32f2f;
}

/* ---------------------------------------------- */
/* Login */
/* ---------------------------------------------- */
.login-container {
  max-width: 450px;
  margin: 5rem auto;
  padding: 2.5rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

/* ---------------------------------------------- */
/* Tablas */
/* ---------------------------------------------- */
.table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0;
  margin: 1.5rem 0;
}

.table th {
  background-color: var(--dark);
  color: white;
  font-weight: 600;
  padding: 1rem;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--light-gray);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td,
#listaPaquetes tr:hover, #ultimosMovimientos tr:hover, #resultadosBusqueda tr:hover {
  background-color: #38589d17;
}

.rounded-top {
  border-top-left-radius: 0.5rem !important;
  border-top-right-radius: 0.5rem !important;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.rounded-top thead tr:first-child th:first-child {
  border-top-left-radius: 0.5rem !important;
}

.rounded-top thead tr:first-child th:last-child {
  border-top-right-radius: 0.5rem !important;
}

/* Tabla específica */
#tablaPaquetes {
  font-size: 0.9rem;
}

#tablaPaquetes td:nth-child(3) {
  width: 20%;
  min-width: 150px;
}

/* ---------------------------------------------- */
/* Contenido de paquetería */
/* ---------------------------------------------- */
.empresas-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.img-empresa,
.img-empresa-tabla {
  object-fit: contain;
  border-radius: 4px;
}

.img-empresa {
  max-width: 100px;
  border-radius: 4px 4px 0 0;
}

.img-empresa-tabla {
  height: 40px;
  width: auto;
  max-width: 100px;
  margin-right: 8px;
}

.empresa-badge {
  background-color: #e9ecef;
  color: #495057;
  padding: 0.25em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.85em;
  font-weight: 500;
}

.empresa-btn {
  transition: all 0.3s ease;
  padding: 0 0 7px 0px;
  border-radius: 4px;
  cursor: pointer;
}

.empresa-btn.active {
  background-color: #007bff;
  color: white;
  /*transform: scale(1.15);
  border: none;*/
  border: 4px solid blue;
  transform: scale(1.58);
  margin-left: 30px !important;
  margin-right: 30px !important;
}

.empresa-info {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.empresa-logo {
  width: auto;
  height: 35px;
  object-fit: contain;
  border-radius: 5px;
}

.empresa-nombre {
  font-weight: 500;
  font-size: 0.9rem;
}

/* Etiquetas de tipo */
.registro-label {
  background-color: #d4edda;
  color: #155724;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.label-tracking {
  background-color: #343a40;
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.65px;
}

.salida-label {
  background-color: #f8d7da;
  color: #721c24;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
}

#contadorPaquetes {
    font-size: 0.8em;
    vertical-align: middle;
    background-color: var(--blue);
    padding: 5px 8px;
    border-radius: 10px;
    color: white;
}

/* Tooltip */
.tooltip-inner {
  max-width: 300px;
  text-align: left;
  padding: 0.75rem;
}

.tooltip-inner ul {
  margin-bottom: 0;
  padding-left: 1rem;
}

/* Estadísticas */
.stat-item {
  width: 40%;
  display: inline-block;
  background-color: #f3f3f3;
  padding: 2rem 1.5rem;
  border-radius: 6px;
  margin-left: 10px;
  position: relative;
  cursor: default;
}

.stat-number {
  font-size: 2.5pc;
}

.stat-label {
  margin-left: 10px;
}

/* ---------------------------------------------- */
/* Footer */
/* ---------------------------------------------- */
.site-footer {
  background-color: #f3f3f3;
  padding: 2rem 0;
  text-align: center;
  margin-top: 3rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-logo {
  max-height: 110px;
  width: auto;
  margin-bottom: 1rem;
}

.copyright {
  color: #6c757d;
  margin: 0;
  font-size: 0.9rem;
}

/* ---------------------------------------------- */
/* Estilos específicos para móviles */
/* ---------------------------------------------- */
@media (max-width: 768px) {
  /* Ajustes generales */
  body {
    font-size: 14px;
    line-height: 1.5;
  }
  
  .container {
    padding: 50px 20px 0;
  }
  
  /* Navbar móvil */
  .navbar {
    padding: 0.75rem 1rem;
    position: fixed;
    bottom: 0;
    top: auto;
    border-top: 1px solid var(--dark-light);
	width: 100%;
  }
  
  .navbar-brand {
    display: none;
  }
  
  .navbar-menu {
    width: 100%;
    justify-content: space-around;
    gap: 0;
  }
  
  .nav-link {
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
  }
  
  .nav-link i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }
  
  .nav-link::after {
    top: 0;
    bottom: auto;
    height: 3px;
  }
  
  /* User info en móvil */
  .user-info {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--blue);
    padding: 0.75rem 1rem;
    justify-content: space-between;
    z-index: 1000;
    border-bottom: 1px solid var(--dark-light);
  }
  
  .user-rol {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }
  
  .logout-btn {
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
  }
  
  /* Ajuste del contenido principal */
  main {
    padding: 60px 0 70px; /* Espacio para el header y navbar fijos */
  }
  
  /* Formularios en móvil */
  .form-control {
    padding: 0.6rem;
    font-size: 0.9rem;
  }
  
  /* Botones en móvil */
  .btn {
    padding: 1rem;
    font-size: 0.85rem;
    width: 100%;
    margin: 0 0 10px 0;
  }
  
	.quick-actions .btn {
		margin: 5px;
	}
	
  /* Tablas en móvil */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table th, 
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }
  
  /* Contenedor de empresas */
  .empresas-container {
    justify-content: center;
    gap: 6px;
  }
  
  .img-empresa {
    max-width: 80px;
  }
  
  .img-empresa-tabla {
    height: 30px;
    margin-right: 5px;
  }
  
  /* Login en móvil */
  .login-container {
    margin: 3rem auto;
    padding: 1.5rem;
    width: 90%;
  }
  
  /* Estadísticas */
  .stat-item {
    width: 100%;
    margin: 0 0 10px 0;
    padding: 1.5rem 1rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  /* Footer en móvil */
  .site-footer {
    padding: 1.5rem 0;
    margin-top: 2rem;
  }
  
  .footer-logo {
    max-height: 20px;
  }
  
  /* Efectos de app */
  html {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Mejora de scroll en iOS */
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------------------------------------------- */
/* Ajustes para pantallas muy pequeñas */
/* ---------------------------------------------- */
@media (max-width: 480px) {
  .empresas-container {
    gap: 4px;
  }
  
  .img-empresa {
    max-width: 70px;
  }
  
  .table th, 
  .table td {
    padding: 0.5rem 0.3rem;
    font-size: 0.8rem;
  }
  
  .nav-link {
    font-size: 0.7rem;
  }
  
  .nav-link i {
    font-size: 1.1rem;
  }
}

/* ---------------------------------------------- */
/* Animaciones y efectos de app */
/* ---------------------------------------------- */
@media (max-width: 768px) {
  .btn, .nav-link, .empresa-btn {
    transition: all 0.2s ease;
  }
  
  .btn:active {
    transform: scale(0.98);
    background-color: var(--primary-dark);
  }
  
  .empresa-btn:active {
    transform: scale(0.95);
  }
  
  .nav-link:active {
    color: var(--primary);
  }
}

/* Estilos para el modo escáner */
.modal-scanner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1050;
    overflow-y: auto;
}

.scanner-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #007bff;
    color: white;
}

.scanner-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.empresas-scanner-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.empresa-btn-scanner {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.empresa-btn-scanner.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.scanner-viewport {
    position: relative;
    background: black;
    margin-bottom: 15px;
    border-radius: 4px;
    overflow: hidden;
    min-height: 200px;
}

.scanner-viewport::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 15px;
    height: 15px;
    background: red;
    border-radius: 50%;
    animation: pulse 2s infinite;
    z-index: 10;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}


#scannerVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-empresa-scanner {
    height: 30px;
    max-width: 100px;
    object-fit: contain;
}

.scanner-alerts {
    margin-top: 15px;
}

/* Botón flotante para móviles */
#btnAbrirEscanner {
    position: fixed;
    bottom: 60px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1040;
    display: none;
}

/* Radio button Entrega */
/* cambios para radio button */
.btn-operacion:has(input:checked) {
  color: #007bff !important;
  border: 3px solid #007bff !important;
  border-bottom: 8px solid #007bff !important;
  transform: scale(1.25);
  margin-top: 10px;
  margin-left: 30px !important;
  margin-right: 30px !important;
}

.btn-eliminar{
  margin-left:15px;
  width:35px;
  font-size:18px;
  padding:0px;
  border:1px solid #000;
  display:inline;
  margin-bottom: 0px;
  background: #d93333;
}

.eliminar{
  padding:1px 0 0 0; 
  font-size:18px; 
  vertical-align:text-top;
  text-shadow: 1px 1px 1px black;
}

@media (max-width: 767.98px) {
    #btnAbrirEscanner {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}