/* ========================================
   DASHBOARD - SISTEMA DE DISEÑO MEJORADO
   ======================================== */

/* ========================================
   JERARQUÍA DE TARJETAS EN DASHBOARD
   ======================================== */

/* 1. NIVEL ALTO - Tarjetas Premium (Proyectos, Análisis) */
.dashboard-premium-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid transparent;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(10, 59, 92, 0.12);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
}

.dashboard-premium-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #42C0FB, #2894D8, #0A3B5C);
  z-index: 1;
}

.dashboard-premium-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(10, 59, 92, 0.2);
  border-color: #42C0FB;
}

.dashboard-premium-card .card-header {
  background: linear-gradient(135deg, #0A3B5C 0%, #0D5C8F 50%, #2894D8 100%);
  border: none;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.dashboard-premium-card .card-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(66, 192, 251, 0.1) 0%, transparent 70%);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.6; }
}

/* 2. NIVEL MEDIO - Tarjetas Estándar (Riesgos, Estadísticas) */
.dashboard-standard-card {
  background: var(--white);
  border-radius: 0.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--petrol-blue);
  border-top: 3px solid var(--maya-blue);
  transition: all 0.3s ease;
}

.dashboard-standard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(10, 59, 92, 0.2);
}

.dashboard-standard-card .card-header {
  background-color: transparent !important;
  color: var(--petrol-blue) !important;
  border-bottom: 1px solid var(--gray-300);
  font-weight: 600;
  padding: 1rem;
}

/* 3. NIVEL BAJO - Tarjetas Sutiles (Indicadores, Gráficos) */
.dashboard-subtle-card {
  background: var(--maya-bg);
  border: 1px solid var(--petrol-blue);
  border-top-color: var(--maya-medium);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.dashboard-subtle-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(10, 59, 92, 0.15);
}

/* ========================================
   COMPONENTES ESPECÍFICOS DEL DASHBOARD
   ======================================== */

/* Tarjetas de estadísticas mejoradas */
.stats-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  border: 1px solid var(--petrol-blue);
  border-top: 3px solid var(--maya-blue);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #42C0FB, #2894D8);
}

.stats-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(10, 59, 92, 0.15);
  border-color: #42C0FB;
}

.stats-card .stats-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  color: white;
  position: relative;
}

