/* ===== LAYOUT PRINCIPAL ===== */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 0;
}

/* ===== SECCIÓN DE RECURSOS ===== */
.resources-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Layout específico para repositorios - gráficas en una sola fila */
.resources-section.repository-layout {
  grid-template-columns: 1fr !important;
  gap: 1.5rem;
}

.resources-section.repository-layout .resource-card {
  min-width: 0;
}

.resource-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.resource-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.resource-card:hover::before {
  opacity: 1;
}

.resource-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.resource-icon {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resource-icon mat-icon {
  color: white;
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.resource-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
}

.resource-content {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.chart-container {
  flex: 1;
  display: flex;
  justify-content: center;
}

.resource-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f3f4;
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 500;
}

.info-value {
  font-size: 0.9rem;
  color: #2c3e50;
  font-weight: 600;
}

.usage-percentage {
  color: #667eea;
  font-weight: 700;
}

/* ===== CPU USAGE DISPLAY ===== */
.cpu-usage-display {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.cpu-circle {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.cpu-percentage {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.cpu-label {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* ===== SECCIÓN DE SERVICIOS ===== */
.services-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.service-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.service-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.service-icon {
  background: linear-gradient(135deg, #28a745, #20c997);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-icon mat-icon {
  color: white;
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.service-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
}

.service-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.service-item:hover {
  background: #e9ecef;
  transform: translateX(4px);
}

.service-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.3s ease;
}

.status-indicator.active {
  background: linear-gradient(135deg, #28a745, #20c997);
  box-shadow: 0 0 8px rgba(40, 167, 69, 0.4);
}

.status-indicator.inactive {
  background: linear-gradient(135deg, #dc3545, #c82333);
  box-shadow: 0 0 8px rgba(220, 53, 69, 0.4);
}

.service-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #2c3e50;
}

.service-state {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.service-state.active {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
}

.service-state.inactive {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
}

/* ===== SECCIÓN DE DATOS ===== */
.data-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.data-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.data-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.data-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.data-icon {
  background: linear-gradient(135deg, #17a2b8, #138496);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.data-icon mat-icon {
  color: white;
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.data-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
}

.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.data-table th {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  color: #495057;
  padding: 1rem;
  font-weight: 600;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f3f4;
  color: #2c3e50;
  font-size: 0.9rem;
}

.data-table tr:hover {
  background: #f8f9fa;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .dashboard {
    gap: 1rem;
  }

  .resources-section {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .services-section {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .resource-content {
    flex-direction: column;
    gap: 1rem;
  }

  .resource-card,
  .service-card,
  .data-card {
    padding: 1rem;
  }

  .cpu-circle {
    width: 100px;
    height: 100px;
  }

  .cpu-percentage {
    font-size: 1.5rem;
  }

  .service-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .service-item:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  .resource-header,
  .service-header,
  .data-header {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .resource-icon,
  .service-icon,
  .data-icon {
    width: 35px;
    height: 35px;
  }

  .resource-icon mat-icon,
  .service-icon mat-icon,
  .data-icon mat-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
  }

  .resource-title,
  .service-title,
  .data-title {
    font-size: 1.1rem;
  }

  .info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
}

/* ===== ANIMACIONES ===== */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.resource-card,
.service-card,
.data-card {
  animation: slideInUp 0.6s ease-out;
}

.resource-card:nth-child(1) { animation-delay: 0.1s; }
.resource-card:nth-child(2) { animation-delay: 0.2s; }
.resource-card:nth-child(3) { animation-delay: 0.3s; }

.service-card:nth-child(1) { animation-delay: 0.4s; }
.service-card:nth-child(2) { animation-delay: 0.5s; }

.data-card { animation-delay: 0.6s; }

/* ===== ESTILOS PARA LOS GRÁFICOS ===== */
::ng-deep .chart-container ngx-charts-pie-chart {
  width: 100% !important;
  height: auto !important;
}

::ng-deep .chart-container ngx-charts-pie-chart .chart-legend {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  display: block !important;
  margin-top: 1rem !important;
}

::ng-deep .chart-container ngx-charts-pie-chart .chart-legend .legend-labels {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

::ng-deep .chart-container ngx-charts-pie-chart .chart-legend .legend-label {
  display: flex !important;
  align-items: center !important;
  margin: 0.25rem 0 !important;
}