/* modelos-3d.css — Diseño premium para galería de modelos 3D */

/* ============================================
   HERO SECTION
   ============================================ */
.models-hero {
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 120px 0 80px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  z-index: 0;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(102, 126, 234, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 126, 234, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.1) 30%, transparent 70%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

/* Floating shapes */
.floating-shapes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
}

.shape-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  right: -100px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  animation: float1 8s ease-in-out infinite;
}

.shape-2 {
  width: 200px;
  height: 200px;
  bottom: -50px;
  left: 10%;
  background: linear-gradient(135deg, #a78bfa, #667eea);
  animation: float2 10s ease-in-out infinite;
}

.shape-3 {
  width: 150px;
  height: 150px;
  top: 30%;
  left: -50px;
  background: linear-gradient(135deg, #667eea, #06b6d4);
  animation: float3 12s ease-in-out infinite;
}

.shape-4 {
  width: 100px;
  height: 100px;
  bottom: 20%;
  right: 15%;
  background: linear-gradient(135deg, #764ba2, #f472b6);
  animation: float4 9s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-30px, 30px) rotate(180deg); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(40px, -20px) rotate(-180deg); }
}

@keyframes float3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, 40px); }
}

@keyframes float4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, -30px) scale(1.2); }
}

/* Hero content */
.models-hero .hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(102, 126, 234, 0.15);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 50px;
  color: #a78bfa;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 24px;
  animation: badgeFadeIn 0.8s ease forwards;
}

.hero-badge svg {
  width: 18px;
  height: 18px;
}

@keyframes badgeFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 20px;
  animation: titleSlideIn 0.8s 0.2s ease forwards;
  opacity: 0;
}

@keyframes titleSlideIn {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #a78bfa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientFlow 3s ease infinite;
}

@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-subtitle {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 600px;
  animation: subtitleFadeIn 0.8s 0.4s ease forwards;
  opacity: 0;
}

@keyframes subtitleFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats */
.hero-stats {
  display: flex;
  gap: 40px;
  animation: statsFadeIn 0.8s 0.6s ease forwards;
  opacity: 0;
}

@keyframes statsFadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #667eea, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* ============================================
   MODELS SECTION
   ============================================ */
.models-section {
  padding: 60px 0 100px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  min-height: 60vh;
}

/* Filters */
.models-filters {
  margin-bottom: 50px;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.filters-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}

.filters-title svg {
  width: 24px;
  height: 24px;
  stroke: #667eea;
}

.models-count {
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #667eea;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.filter-btn:hover {
  border-color: #667eea;
  color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.filter-btn.active {
  border-color: transparent;
  color: #fff;
}

.filter-btn.active::before {
  opacity: 1;
}

.filter-icon, .filter-text {
  position: relative;
  z-index: 1;
}

.filter-icon {
  font-size: 1.1rem;
}

.btn-ripple {
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple {
  to { transform: scale(3); opacity: 0; }
}

/* ============================================
   MODELS GRID
   ============================================ */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 30px;
}

/* Loading spinner 3D cube */
.loading-models {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #64748b;
}

.loading-spinner-3d {
  perspective: 200px;
  width: 60px;
  height: 60px;
  margin-bottom: 20px;
}

.spinner-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: cubeRotate 2s infinite ease-in-out;
}

.spinner-cube .face {
  position: absolute;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
}

.face.front { transform: translateZ(30px); }
.face.back { transform: rotateY(180deg) translateZ(30px); }
.face.right { transform: rotateY(90deg) translateZ(30px); }
.face.left { transform: rotateY(-90deg) translateZ(30px); }
.face.top { transform: rotateX(90deg) translateZ(30px); }
.face.bottom { transform: rotateX(-90deg) translateZ(30px); }

