/* Base Styles */
:root {
  --primary-color: #3498db;
  --primary-hover: #2980b9;
  --secondary-color: #7f8c8d;
  --secondary-hover: #6c7a7d;
  --danger-color: #B4182D;
  --danger-hover: #54162B;
  --info-color: #37415C;
  --info-hover: #242E49;
  --sidebar-bg: #2c3e50;
  --sidebar-active: #34495e;
  --body-bg: #f5f7fb;
  --card-bg: #fff;
  --card-header-bg: #f8fafc;
  --border-color: #e2e8f0;
  --text-color: #2d3748;
  --text-light: #7f8c8d;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 5px rgba(0,0,0,0.05);
  --shadow-lg: 0 4px 15px rgba(0,0,0,0.1);
  --transition-speed: 0.3s;
  --border-radius: 8px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 70px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden; /* Evita scroll horizontal */
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--body-bg);
  color: var(--text-color);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* Evita scroll horizontal */
  max-width: 100%;
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden; /* Evita scroll horizontal */
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: #ecf0f1;
  position: fixed;
  height: 100%;
  z-index: 100;
  transition: transform var(--transition-speed), width var(--transition-speed);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.logo {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.logo i {
  font-size: 1.8rem;
  margin-right: 0.75rem;
  color: var(--primary-color);
}

.logo h2 {
  font-size: 1.5rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav {
  list-style: none;
  margin-bottom: 80px; /* Espacio para user-info */
}

.nav li {
  margin-bottom: 0.25rem;
}

.nav a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: #ecf0f1;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav a i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.nav a span {
  transition: opacity var(--transition-speed);
}

.nav li.active a, .nav a:hover {
  background-color: var(--sidebar-active);
  color: var(--primary-color);
}

.user-info {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--sidebar-active);
  display: flex;
  align-items: center;
  position: absolute;
  bottom: 0;
  width: 100%;
  background-color: var(--sidebar-bg);
}

.user-info i {
  font-size: 1.5rem;
  margin-right: 0.75rem;
  color: var(--primary-color);
}

.user-info span {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-speed);
}

.logout {
  /*color: var(--danger-color);*/
  margin-left: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none !important; /* Eliminar bordes */
  text-decoration: none !important;
}

.logout:hover {
  /*color: var(--danger-hover);*/
}

/* Sidebar toggle button */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 101;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  transition: background-color 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.sidebar-toggle:hover {
  background-color: var(--primary-hover);
}

.sidebar-toggle i {
  font-size: 1.25rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 99;
}

/* Main Content */
.main-content {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  padding: 1.5rem;
  transition: margin var(--transition-speed);
  max-width: calc(100% - var(--sidebar-width));
  overflow-x: hidden;
}

.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.status-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.status-item {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.status-item i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
  width: 100%;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 1rem 1.5rem;
  background-color: var(--card-header-bg);
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 600;
}

.card-header h2 i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}

.card-body {
  padding: 1.5rem;
}

/* Forms */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-end;
  width: 100%;
}

.form-group {
  flex: 1 1 200px;
  margin-bottom: 0.5rem;
  min-width: 0; /* Permite que flex-items no crezcan más allá del contenedor */
}

.flex-grow {
  flex-grow: 2;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input, select {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.95rem;
  height: 42px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-color: white;
  max-width: 100%;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d3748' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.password-form {
  max-width: 400px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  height: 42px;
  font-size: 0.95rem;
  white-space: nowrap;
}

.btn i {
  margin-right: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn-info {
  background-color: var(--info-color);
  color: white;
}

.btn-info:hover {
  background-color: var(--info-hover);
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: white;
}

.btn-outline-danger {
  background-color: transparent;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.btn-outline-danger:hover {
  background-color: var(--danger-color);
  color: white;
}

/* Estilo para los botones de acción en tablas */
.btn-sm {
  padding: 0;
  font-size: 0.875rem;
  height: 28px;
  width: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background-color: transparent;
  border: 1px solid;
  transition: all 0.2s ease;
  margin: 0 2px;
}

.btn-sm i {
  margin: 0;
  font-size: 0.875rem;
}

/* Estilo específico para botón editar */
.btn-info.btn-sm {
  color: var(--info-color);
  border-color: var(--info-color);
  background-color: transparent;
}

.btn-info.btn-sm:hover {
  background-color: rgba(23, 162, 184, 0.1);
}

/* Estilo específico para botón eliminar */
.btn-danger.btn-sm {
  color: var(--danger-color);
  border-color: var(--danger-color);
  background-color: transparent;
}

.btn-danger.btn-sm:hover {
  background-color: rgba(231, 76, 60, 0.1);
}

/* Estilo específico para botón refresh/test */
.btn-warning.btn-sm, 
.btn-secondary.btn-sm {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background-color: transparent;
}

.btn-warning.btn-sm:hover,
.btn-secondary.btn-sm:hover {
  background-color: rgba(52, 152, 219, 0.1);
}

td .btn-sm {
  margin: 0 2px;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  max-width: 100%;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0.5rem;
}

th, td {
  text-align: left;
  padding: 0.75rem;
}

thead th {
  background-color: var(--card-header-bg);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 2px solid var(--border-color);
}

table tr {
  border-bottom: 1px solid var(--border-color);
}

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

tbody tr:hover {
  background-color: rgba(52, 152, 219, 0.05);
}

.ip-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
  width: 100%;
}

.ip-table h3, .config-section h3, .log-container h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
}

.ip-table h3 i, .config-section h3 i, .log-container h3 i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}

/* Action buttons in tables */
td:last-child {
  white-space: nowrap;
  text-align: right;
}

