/* ========================================
   CHALECOS AZULES - CSS ESPECÍFICO
   ======================================== */

/* Variables específicas para Chalecos Azules */
:root {
  --chalecos-primary: var(--primary-600);
  --chalecos-secondary: var(--gray-400);
  --chalecos-background: #1e293b; /* bg-slate-800 - panel oscuro */
  --chalecos-text: var(--white);
  --chalecos-border: #374151; /* border-gray-700 - bordes oscuros */
  --chalecos-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Contenedor principal del mapa */
.chalecos-container {
  display: flex;
  width: 100%;
  height: calc(100vh - 4rem); /* Altura total menos header */
  background-color: #020617; /* bg-slate-950 - igual que MainLayout */
  gap: 1rem;
  padding: 1rem;
}

/* Panel lateral de controles */
.chalecos-sidebar {
  width: 350px;
  background-color: var(--chalecos-background);
  border-radius: var(--border-radius);
  box-shadow: var(--chalecos-shadow);
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 100%;
}

/* Contenedor del mapa */
.chalecos-map-container {
  flex: 1;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--chalecos-shadow);
}

/* Título principal */
.chalecos-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--chalecos-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gray-200);
}

/* Sección de controles */
.chalecos-control-section {
  margin-bottom: 1.5rem;
}

.chalecos-control-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--chalecos-text);
  margin-bottom: 0.5rem;
}

/* Selectores modernos */
.chalecos-select-container {
  position: relative;
  margin-bottom: 1rem;
}

.chalecos-select {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 0.75rem;
  border: 2px solid var(--chalecos-border);
  border-radius: var(--border-radius);
  background-color: var(--chalecos-background);
  color: var(--chalecos-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.chalecos-select:focus {
  outline: none;
  border-color: var(--chalecos-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chalecos-select:hover {
  border-color: var(--gray-400);
}

/* Icono de dropdown */
.chalecos-select-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--gray-400);
  pointer-events: none;
  transition: transform 0.2s ease-in-out;
}

.chalecos-select-container:hover .chalecos-select-icon {
  color: var(--gray-600);
}

/* Dropdown personalizado */
.chalecos-dropdown {
  position: relative;
  width: 100%;
}

.chalecos-dropdown-button {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 0.75rem;
  border: 2px solid var(--chalecos-border);
  border-radius: var(--border-radius);
  background-color: var(--chalecos-background);
  color: var(--chalecos-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chalecos-dropdown-button:focus {
  outline: none;
  border-color: var(--chalecos-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chalecos-dropdown-button:hover {
  border-color: var(--gray-400);
}

.chalecos-dropdown-button.active {
  border-color: var(--chalecos-primary);
}

/* Lista del dropdown */
.chalecos-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background-color: var(--chalecos-background);
  border: 2px solid var(--chalecos-border);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease-in-out;
}

.chalecos-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chalecos-dropdown-item {
  padding: 0.75rem;
  color: var(--chalecos-text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chalecos-dropdown-item:hover {
  background-color: #475569; /* bg-slate-600 */
}

.chalecos-dropdown-item.selected {
  background-color: var(--chalecos-primary);
  color: var(--white);
}

.chalecos-dropdown-item.assigned {
  background-color: var(--green-50);
  border-left: 4px solid var(--success);
}

.chalecos-dropdown-item.assigned:hover {
  background-color: var(--green-100);
}

/* Indicador de asignación */
.chalecos-assignment-indicator {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--success);
  margin-left: 0.5rem;
}

/* Lista de elementos seleccionados */
.chalecos-elements-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--chalecos-border);
  border-radius: var(--border-radius);
  background-color: var(--chalecos-background);
}

.chalecos-elements-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--chalecos-text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.chalecos-element-item {
  padding: 0.75rem;
  color: var(--chalecos-text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  border-bottom: 1px solid var(--gray-100);
}

.chalecos-element-item:last-child {
  border-bottom: none;
}

.chalecos-element-item:hover {
  background-color: #475569; /* bg-slate-600 */
  color: var(--chalecos-primary);
}

.chalecos-element-item.selected {
  background-color: var(--chalecos-primary);
  color: var(--white);
  font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--primary-700);
}

/* Estados de carga */
.chalecos-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

.chalecos-loading-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--gray-200);
  border-top: 2px solid var(--chalecos-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Estados vacíos */
.chalecos-empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* Botones de acción */
.chalecos-action-button {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--chalecos-primary);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  margin-top: 1rem;
}

.chalecos-action-button:hover {
  background-color: var(--primary-700);
}

.chalecos-action-button:disabled {
  background-color: var(--gray-400);
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 1024px) {
  .chalecos-container {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 4rem);
  }

  .chalecos-sidebar {
    width: 100%;
    margin-bottom: 1rem;
  }

  .chalecos-map-container {
    height: 400px;
  }
}

@media (max-width: 640px) {
  .chalecos-container {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .chalecos-sidebar {
    padding: 1rem;
  }

  .chalecos-map-container {
    height: 300px;
  }
}

/* ========================================
   ESTILOS ESPECÍFICOS PARA MAPA LEAFLET
   ======================================== */

/* Estilos específicos para el contenedor del mapa */
#map-container {
  width: 100% !important;
  height: 100% !important;
  position: relative;
  z-index: 1;
}

/* Asegurar que el contenedor Leaflet ocupe todo el espacio */
#map-container .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

/* Forzar que los panes de Leaflet queden por debajo del header */
#map-container .leaflet-pane,
#map-container .leaflet-tile-pane,
#map-container .leaflet-overlay-pane,
#map-container .leaflet-shadow-pane,
#map-container .leaflet-marker-pane,
#map-container .leaflet-tooltip-pane,
#map-container .leaflet-popup-pane {
  z-index: 100 !important;
}

/* Controles (zoom, attribution) también por debajo del header */
#map-container .leaflet-control-container {
  position: relative;
  z-index: 200 !important;
}

