/* Estilos base para todos los buscadores territoriales */
.territorial-search {
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  padding: 1.5rem;
}

.territorial-search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.territorial-search-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.territorial-export {
  background-color: #059669;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.territorial-export:hover {
  background-color: #047857;
}

.territorial-filters {
  margin-bottom: 1.5rem;
}

.territorial-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.territorial-input,
.territorial-select {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.territorial-input:focus,
.territorial-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.territorial-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-start;
}

.territorial-button {
  padding: 0.75rem 1.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background-color: #ffffff;
  color: #374151;
}

.territorial-button:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.territorial-button.primary {
  background-color: #2563eb;
  color: white;
  border-color: #2563eb;
}

.territorial-button.primary:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.territorial-results {
  margin-top: 1.5rem;
}

.territorial-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
}

.territorial-table thead {
  background-color: #f8fafc;
}

.territorial-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.875rem;
}

.territorial-table th.acciones {
  text-align: center;
  width: 120px;
}

.territorial-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  color: #4b5563;
}

.territorial-table td.acciones {
  text-align: center;
}

.territorial-table tbody tr:hover {
  background-color: #f9fafb;
}

.territorial-table tbody tr:last-child td {
  border-bottom: none;
}

.no-results {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 2rem;
}

/* Modern Action Buttons */
.action-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.action-btn:active {
  transform: translateY(0);
}

/* Edit Button */
.action-btn.edit {
  background-color: #3b82f6;
  color: white;
}

.action-btn.edit:hover {
  background-color: #2563eb;
}

/* View Button */
.action-btn.view {
  background-color: #10b981;
  color: white;
}

.action-btn.view:hover {
  background-color: #059669;
}

/* Delete Button */
.action-btn.delete {
  background-color: #ef4444;
  color: white;
}

.action-btn.delete:hover {
  background-color: #dc2626;
}

/* Icon styling */
.action-btn .action-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Responsive: Hide text on mobile, show only icons */
@media (max-width: 768px) {
  .action-btn {
    padding: 0.5rem;
    min-width: 2.25rem;
    justify-content: center;
  }

  .action-btn .action-text {
    display: none;
  }

  .action-buttons {
    gap: 0.375rem;
  }
}

/* Legacy icon-btn support (for backwards compatibility) */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  margin: 0 0.125rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  font-size: 1rem;
}

.icon-btn:hover {
  background-color: #f3f4f6;
}

.icon-btn.edit:hover {
  background-color: #fef3c7;
}

.icon-btn.view:hover {
  background-color: #d1fae5;
}

.icon-btn.delete:hover {
  background-color: #fee2e2;
}

.territorial-pagination {
  margin-top: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Estilos específicos para cada buscador */
.distrito-search {
  @extend .territorial-search;
}

.distrito-search-header {
  @extend .territorial-search-header;
}

.distrito-search-title {
  @extend .territorial-search-title;
}

.distrito-export {
  @extend .territorial-export;
}

.distrito-filters {
  @extend .territorial-filters;
}

.distrito-filter-grid {
  @extend .territorial-filter-grid;
}

.distrito-input,
.distrito-select {
  @extend .territorial-input, .territorial-select;
}

.distrito-actions {
  @extend .territorial-actions;
}

.distrito-button {
  @extend .territorial-button;
}

.distrito-results {
  @extend .territorial-results;
}

.distrito-table {
  @extend .territorial-table;
}

.distrito-pagination {
  @extend .territorial-pagination;
}

/* General */
.general-search {
  @extend .territorial-search;
}

.general-search-header {
  @extend .territorial-search-header;
}

.general-search-title {
  @extend .territorial-search-title;
}

.general-export {
  @extend .territorial-export;
}

.general-filters {
  @extend .territorial-filters;
}

.general-filter-grid {
  @extend .territorial-filter-grid;
}

.general-input,
.general-select {
  @extend .territorial-input, .territorial-select;
}

.general-actions {
  @extend .territorial-actions;
}

.general-button {
  @extend .territorial-button;
}

.general-results {
  @extend .territorial-results;
}

.general-table {
  @extend .territorial-table;
}

.general-pagination {
  @extend .territorial-pagination;
}

/* Municipal */
.municipal-search {
  @extend .territorial-search;
}

.municipal-search-header {
  @extend .territorial-search-header;
}

.municipal-search-title {
  @extend .territorial-search-title;
}

.municipal-export {
  @extend .territorial-export;
}

.municipal-filters {
  @extend .territorial-filters;
}

.municipal-filter-grid {
  @extend .territorial-filter-grid;
}

.municipal-input,
.municipal-select {
  @extend .territorial-input, .territorial-select;
}

.municipal-actions {
  @extend .territorial-actions;
}

.municipal-button {
  @extend .territorial-button;
}

.municipal-results {
  @extend .territorial-results;
}

.municipal-table {
  @extend .territorial-table;
}

.municipal-pagination {
  @extend .territorial-pagination;
}

/* Sección */
.seccion-search {
  @extend .territorial-search;
}

.seccion-search-header {
  @extend .territorial-search-header;
}

.seccion-search-title {
  @extend .territorial-search-title;
}

.seccion-export {
  @extend .territorial-export;
}

.seccion-filters {
  @extend .territorial-filters;
}

.seccion-filter-grid {
  @extend .territorial-filter-grid;
}

.seccion-input,
.seccion-select {
  @extend .territorial-input, .territorial-select;
}

.seccion-actions {
  @extend .territorial-actions;
}

.seccion-button {
  @extend .territorial-button;
}

.seccion-results {
  @extend .territorial-results;
}

.seccion-table {
  @extend .territorial-table;
}

.seccion-pagination {
  @extend .territorial-pagination;
}

/* Enhanced Data Table Styles */
.enhanced-table-container {
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  padding: 1.5rem;
}

.enhanced-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.enhanced-table-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

/* Header Action Buttons */
.enhanced-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.enhanced-add-btn,
.enhanced-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.enhanced-add-btn {
  background-color: #3b82f6;
  color: white;
}

.enhanced-add-btn:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.enhanced-export-btn {
  background-color: #059669;
  color: white;
}

.enhanced-export-btn:hover {
  background-color: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Responsive: hide button text on small screens */
@media (max-width: 640px) {
  .enhanced-add-btn .btn-text,
  .enhanced-export-btn .btn-text {
    display: none;
  }

  .enhanced-add-btn,
  .enhanced-export-btn {
    padding: 0.5rem;
    min-width: 2.5rem;
    justify-content: center;
  }
}

/* Search Bar */
.enhanced-search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.enhanced-search-input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.enhanced-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.enhanced-search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.enhanced-search-clear:hover {
  color: #ef4444;
}

/* Table */
.enhanced-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.enhanced-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
}

.enhanced-table thead {
  background-color: #f8fafc;
}

.enhanced-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.875rem;
  user-select: none;
}