@keyframes cubeRotate {
  0% { transform: rotateX(0deg) rotateY(0deg); }
  50% { transform: rotateX(180deg) rotateY(180deg); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

/* ============================================
   MODEL CARDS
   ============================================ */
.model-card {
  position: relative;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(30px);
}

.model-card.revealed {
  animation: cardReveal 0.6s ease forwards;
}

@keyframes cardReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes cardFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

.model-card:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 20px 40px rgba(102, 126, 234, 0.15),
    0 0 0 1px rgba(102, 126, 234, 0.1);
}

/* Card preview area */
.model-preview-area {
  position: relative;
  height: 220px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.model-preview-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 30% 30%, rgba(102, 126, 234, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(118, 75, 162, 0.05) 0%, transparent 50%);
}

.preview-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  transition: transform 0.4s ease;
  position: relative;
  z-index: 1;
}

.model-card:hover .preview-icon {
  transform: scale(1.15) rotate(5deg);
}

.preview-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  text-align: center;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.preview-category {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 4px 12px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-radius: 20px;
  position: relative;
  z-index: 1;
}

/* Card hover overlay */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.model-card:hover .card-overlay {
  opacity: 1;
}

.overlay-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: #fff;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  color: #667eea;
  cursor: pointer;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s 0.1s ease;
}

.model-card:hover .overlay-btn {
  transform: translateY(0);
  opacity: 1;
}

.overlay-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.overlay-btn svg {
  width: 20px;
  height: 20px;
}

/* Card info */
.model-info {
  padding: 24px;
}

.model-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 10px;
  line-height: 1.3;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.model-description {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card actions */
.model-actions {
  display: flex;
  gap: 10px;
}

.model-actions .btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.model-actions .btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  color: #fff;
}

.model-actions .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
}

.model-actions .btn-ghost {
  background: transparent;
  border: 2px solid #e2e8f0;
  color: #64748b;
}

.model-actions .btn-ghost:hover {
  border-color: #667eea;
  color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.5rem;
  color: #1f2937;
  margin-bottom: 10px;
}

.empty-state p {
  color: #64748b;
  margin-bottom: 24px;
}

/* ============================================
   MODAL ENHANCEMENTS
   ============================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 35, 0.9);
  backdrop-filter: blur(10px);
  animation: backdropFadeIn 0.3s ease;
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from { 
    opacity: 0;
    transform: scale(0.9) translateY(30px);
  }
  to { 
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 28px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  gap: 15px;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  text-align: center;
  color: #fff;
}

/* Logos en el header del modal */
.modal-header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-header-logo-right {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.modal-logo {
  height: 45px;
  width: auto;
  object-fit: contain;
}

.modal-logo-unam {
  height: 50px;
}

.modal-logo-dgapa {
  height: 30px;
  filter: brightness(0) invert(1);
}

a.modal-header-logo {
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

a.modal-header-logo:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.modal-papime-text {
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.modal-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

.modal-body {
  padding: 0;
}

.model-viewer-container {
  position: relative;
  width: 100%;
  height: 500px;
  background: #1a1a2e;
}

.model-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  color: #fff;
  z-index: 10;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#model-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.model-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.model-controls .btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .models-hero {
    padding: 100px 0 60px;
    min-height: auto;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-stats {
    gap: 24px;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .models-section {
    padding: 40px 0 60px;
  }
  
  .filters-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .filter-buttons {
    gap: 8px;
  }
  
  .filter-btn {
    padding: 10px 14px;
    font-size: 0.8rem;
  }
  
  .filter-icon {
    font-size: 1rem;
  }
  
  .models-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .model-viewer-container {
    height: 350px;
  }
  
  .model-controls {
    flex-wrap: wrap;
  }

  /* Responsive logos modal */
  .modal-header {
    padding: 12px 15px;
    gap: 10px;
  }

  .modal-header h3 {
    font-size: 0.9rem;
  }

  .modal-logo-unam {
    height: 35px;
  }

  .modal-logo-dgapa {
    height: 22px;
  }

  .modal-papime-text {
    font-size: 0.55rem;
  }
}

@media (max-width: 480px) {
  .hero-badge {
    font-size: 0.75rem;
    padding: 8px 14px;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .hero-stats {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .model-actions {
    flex-direction: column;
  }

  /* Logos más pequeños en móvil */
  .modal-logo-unam {
    height: 28px;
  }

  .modal-logo-dgapa {
    height: 18px;
  }

  .modal-papime-text {
    font-size: 0.5rem;
  }

  .modal-header h3 {
    font-size: 0.8rem;
