/* components.css — cards, buttons, chips, tabs, cards */

/* Cards */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-large {
  padding: var(--space-xl);
  text-align: center;
}

.card-title {
  margin-bottom: var(--space-md);
  color: var(--brand);
}

.card-description {
  color: var(--muted);
  margin-bottom: var(--space-lg);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  background: var(--bg);
  color: var(--fg);
}

.btn:hover, .btn:focus {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: white;
}

.btn-ghost {
  background: transparent;
  border-color: var(--brand);
  color: var(--brand);
}

.btn-ghost:hover, .btn-ghost:focus {
  background: var(--brand);
  color: white;
}

/* Chips */
.chip {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: var(--space-sm);
}

/* Theme toggle */
.theme-toggle {
  position: relative;
}

.theme-switch {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-label {
  display: inline-block;
  padding: var(--space-sm);
  cursor: pointer;
  font-size: 1.25rem;
  border-radius: var(--border-radius);
  transition: background-color var(--transition-fast);
}

.theme-label:hover {
  background-color: var(--card);
}

.theme-switch:checked + .theme-label::before {
  content: '☀️';
}

.theme-switch:not(:checked) + .theme-label::before {
  content: '🌙';
}

/* Tabs (CSS only) */
.tab-controls {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-lg);
  border-bottom: 2px solid var(--border);
}

.tab-controls input[type="radio"] {
  display: none;
}

.tab-label {
  padding: var(--space-md) var(--space-lg);
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -2px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.tab-label:hover {
  background: var(--bg);
}

.tab-controls input[type="radio"]:checked + .tab-label {
  background: var(--bg);
  border-bottom: 2px solid var(--bg);
  color: var(--brand);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

/* Footer Premium */
.footer {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  color: #fff;
  padding: 0;
  margin-top: var(--space-3xl);
  overflow: hidden;
}

.footer-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(102, 126, 234, 0.6) 20%,
    rgba(118, 75, 162, 0.8) 50%,
    rgba(102, 126, 234, 0.6) 80%,
    transparent 100%);
  box-shadow: 0 0 30px rgba(102, 126, 234, 0.4);
}

.footer-wave {
  position: relative;
  margin-top: -1px;
  color: #1a1a2e;
}

.footer-wave svg {
  display: block;
  width: 100%;
  height: 60px;
}

.footer > .container {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-lg);
}

.footer-content {
  display: grid;
  gap: var(--space-2xl);
  grid-template-columns: 1.5fr repeat(3, 1fr);
  margin-bottom: var(--space-2xl);
}

/* Footer Brand Section */
.footer-brand {
  max-width: 320px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  margin-bottom: var(--space-lg);
  transition: transform 0.3s ease;
}

.footer-logo:hover {
  transform: translateX(5px);
  text-decoration: none;
}

.footer-logo-icon {
  width: 48px;
  height: 48px;
  color: #667eea;
}

.footer-logo-icon svg {
  width: 100%;
  height: 100%;
}

.footer-logo-text {
  display: flex;
  flex-direction: column;
}

.footer-logo-title {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #667eea 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.footer-logo-subtitle {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.footer-description {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

/* Social Links */
.footer-social {
  display: flex;
  gap: 12px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link svg {
  width: 18px;
  height: 18px;
}

.social-link:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
}

/* Footer Sections */
.footer-section {
  padding-top: var(--space-sm);
}

.footer-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-lg);
  position: relative;
  padding-bottom: var(--space-sm);
}

.footer-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 2px;
}

/* Footer Links */
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  padding: 4px 0;
}

.footer-links .link-icon {
  font-size: 0.8rem;
  opacity: 0;
  transform: translateX(-5px);
  transition: all 0.3s ease;
  color: #667eea;
}

.footer-links a:hover {
  color: #fff;
  transform: translateX(5px);
}

.footer-links a:hover .link-icon {
  opacity: 1;
  transform: translateX(0);
}

/* Contact Info */
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  line-height: 1.5;
}

.contact-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  stroke: #667eea;
}

.contact-item a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.3s ease;
}

.contact-item a:hover {
  color: #a78bfa;
}

/* Institutional Logos */
.footer-logos {
  padding: var(--space-xl) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.institutional-logos {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.inst-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.inst-logo:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(102, 126, 234, 0.3);
  transform: scale(1.05);
}

.inst-logo-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5px;
}

/* Footer Bottom */
.footer-bottom {
  padding-top: var(--space-lg);
}

.footer-bottom-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.copyright {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
}

.footer-bottom-links a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-bottom-links a:hover {
  color: #a78bfa;
}

.footer-bottom-links .separator {
  color: rgba(255, 255, 255, 0.2);
}

/* Footer Responsive */
@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-brand {
    grid-column: span 2;
    max-width: none;
    text-align: center;
  }
  
  .footer-logo {
    justify-content: center;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  .footer-description {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-xl);
  }
  
  .footer-brand {
    grid-column: span 1;
  }
  
  .footer-title::after {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .footer-links a {
    justify-content: center;
  }
  
  .footer-links a:hover {
    transform: none;
  }
  
  .footer-links .link-icon {
    display: none;
  }
  
  .contact-item {
    justify-content: center;
    text-align: left;
  }
  
  .footer-bottom-content {
    flex-direction: column;
    text-align: center;
  }
  
  .institutional-logos {
    gap: 16px;
  }
  
  .inst-logo {
    width: 60px;
    height: 60px;
  }
}

/* Video containers */
.video-container {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Media gallery */
.media-item {
  text-align: center;
}

.media-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--border-radius);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border);
}

figcaption {
  color: var(--muted);
  font-size: 0.875rem;
  font-style: italic;
}

