/* Base de estilos compartidos */
/* Contenedores comunes */
.staff-calendar-frontend,
.staff-vehicles-manager,
.alameda-tools-manager,
.alameda-machinery-manager,
.alameda-time-tracking,
.alameda-kilometers-manager,
.alameda-employee-dashboard,
.alameda-projects-manager,
.alameda-project-calendar {
  margin: 20px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mensajes de estado */
.calendar-messages,
.vehicles-messages,
.tools-messages,
.machinery-messages,
.time-tracking-messages,
.kilometers-messages,
.dashboard-messages,
.projects-messages {
  margin-bottom: 20px;
}

.status-message {
  padding: 12px 20px;
  border-radius: 4px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.message-info {
  background-color: #e7f5ff;
  border: 1px solid #b8e2ff;
  color: #0066cc;
}

.message-error {
  background-color: #ffe7e7;
  border: 1px solid #ffb8b8;
  color: #cc0000;
}

.message-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.message-warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.close-message {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 5px;
  font-size: 20px;
}

/* Formularios compartidos */
.form-group {
  margin-bottom: 15px;
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group.half {
  flex: 1;
}

.form-group label,
.modal-input-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.form-group input,
.form-group select,
.form-group textarea,
.modal-input-group input,
.modal-input-group select,
.modal-input-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.modal-input-group input:focus,
.modal-input-group select:focus,
.modal-input-group textarea:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
  outline: none;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* Filtros */
.filter-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group label {
  font-weight: 500;
  margin-bottom: 0;
  white-space: nowrap;
}

.filter-group select {
  min-width: 150px;
}

/* Estados */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-active {
  background-color: #d4edda;
  color: #155724;
}

.status-maintenance,
.status-paused,
.status-assigned,
.status-in_use {
  background-color: #fff3cd;
  color: #856404;
}

.status-success,
.status-finished {
  background-color: #cce5ff;
  color: #004085;
}

.status-inactive,
.status-cancelled,
.status-repair,
.status-lost {
  background-color: #f8d7da;
  color: #721c24;
}

/* Tablas */
.wp-list-table {
  border-collapse: collapse;
  width: 100%;
}

.wp-list-table th {
  background-color: #f5f5f5;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #ddd;
}

.wp-list-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

/* Botones de acción */
.button {
  padding: 8px 16px;
  border-radius: 4px;
  margin-right: 5px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s;
}

.button-primary {
  background: #2271b1;
  color: white;
}

.button-primary:hover {
  background: #135e96;
}

.view-button,
.view-project,
.view-tool,
.view-machinery {
  background: #6c757d;
  color: white;
}

.view-button:hover,
.view-project:hover,
.view-tool:hover,
.view-machinery:hover {
  background: #5a6268;
}

.edit-button,
.edit-project,
.edit-tool,
.edit-machinery,
.edit-vehicle {
  background: #2271b1;
  color: white;
}

.edit-button:hover,
.edit-project:hover,
.edit-tool:hover,
.edit-machinery:hover,
.edit-vehicle:hover {
  background: #135e96;
}

.delete-button,
.delete-project,
.delete-tool,
.delete-machinery,
.delete-vehicle {
  background: #dc3545;
  color: white;
}

.delete-button:hover,
.delete-project:hover,
.delete-tool:hover,
.delete-machinery:hover,
.delete-vehicle:hover {
  background: #c82333;
}

/* Modales */
.alameda-modal,
.destination-modal,
.vehicle-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  padding: 20px;
  overflow-y: auto;
  justify-content: center;
  align-items: flex-start;
}

.alameda-modal .modal-content,
.destination-modal .modal-content,
.vehicle-modal .modal-content {
  position: relative;
  background-color: #fff;
  margin: 5vh auto;
  padding: 0;
  width: 90%;
  max-width: 800px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease-out;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.alameda-modal .modal-header,
.destination-modal .modal-header,
.vehicle-modal .modal-header {
  background-color: #f8f9fa;
  border-radius: 12px 12px 0 0;
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.alameda-modal .modal-body,
.destination-modal .modal-body,
.vehicle-modal .modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0 8px;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #333;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Control horario */
.time-control {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.time-button {
  flex: 1;
  padding: 15px;
  font-size: 16px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.time-button.check-in {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.time-button.check-out {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.time-status {
  margin-top: 10px;
  padding: 10px;
  border-radius: 5px;
  background-color: #e7f5ff;
  border: 1px solid #b8e2ff;
}

/* Pestañas */
.tabs-nav {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  border-bottom: 1px solid #ddd;
}

.tabs-nav li {
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid #ddd;
  border-bottom: none;
  margin-right: 5px;
  border-radius: 4px 4px 0 0;
  background-color: #f5f5f5;
  transition: all 0.2s;
}

.tabs-nav li:hover {
  background-color: #e9e9e9;
}

.tabs-nav li.active {
  border-color: #ddd;
  background-color: #fff;
  margin-bottom: -1px;
  padding-bottom: 11px;
  position: relative;
  z-index: 1;
}

.tab-content {
  display: none;
  padding: 15px 0;
  overflow-y: auto;
}

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

/* Dashboard de empleado */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Dashboard de empleado - Versión mejorada */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.dashboard-card {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 200px; /* Altura mínima fija para todas las cards */
  padding-bottom: 70px; /* Espacio para el botón en la parte inferior */
}

.dashboard-card-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.dashboard-card-content {
  flex-grow: 1; /* El contenido ocupa el espacio disponible */
}

.dashboard-button {
  position: absolute;
  bottom: 20px; /* Posición fija desde la parte inferior */
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 15px;
  background: #2271b1;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.dashboard-button:hover {
  background: #135e96;
}

.dashboard-icon {
  font-size: 24px;
  margin-right: 8px;
}

.dashboard-icon {
  font-size: 24px;
  margin-right: 8px;
}

/* Anotaciones */
.note-item {
  background-color: #f9f9f9;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid #eee;
}

.note-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.9em;
  color: #666;
}

.note-content {
  margin-bottom: 10px;
  white-space: pre-line;
}

/* Animaciones */
@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media screen and (max-width: 768px) {
  .staff-calendar-frontend,
  .staff-vehicles-manager,
  .alameda-tools-manager,
  .alameda-machinery-manager,
  .alameda-time-tracking,
  .alameda-kilometers-manager,
  .alameda-employee-dashboard,
  .alameda-projects-manager,
  .alameda-project-calendar {
    margin: 10px;
    padding: 15px;
  }

  .form-row {
    flex-direction: column;
    gap: 15px;
  }

  .filter-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-group {
    width: 100%;
    margin-bottom: 10px;
  }

  .filter-group select {
    width: 100%;
  }

  .alameda-modal .modal-content,
  .destination-modal .modal-content,
  .vehicle-modal .modal-content {
    width: 95%;
    margin: 3vh auto;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .time-control {
    flex-direction: column;
  }
}

/* Ajustes específicos para dispositivos muy pequeños */
@media screen and (max-width: 480px) {
  .dashboard-button {
    padding: 10px;
    font-size: 14px;
  }

  .time-button {
    padding: 12px;
  }

  .alameda-modal,
  .destination-modal,
  .vehicle-modal {
    padding: 10px;
  }

  .modal-title {
    font-size: 1.1rem;
  }
}

/* Estilos de impresión */
@media print {
  .staff-calendar-frontend,
  .staff-vehicles-manager,
  .alameda-tools-manager,
  .alameda-machinery-manager,
  .alameda-time-tracking,
  .alameda-kilometers-manager,
  .alameda-employee-dashboard,
  .alameda-projects-manager,
  .alameda-project-calendar {
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .filter-controls,
  .form-row,
  button:not(.close-message) {
    display: none;
  }

  table {
    width: 100%;
    border: 1px solid #000;
  }

  th,
  td {
    border: 1px solid #000;
  }
}

/* ----- ESTILOS ESPECÍFICOS DEL CALENDARIO QUE NO SE PUDIERON UNIFICAR ----- */
/* Controles del calendario */
.calendar-controls {
  margin-bottom: 20px;
}

.calendar-navigation {
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  max-width: 400px;
}

.calendar-navigation button {
  padding: 8px 16px;
  background: #4a4a4a;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
  line-height: normal;
  height: auto;
}

.calendar-navigation button:hover {
  background: #333;
}

.current-month {
  font-size: 1.4em;
  font-weight: bold;
  color: #333;
}

/* Contenedor del calendario */
.calendar-container {
  position: relative;
  width: 100%;
  overflow: auto;
  max-height: 72vh;
}

.calendar-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Estilos de tablas del calendario */
.calendar-table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  background: #fff;
}

/* Estilos del encabezado del calendario */
.calendar-table thead th {
  position: sticky;
  top: 0;
  background: #f5f5f5;
  z-index: 2;
  min-width: 80px;
  height: 60px;
  padding: 8px;
  text-align: center;
  font-weight: 600;
  color: #333;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
}

/* Estilos del calendario de proyectos */
.project-calendar-container {
  position: relative;
  margin-top: 20px;
}

.month-calendar {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  background: #f5f5f5;
  padding: 10px 0;
  font-weight: bold;
  border: 1px solid #ddd;
  border-bottom: none;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(120px, auto);
  border-left: 1px solid #ddd;
}

.calendar-day {
  border-right: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  padding: 5px;
  min-height: 120px;
  position: relative;
}

.calendar-day.inactive {
  background-color: #f9f9f9;
  color: #aaa;
}

.calendar-day.today {
  background-color: #fffde7;
}

/* Estilos de proyectos en el calendario */
.project-item {
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 4px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.project-active {
  background-color: #e3f2fd;
  border-left: 3px solid #1976d2;
}

.project-paused {
  background-color: #fff8e1;
  border-left: 3px solid #ffa000;
}

.project-finished {
  background-color: #e8f5e9;
  border-left: 3px solid #43a047;
}

.project-cancelled {
  background-color: #ffebee;
  border-left: 3px solid #e53935;
}

/* Estilos para las cards de proyectos */
.dashboard-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.dashboard-project-card {
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.dashboard-project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.project-card-header {
  padding: 15px;
  border-bottom: 1px solid #f2f2f2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f9f9f9;
}

.project-card-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card-content {
  padding: 15px;
  flex-grow: 1;
}

.project-card-content p {
  margin: 8px 0;
  font-size: 14px;
  color: #555;
}

.project-card-content p strong {
  color: #333;
}

.project-vehicle {
  margin-top: 8px;
  font-size: 13px;
  color: #666;
  font-style: italic;
}

.project-card-actions {
  padding: 10px 15px;
  border-top: 1px solid #f2f2f2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f9f9f9;
}

.view-project-button {
  padding: 8px 15px;
  background-color: #2271b1;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s;
}

.view-project-button:hover {
  background-color: #135e96;
  color: white;
}

/* Estilos adaptables */
@media screen and (max-width: 768px) {
  .dashboard-projects-grid {
    grid-template-columns: 1fr;
  }
}

/* Estilos mejorados para el modal de proyectos */
.project-tabs {
  margin-bottom: 20px;
}

.tabs-nav {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  border-bottom: 1px solid #ddd;
  flex-wrap: wrap; /* Permitir que se envuelvan en dispositivos pequeños */
}

.tabs-nav li {
  padding: 10px 15px;
  cursor: pointer;
  border: 1px solid #ddd;
  border-bottom: none;
  margin-right: 5px;
  margin-bottom: -1px; /* Para que parezca conectado con el contenido */
  border-radius: 4px 4px 0 0;
  background-color: #f5f5f5;
  transition: all 0.2s;
  font-size: 14px;
  white-space: nowrap;
}

.tabs-nav li:hover {
  background-color: #e9e9e9;
}

.tabs-nav li.active {
  border-color: #ddd;
  background-color: #fff;
  border-bottom: 1px solid #fff;
  position: relative;
  z-index: 1;
  font-weight: 600;
}

.tab-content {
  display: none;
  padding: 0;
  overflow-y: auto;
  border-top: none;
}

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

/* Mejorar altura de los modales */
.alameda-modal .modal-content {
  max-height: 90vh;
}

.alameda-modal .modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Estilo para el título del proyecto en el modal */
#project-title-display {
  font-weight: 500;
  font-style: italic;
}

/* Responsive para tabs */
@media screen and (max-width: 768px) {
  .tabs-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px; /* Espacio para la barra de desplazamiento */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .tabs-nav li {
    flex: 0 0 auto;
    font-size: 13px;
    padding: 8px 12px;
  }

  .tab-content {
    padding: 15px 0;
  }
}

/* Estilo para los formularios dentro de los tabs */
.tab-content .form-group:last-child {
  margin-bottom: 0;
}