td .btn {
  margin: 0 2px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge i {
  margin-right: 0.25rem;
}

.badge-success {
  background-color: #d4edda;
  color: #155724;
}

.badge-warning {
  background-color: #fff3cd;
  color: #856404;
}

.badge-danger {
  background-color: #f8d7da;
  color: #721c24;
}

.badge-info {
  background-color: #d1ecf1;
  color: #0c5460;
}

.badge-secondary {
  background-color: #e2e8f0;
  color: #4a5568;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
}

.alert i {
  margin-right: 0.75rem;
  font-size: 1.1rem;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border-left: 4px solid #17a2b8;
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  border-left: 4px solid #ffc107;
}

/* Logs */
.log-container {
  margin-bottom: 2rem;
  max-width: 100%;
}

.log-entries {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
}

.error-message, .log-details, .debug-info {
  font-family: monospace;
  color: var(--text-color);
  word-break: break-word;
  white-space: normal;
  max-width: 100%;
}

.error-message {
  color: var(--danger-color);
}

.text-center {
  text-align: center;
}

/* Horarios */
.horarios-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.horario-card {
  flex: 1 1 200px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.horario-card:hover {
  box-shadow: var(--shadow-md);
}

.horario-header {
  background-color: var(--card-header-bg);
  padding: 0.75rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}

.horario-header i {
  margin-right: 0.5rem;
}

.horario-body {
  padding: 1rem;
  font-size: 1.1rem;
  text-align: center;
}

.diurno .horario-header {
  color: #eb9d05;
}

.diurno .horario-header i {
  color: #f39c12;
}

.nocturno .horario-header {
  color: #3867d6;
}

.nocturno .horario-header i {
  color: var(--primary-color);
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 2;
  width: 100%;
}

.tabs-nav li {
  padding: 0.75rem 1.25rem;
  margin-right: 0.5rem;
  margin-bottom: -1px;
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background-color: var(--card-header-bg);
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  position: relative;
}

.tabs-nav li i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}

.tabs-nav li.active {
  background-color: white;
  border-bottom: 1px solid white;
  font-weight: 600;
}

/* Tabs Content */
.tabs-content {
  position: relative;
  width: 100%;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
  width: 100%;
}

.tab-pane.active {
  display: block;
}

/* Secciones de contenido */
.section-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.section-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Rutas específicas */
.route-specific-ips {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  animation: fadeIn 0.3s ease;
  width: 100%;
}

.route-specific-ips:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.route-specific-ips h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-color);
  display: flex;
  align-items: center;
  word-break: break-word;
}

.route-specific-ips h3 i {
  margin-right: 0.5rem;
  color: var(--primary-color);
  flex-shrink: 0;
}

.route-specific-ips h4 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.route-specific-ips h4 i {
  margin-right: 0.5rem;
  width: 16px;
  flex-shrink: 0;
}

/* Estado vacío */
.empty-state {
  text-align: center;
  padding: 2rem;
  background-color: var(--card-header-bg);
  border-radius: 6px;
  margin: 1rem 0;
}

.empty-state i {
  font-size: 2rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  display: block;
}

.empty-state p {
  color: var(--text-light);
  font-size: 1.1rem;
}

/* Editar IP form */
.edit-ip-form {
  background-color: var(--card-header-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease;
  width: 100%;
}

.edit-ip-form h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-color);
  display: flex;
  align-items: center;
}

.edit-ip-form h3 i {
  margin-right: 0.5rem;
  color: var(--primary-color);
}

.edit-ip-form p {
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 0.95rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Login Form Styles */
.login {
  background-color: var(--body-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-form {
  background-color: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-form button {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem;
}

.login-form .error {
  background-color: #f8d7da;
  color: #721c24;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  border-left: 4px solid #dc3545;
  display: flex;
  align-items: center;
}

.login-form .error i {
  margin-right: 0.5rem;
}

/* Footer para la pantalla de login */
.login-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Configuraciones y ajustes */
.config-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.config-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.log-actions {
  margin-top: 1.5rem;
}

.log-actions h4 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* Mejoras adicionales para tablas */
.table-striped tbody tr:nth-child(odd) {
  background-color: rgba(0,0,0,0.02);
}

/* Para móviles: Sidebar colapsable y mejoras responsivas */
@media (max-width: 992px) {
  .ip-tables {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-group {
    flex: 1 1 100%;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
  }
  
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
    max-width: 100%;
  }
  
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .sidebar-backdrop.active {
    display: block;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .status-info {
    margin-top: 0.5rem;
    width: 100%;
  }
  
  .tabs-nav li {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .tabs-nav li i {
    margin-right: 0.25rem;
  }
  
  .log-container {
    margin-bottom: 1.5rem;
  }
  
  .log-entries {
    max-height: 200px;
  }
  
  /* Ajustes para tablas móviles */
  table {
    font-size: 0.9rem;
  }
  
  th, td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group .btn {
    width: 100%;
  }
}

/* Utilidades adicionales */
.d-none {
  display: none !important;
}

.mt-2 {
  margin-top: 0.5rem !important;
}

.mb-2 {
  margin-bottom: 0.5rem !important;
}

.mt-3 {
  margin-top: 1rem !important;
}

.mb-3 {
  margin-bottom: 1rem !important;
}

.w-100 {
  width: 100% !important;
}

.text-primary {
  color: var(--primary-color) !important;
}

.text-danger {
  color: var(--danger-color) !important;
}

.text-success {
  color: #28a745 !important;
}

.text-warning {
  color: #ffc107 !important;
}

.bg-light {
  background-color: var(--card-header-bg) !important;
}

.rounded {
  border-radius: var(--border-radius) !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.p-2 {
  padding: 0.5rem !important;
}

.p-3 {
  padding: 1rem !important;
}