/* Resources */
.resources-grid {
  display: grid;
  gap: var(--space-2xl);
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.resource-category h2 {
  margin-bottom: var(--space-lg);
  color: var(--brand);
  border-bottom: 2px solid var(--border);
  padding-bottom: var(--space-sm);
}

.resources-list {
  display: grid;
  gap: var(--space-md);
}

.resource-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}

.resource-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.resource-link {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg);
  color: var(--fg);
  text-decoration: none;
}

.resource-link:hover, .resource-link:focus {
  color: var(--brand);
  text-decoration: none;
}

.resource-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: var(--space-xs);
}

.resource-link h3 {
  margin: 0 0 var(--space-xs) 0;
  font-size: 1.125rem;
}

.resource-link p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Subsections */
.subsection {
  margin-bottom: var(--space-2xl);
}

.subsection h2 {
  margin-bottom: var(--space-lg);
  color: var(--brand);
}

/* Model Filters */
.models-filters {
  margin-bottom: var(--space-2xl);
  padding: var(--space-lg);
  background: var(--card);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border);
}

.models-filters h2 {
  margin-bottom: var(--space-md);
  color: var(--brand);
}

.filter-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.filter-btn {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  font-weight: 500;
}

.filter-btn:hover {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.filter-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* Model Cards Enhanced */
.model-card {
  padding: 0;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.model-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.model-preview {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

/* Estilos para vistas previas embebidas */
.model-card iframe {
  width: 100%;
  height: 220px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.model-card:hover iframe {
  cursor: pointer;
}

/* Overlay para indicar que es interactivo */
.model-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: transparent;
  pointer-events: none;
  z-index: 1;
  transition: all var(--transition-fast);
}

.model-card:hover::before {
  background: rgba(59, 130, 246, 0.1);
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.model-info {
  padding: var(--space-lg);
}

.model-name {
  margin-bottom: var(--space-sm);
  font-size: 1.125rem;
  line-height: 1.3;
}

.model-info p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.model-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.model-actions .btn {
  flex: 1;
  min-width: 120px;
  font-size: 0.875rem;
  padding: var(--space-sm) var(--space-md);
}

.model-info-btn {
  position: relative;
}

/* External link styling */
.model-card a[target="_blank"]::after {
  content: ' ↗';
  font-size: 0.75em;
  color: inherit;
}

/* Category-based styling */
.model-card[data-category="geomorfologia"] .chip {
  background-color: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.model-card[data-category="vulcanologia"] .chip {
  background-color: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.model-card[data-category="hidrologia"] .chip {
  background-color: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.model-card[data-category="geologia-costera"] .chip {
  background-color: #f0f9ff;
  color: #0c4a6e;
  border-color: #7dd3fc;
}

.model-card[data-category="mineria"] .chip {
  background-color: #fafaf9;
  color: #44403c;
  border-color: #d6d3d1;
}

.model-card[data-category="espeleologia"] .chip {
  background-color: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.model-card[data-category="limnologia"] .chip {
  background-color: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

/* Hidden models during filtering */
.model-card.hidden {
  display: none;
}

/* Modal para visualizador 3D */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90vw;
  max-width: 1200px;
  height: 80vh;
  max-height: 800px;
  background: var(--card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.modal-header h3 {
  margin: 0;
  color: var(--brand);
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--border);
  color: var(--fg);
}

.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.model-viewer-container {
  flex: 1;
  position: relative;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  color: var(--muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.model-loading.hidden {
  display: none;
}

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

#model-iframe.loaded {
  display: block;
}

.model-controls {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}

.model-controls .btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
}

.model-controls .btn span {
  font-size: 1rem;
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95vw;
    height: 85vh;
    margin: var(--space-md);
  }
  
  .model-controls {
    flex-direction: column;
  }
  
  .model-controls .btn {
    justify-content: center;
  }
}

/* Practice Virtual Layout */
.practice-layout {
  display: grid;
  gap: var(--space-2xl);
  grid-template-columns: 2fr 1fr;
  align-items: start;
}

.practice-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.practice-intro, .practice-objectives {
  background: var(--card);
  padding: var(--space-xl);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border);
}

.objectives-list {
  list-style: none;
  padding: 0;
}

.objectives-list li {
  position: relative;
  padding-left: var(--space-lg);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.objectives-list li::before {
  content: '🎯';
  position: absolute;
  left: 0;
  font-size: 1.2em;
}

/* Practice Steps */
.steps-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.step {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  transition: all var(--transition-normal);
}

.step:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--brand);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.125rem;
}

.step-content h3 {
  margin: 0 0 var(--space-sm) 0;
  color: var(--brand);
}

.step-content p {
  margin: 0 0 var(--space-md) 0;
  color: var(--muted);
}

/* Practice Sidebar */
.practice-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.practice-resources, .practice-tips, .practice-support {
  background: var(--card);
  padding: var(--space-lg);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border);
}

.practice-resources h3, .practice-tips h3, .practice-support h3 {
  margin: 0 0 var(--space-lg) 0;
  color: var(--brand);
  font-size: 1.125rem;
}

/* Download Items */
.resource-downloads {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.download-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.download-info {
  flex: 1;
}

.download-info h4 {
  margin: 0 0 var(--space-xs) 0;
  font-size: 0.95rem;
}

.download-info p {
  margin: 0 0 var(--space-xs) 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.file-info {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

.download-item .btn {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Tips List */
.tips-list {
  list-style: none;
  padding: 0;
}

.tips-list li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tips-list li:last-child {
  border-bottom: none;
}

.practice-support p {
  margin-bottom: var(--space-md);
  font-size: 0.9rem;
  color: var(--muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .practice-layout {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .step {
    flex-direction: column;
    text-align: center;
  }
  
  .step-number {
    align-self: center;
  }
  
  .download-item {
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
  }
}