.stats-card .stats-icon.primary {
  background: linear-gradient(135deg, #42C0FB, #2894D8);
}

.stats-card .stats-icon.success {
  background: linear-gradient(135deg, #28a745, #1e7e34);
}

.stats-card .stats-icon.warning {
  background: linear-gradient(135deg, #ffc107, #e0a800);
}

.stats-card .stats-icon.danger {
  background: linear-gradient(135deg, #dc3545, #c82333);
}

.stats-card .stats-value {
  font-size: 2rem;
  font-weight: 700;
  color: #0A3B5C;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.stats-card .stats-label {
  color: #6c757d;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tarjetas de riesgo mejoradas */
.risk-mini-card {
  background: var(--white);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--gray-300);
  border-left: 4px solid var(--maya-blue);
  transition: all 0.3s ease;
  margin-bottom: 0.75rem;
}

.risk-mini-card:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(10, 59, 92, 0.15);
  border-left-color: var(--maya-medium);
}

.risk-mini-card .risk-name {
  font-weight: 600;
  color: var(--petrol-blue);
  margin-bottom: 0.5rem;
}

.risk-mini-card .risk-criticality {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.risk-criticality.high {
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.risk-criticality.medium {
  background-color: rgba(255, 193, 7, 0.1);
  color: #ffc107;
}

.risk-criticality.low {
  background-color: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

/* Lista de proyectos mejorada */
.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-item {
  background: var(--white);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--gray-300);
  border-left: 4px solid var(--maya-blue);
  transition: all 0.3s ease;
  cursor: pointer;
}

.project-item.active {
  border-left-color: var(--maya-medium);
  background-color: var(--maya-bg);
}

.project-item:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(10, 59, 92, 0.15);
}

.project-item .project-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Contenedores de gráficos */
.chart-container {
  background: var(--white);
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid var(--gray-300);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.chart-container:hover {
  box-shadow: 0 4px 12px rgba(10, 59, 92, 0.15);
}

/* ========================================
   BOTONES ESPECÍFICOS DEL DASHBOARD
   ======================================== */

/* Botón flotante para intermediarios */
.intermediary-floating-button {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #42C0FB, #2894D8);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(66, 192, 251, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.intermediary-floating-button:hover {
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 6px 20px rgba(66, 192, 251, 0.4);
  color: white;
}

.intermediary-floating-button:active {
  transform: translateY(0) scale(1) !important;
}

.intermediary-floating-button i {
  transition: transform 0.3s ease;
}

.intermediary-floating-button:hover i {
  transform: rotate(90deg);
}

/* ========================================
   UTILIDADES DEL DASHBOARD
   ======================================== */

/* Grid responsivo */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Sección de resiliencia */
.resilience-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--gray-300);
}

.resilience-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
}

/* Estados de proyectos */
.bg-pending { 
  background-color: rgba(255, 193, 7, 0.1) !important; 
  color: #ffc107 !important;
}

.bg-active { 
  background-color: rgba(40, 167, 69, 0.1) !important; 
  color: #28a745 !important;
}

.bg-completed { 
  background-color: rgba(66, 192, 251, 0.1) !important; 
  color: #42C0FB !important;
}

.bg-canceled { 
  background-color: rgba(220, 53, 69, 0.1) !important; 
  color: #dc3545 !important;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .stats-card {
    padding: 1rem;
  }
  
  .stats-card .stats-value {
    font-size: 1.5rem;
  }
  
  .intermediary-floating-button {
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .dashboard-premium-card .card-header {
    padding: 1rem;
  }
  
  .dashboard-premium-card .card-header h5 {
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  .stats-card .stats-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .risk-mini-card,
  .project-item {
    padding: 0.75rem;
  }
  
  .resilience-section {
    padding: 1rem;
  }
}

/* ========================================
   ANIMACIONES Y TRANSICIONES
   ======================================== */

/* Animación de carga para gráficos */
.chart-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
  height: 200px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Transiciones suaves para todas las tarjetas */
.card,
.stats-card,
.risk-mini-card,
.project-item,
.chart-container {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   COMPATIBILIDAD CON SISTEMA EXISTENTE
   ======================================== */

/* Mantener compatibilidad con clases existentes */
.dashboard td,
.dashboard th {
  word-break: break-word;
}

.dashboard .module table th {
  width: 100%;
}

.dashboard .module table td {
  white-space: nowrap;
}

.dashboard .module table td a {
  display: block;
  padding-right: 0.6em;
}

.module ul.actionlist {
  margin-left: 0;
}

ul.actionlist li {
  list-style-type: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges para criticidad */
.badge {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Utilidades de colapsables */
.collapse .list-group-item {
  background-color: #fff;
}

/* Grid responsivo de tarjetas */
.row.g-4 {
  margin-top: 1rem;
}

/* Títulos y encabezados */
.dashboard-container {
  padding: 1rem;
}

.expandable-card {
  margin-bottom: 1rem;
}

.expandable-card .card-header {
  cursor: pointer;
  user-select: none;
}

.expandable-card .card-header i {
  transition: transform 0.3s ease;
}

.expandable-card.expanded .card-header i {
  transform: rotate(180deg);
}

/* Contador de tarjetas */
.counter-card {
  text-align: center;
  padding: 1.5rem;
}

.counter-card .counter-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--maya-blue);
  line-height: 1;
}

.counter-card .counter-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.5rem;
}

/* Formularios de proyecto */
.project-form .form-group {
  margin-bottom: 1rem;
}

.project-form label {
  font-weight: 600;
  color: var(--petrol-blue);
  margin-bottom: 0.5rem;
}

.project-form .form-control {
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
}

/* Carousel */
.carousel-item {
  background: var(--white);
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid var(--gray-300);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.carousel-item.active {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(10, 59, 92, 0.15);
}

/* Prevenir ampliación de botones al hacer clic en dashboard */
.dashboard .btn:active,
.dashboard button:active {
  transform: translateY(0) scale(1) !important;
}

.carousel-item img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.carousel-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
