/* Estilos para el buscador de capítulos */
.search-container {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.search-container.collapsed {
  max-height: 80px;
  overflow: hidden;
}

.search-container.expanded {
  max-height: none;
}

.search-box h3 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 0.9em;
  font-weight: 600;
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.toggle-search-btn {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.toggle-search-btn:hover {
  background: #5a6268;
}

.search-content {
  transition: all 0.3s ease;
}

.search-content.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.search-content.expanded {
  max-height: 500px;
  opacity: 1;
}

.search-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 12px;
  transition: border-color 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.clear-search-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.clear-search-btn:hover {
  background: #c82333;
}

.search-options {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.search-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
}

.search-option span {
  font-size: 14px;
  color: #495057;
  font-weight: 500;
}

/* Resultados de búsqueda */
.search-results {
  margin-top: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 10px 10px 0 0;
}

.results-header h4 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.1em;
  font-weight: 600;
}

.close-results-btn {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.close-results-btn:hover {
  background: #5a6268;
}

.results-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 0;
}

.search-result-item {
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search-result-item:hover {
  background-color: #f8f9fa;
}

.search-result-item:last-child {
  border-bottom: none;
}

.result-title {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
  font-size: 1.0em;
}

.result-content {
  color: #6c757d;
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 0.95em;
}

.result-reference {
  color: #667eea;
  font-size: 0.9em;
  font-weight: 500;
}

.search-stats {
  padding: 15px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  border-radius: 0 0 10px 10px;
  text-align: center;
  color: #6c757d;
  font-weight: 500;
}

.no-results {
  padding: 30px 20px;
  text-align: center;
  color: #6c757d;
}

.no-results p {
  margin: 10px 0;
}

.no-results strong {
  color: #2c3e50;
}

/* Resaltado de elementos encontrados */
.highlighted {
  background-color: #fff3cd !important;
  border: 2px solid #ffc107 !important;
  border-radius: 5px;
  padding: 5px;
  transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
  .search-container {
    margin: 15px;
    padding: 15px;
  }
  
  .search-input-group {
    flex-direction: column;
    gap: 10px;
  }
  
  .search-options {
    flex-direction: column;
    gap: 10px;
  }
  
  .search-button, .clear-search-btn {
    width: 100%;
  }
}

/* Navegación de resultados */
.results-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.nav-btn {
  background: #667eea;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  background: #5a6fd8;
  transform: scale(1.1);
}

.nav-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.result-counter {
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.95em;
}

/* Resultado activo */
.search-result-item.active-result {
  background-color: #e3f2fd !important;
  border-left: 4px solid #2196f3;
}

/* Resaltado de texto encontrado */
mark {
  background-color: #fff3cd;
  color: #856404;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Resaltado de búsqueda en resultados */
.search-highlight {
  background-color: #ffeb3b;
  color: #333;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}