.enhanced-table th.sortable {
  cursor: pointer;
  transition: background-color 0.2s;
}

.enhanced-table th.sortable:hover {
  background-color: #f1f5f9;
}

.enhanced-table th.sorted {
  background-color: #e0e7ff;
  color: #1e40af;
}

.enhanced-th-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sort-indicator {
  font-size: 0.75rem;
  color: #2563eb;
  font-weight: bold;
}

.sort-inactive {
  color: #9ca3af;
  opacity: 0.5;
}

.enhanced-table th.acciones {
  text-align: center;
  width: 120px;
}

.enhanced-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  color: #4b5563;
}

.enhanced-table td.acciones {
  text-align: center;
}

.enhanced-table tbody tr:hover {
  background-color: #f9fafb;
}

.enhanced-table tbody tr:last-child td {
  border-bottom: none;
}

/* Pagination */
.enhanced-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.pagination-info {
  color: #6b7280;
  font-size: 0.875rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: #374151;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  min-width: 2.5rem;
}

.pagination-btn:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-current {
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0 0.5rem;
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.875rem;
}

.pagination-select {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: #ffffff;
  cursor: pointer;
  font-size: 0.875rem;
}

.pagination-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .enhanced-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-controls {
    justify-content: center;
  }

  .pagination-size {
    justify-content: center;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-container {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #ef4444;
}

.modal-body {
  padding: 1.5rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: #374151;
}

.form-label.required::after {
  content: " *";
  color: #ef4444;
}

.form-input,
.form-select {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.error,
.form-select.error {
  border-color: #ef4444;
}

.form-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn-cancel {
  background-color: #f3f4f6;
  color: #374151;
}

.modal-btn-cancel:hover {
  background-color: #e5e7eb;
}

.modal-btn-save {
  background-color: #10b981;
  color: white;
}

.modal-btn-save:hover {
  background-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.modal-btn-save:disabled {
  background-color: #d1d5db;
  cursor: not-allowed;
  transform: none;
}

/* Mobile modal adjustments */
@media (max-width: 640px) {
  .modal-container {
    width: 95%;
    max-height: 95vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-btn {
    width: 100%;
  }
}

/* ========================================
   ESTILOS CONSOLIDADOS DE DISTRITO.CSS
   ======================================== */

/* Estilos para búsqueda de Coordinación de Distrito */
.distrito-search {
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin: 1rem 0;
}

.distrito-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #1e40af;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.distrito-search-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.distrito-export {
  background: #ffffff;
  color: #1e40af;
  border: none;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-weight: 600;
}

.distrito-filters {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.distrito-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.distrito-input,
.distrito-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  color: #111827;
}

.distrito-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.distrito-button {
  background-color: #f3f4f6;
  color: #111827;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.distrito-button.primary {
  background-color: #2563eb;
  color: #ffffff;
}

.distrito-results {
  padding: 1rem 1.5rem 1.5rem;
}

.distrito-table {
  width: 100%;
  border-collapse: collapse;
}

.distrito-table th {
  background-color: #1e293b;
  padding: 0.75rem 1rem;
  text-align: left;
  color: #ffffff;
  font-size: 0.85rem;
}

.distrito-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.distrito-table tr:hover {
  background-color: #f9fafb;
}

.distrito-table .acciones {
  width: 140px;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.35rem;
  border: none;
  cursor: pointer;
}

.icon-btn.edit { background-color: #06b6d4; }
.icon-btn.view { background-color: #16a34a; }
.icon-btn.delete { background-color: #eab308; }

.no-results {
  text-align: center;
  color: #6b7280;
}

.distrito-pagination {
  margin-top: 0.75rem;
  color: #6b7280;
  font-size: 0.9rem;
}

@media (max-width: 1024px) {
  .distrito-filter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .distrito-filter-grid { grid-template-columns: 1fr; }
  .distrito-actions { flex-direction: column; }
  .icon-btn { margin-bottom: 0.25rem; }
}