/* Popups y tooltips por debajo del header */
#map-container .leaflet-popup,
#map-container .leaflet-tooltip {
  z-index: 250 !important;
}

/* ========================================
   ESTILOS PARA LOADER Y PLACEHOLDER
   ======================================== */

/* Placeholder inicial antes de cargar el mapa */
.map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: var(--chalecos-background);
  padding: 2rem;
  text-align: center;
}

.placeholder-icon {
  margin-bottom: 1.5rem;
}

.placeholder-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--chalecos-text);
  margin-bottom: 0.5rem;
}

.placeholder-text {
  font-size: 1rem;
  color: var(--chalecos-secondary);
  max-width: 400px;
}

/* Loader durante la carga */
.map-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: rgba(249, 250, 251, 0.95);
}

.loader-spinner {
  width: 4rem;
  height: 4rem;
  border: 4px solid #e5e7eb;
  border-top-color: var(--chalecos-primary, #2563eb);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loader-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: #374151;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
/* Loader como overlay */
.map-loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(249, 250, 251, 0.95);
  z-index: 1000;
}

/* ========================================
   PANEL PARA SELECCIÓN DE ROL
   ======================================== */

.role-panel {
  margin-top: 1rem;
  background: var(--chalecos-background);
  border: 1px solid var(--chalecos-border);
  border-radius: 8px;
  box-shadow: var(--chalecos-shadow);
  overflow: hidden;
}

.role-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background-color: #334155; /* bg-slate-700 - header más oscuro */
  border-bottom: 1px solid var(--chalecos-border);
}

.role-panel-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--chalecos-text);
}

.role-panel-close {
  background: none;
  border: none;
  font-size: 1.125rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.role-panel-close:hover {
  color: #374151;
  background-color: #e5e7eb;
}

.role-panel-body {
  padding: 1.25rem;
}

.role-panel-info {
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  color: #6b7280;
}

.role-selection {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.role-radio-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.role-radio-option:hover {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

.role-radio-option input[type="radio"] {
  margin: 0;
  width: 16px;
  height: 16px;
}

.role-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.role-name {
  font-weight: 600;
  color: var(--chalecos-text);
  font-size: 0.95rem;
}

.role-desc {
  font-size: 0.8rem;
  color: #6b7280;
}

.role-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--chalecos-border);
}

.btn-cancel {
  padding: 0.5rem 1rem;
  border: 1px solid var(--chalecos-border);
  background-color: #475569; /* bg-slate-600 */
  color: var(--chalecos-text);
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.btn-cancel:hover {
  background-color: #64748b; /* bg-slate-500 */
  border-color: #94a3b8;
}

.btn-assign {
  padding: 0.5rem 1.25rem;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.btn-assign:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
}

/* ========================================
   LISTA DE ROLES ASIGNADOS
   ======================================== */

.roles-list-section {
  margin-top: 1.5rem;
}

.roles-list-title {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--chalecos-text);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--chalecos-border);
}

.roles-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  color: #6b7280;
  font-size: 0.875rem;
}

.roles-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.roles-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.role-card {
  background: var(--chalecos-background);
  border: 1px solid var(--chalecos-border);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--chalecos-shadow);
  transition: all 0.2s ease;
}

.role-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.role-person-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.role-person-name {
  font-weight: 600;
  color: var(--chalecos-text);
  font-size: 0.95rem;
}

.role-person-phone {
  font-size: 0.8rem;
  color: #6b7280;
}

.role-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  min-width: 100px;
}

.role-brigadista {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.role-supervisor {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.role-default {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.role-card-info {
  margin-bottom: 0.75rem;
}

.role-date {
  font-size: 0.75rem;
  color: #9ca3af;
}

.role-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--chalecos-border);
}

.role-change-select {
  flex: 1;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--chalecos-border);
  border-radius: 4px;
  font-size: 0.8rem;
  background-color: #475569; /* bg-slate-600 */
  color: var(--chalecos-text);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.role-change-select:hover {
  border-color: #9ca3af;
}

.role-change-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.role-change-select:disabled {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

.btn-remove {
  padding: 0.375rem 0.5rem;
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  min-width: 32px;
}

.btn-remove:hover {
  background-color: #fecaca;
  border-color: #f87171;
}

.btn-remove:disabled {
  background-color: #f9fafb;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

.roles-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #6b7280;
  font-style: italic;
}

.roles-empty p {
  margin: 0;
  font-size: 0.9rem;
}

/* ========================================
   POPUP ROLES ASIGNADOS
   ======================================== */

/* Selector de personas dentro del popup */
.popup-selector-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.popup-selector-label {
  display: block;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.popup-dropdown {
  position: relative;
  width: 100%;
}

.popup-dropdown-button {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #374151;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.popup-dropdown-button:hover {
  border-color: #9ca3af;
  background-color: #f9fafb;
}

.popup-dropdown-button.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.popup-select-icon {
  width: 1rem;
  height: 1rem;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.popup-select-icon.rotate-180 {
  transform: rotate(180deg);
}

.popup-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  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);
  z-index: 50;
  max-height: 12rem;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: all 0.2s ease;
}

.popup-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.popup-dropdown-item {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
}

.popup-dropdown-item:hover {
  background-color: #f9fafb;
}

.popup-dropdown-item:last-child {
  border-bottom: none;
}

.popup-dropdown-item.assigned {
  background-color: #ecfdf5;
  color: #065f46;
}

.popup-dropdown-item.assigned:hover {
  background-color: #d1fae5;
}

.popup-assignment-indicator {
  width: 0.5rem;
  height: 0.5rem;
  background-color: #10b981;
  border-radius: 50%;
}

.popup-loading {
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.popup-loading-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.popup-empty-state {
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Sección de roles dentro del popup */
.popup-roles-section {
  flex: 1;
}

.popup-roles-section-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sección de Asignación de Rol dentro del popup */
.popup-role-assignment-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.popup-role-assignment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.popup-role-assignment-title {
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
  margin: 0;
}

.popup-role-assignment-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.popup-role-assignment-close:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.popup-role-assignment-body {
  padding: 0;
}

.popup-role-assignment-info {
  margin: 0 0 1rem 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.popup-role-assignment-info strong {
  color: #374151;
}

.popup-role-selection {
  margin-bottom: 1.5rem;
}

.popup-role-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #ffffff;
}

.popup-role-radio-option:hover {
  border-color: #d1d5db;
  background-color: #f9fafb;
}

.popup-role-radio-option input[type="radio"] {
  margin: 0;
  margin-top: 0.125rem;
  accent-color: #3b82f6;
}

.popup-role-radio-option:has(input[type="radio"]:checked) {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

.popup-role-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.popup-role-name {
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.popup-role-desc {
  color: #6b7280;
  font-size: 0.75rem;
}

.popup-role-assignment-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.popup-btn-cancel {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: #ffffff;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.popup-btn-cancel:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.popup-btn-cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.popup-btn-assign {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  background-color: #3b82f6;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.popup-btn-assign:hover:not(:disabled) {
  background-color: #2563eb;
}

.popup-btn-assign:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Overlay del popup */
.popup-roles-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: popup-fade-in 0.3s ease-out;
}

@keyframes popup-fade-in {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

/* Contenedor del popup */
.popup-roles-container {
  background-color: var(--chalecos-background);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popup-slide-in 0.3s ease-out;
}

@keyframes popup-slide-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header del popup */
.popup-roles-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--chalecos-border);
  background: linear-gradient(135deg, #334155 0%, #475569 100%);
}

.popup-roles-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--chalecos-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.popup-roles-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-roles-close:hover {
  color: #6b7280;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Body del popup */
.popup-roles-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Loading del popup */
.popup-roles-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
}

.popup-roles-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #e5e7eb;
  border-top: 3px solid var(--chalecos-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Lista de roles en el popup */
.popup-roles-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.popup-role-card {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid var(--chalecos-border);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.popup-role-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--chalecos-primary), #8b5cf6);
}

.popup-role-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.2);
  border-color: var(--chalecos-primary);
}

.popup-role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.popup-role-person-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.popup-role-person-name {
  font-weight: 700;
  color: var(--chalecos-text);
  font-size: 1.1rem;
}

.popup-role-person-phone {
  font-size: 0.875rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Badges de rol en el popup */
.popup-role-badge {
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  min-width: 120px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.popup-role-brigadista {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.popup-role-supervisor {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fcd34d;
}

.popup-role-default {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #374151;
  border: 1px solid #d1d5db;
}

.popup-role-card-info {
  margin-bottom: 1rem;
}

.popup-role-date {
  font-size: 0.8rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Acciones del popup */
.popup-role-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--chalecos-border);
}

.popup-role-change-select {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--chalecos-border);
  border-radius: 8px;
  font-size: 0.875rem;
  background-color: #475569;
  color: var(--chalecos-text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.popup-role-change-select:hover {
  border-color: #9ca3af;
  background-color: #64748b;
}

.popup-role-change-select:focus {
  outline: none;
  border-color: var(--chalecos-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.popup-role-change-select:disabled {
  background-color: #374151;
  color: #9ca3af;
  cursor: not-allowed;
}

.popup-btn-remove {
  padding: 0.5rem;
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

.popup-btn-remove:hover {
  background-color: #fecaca;
  border-color: #f87171;
  transform: scale(1.05);
}

.popup-btn-remove:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  transform: none;
}

/* Estado vacío del popup */
.popup-roles-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.popup-roles-empty-icon {
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.popup-roles-empty-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--chalecos-text);
}

.popup-roles-empty-text {
  margin: 0;
  font-size: 1rem;
  color: #9ca3af;
  line-height: 1.5;
  max-width: 300px;
}

/* Footer del popup */
.popup-roles-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--chalecos-border);
  background-color: #334155;
  display: flex;
  justify-content: flex-end;
}

.popup-roles-btn-close {
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.popup-roles-btn-close:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

/* Responsive para el popup */
@media (max-width: 768px) {
  .popup-roles-overlay {
    padding: 0.5rem;
  }

  .popup-roles-container {
    max-height: 90vh;
  }

  .popup-roles-header {
    padding: 1rem;
  }

  .popup-roles-body {
    padding: 1rem;
  }

  .popup-roles-footer {
    padding: 1rem;
  }

  .popup-role-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .popup-role-badge {
    align-self: flex-start;
  }

  .popup-role-card-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .popup-role-change-select {
    width: 100%;
  }
}
