:root {
  --primary-color: #1e3a5f;
  --secondary-color: #4a90e2;
  --accent-color: #c0c0c0;
  --text-dark: #2c2c2c;
  --text-light: #666;
  --bg-light: #f5f7fa;
  --bg-white: #ffffff;
  --border-color: #d0d8e0;
  --shadow: 0 2px 8px rgba(30,58,95,0.1);
  --shadow-hover: 0 4px 16px rgba(30,58,95,0.15);
  --error-color: #c41e3a;
  --warning-color: #ff8c00;
  --success-color: #2e7d32;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-light);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0f1f3a 100%);
  color: white;
  padding: 2rem 0;
  box-shadow: var(--shadow);
}

.header-with-logo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.header-content {
  flex: 1;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.header-logo {
  flex-shrink: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  display: block;
}

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

.header-logo img {
  display: block;
  width: 78px;
  height: 78px;
  border-radius: 8px;
}

.search-bar {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-white);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  transition: border-color 0.3s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--secondary-color);
}

.filters {
  margin: 1.5rem 0;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-dark);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
}

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

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

.problemas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.problema-card {
  background: var(--bg-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

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

.problema-imagen {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--bg-light);
}

.problema-contenido {
  padding: 1.5rem;
}

.problema-nombre {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.problema-descripcion {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.problema-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.gravedad-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.gravedad-leve {
  background: #e8f5e9;
  color: var(--success-color);
}

.gravedad-moderada {
  background: #fff3e0;
  color: var(--warning-color);
}

.gravedad-grave {
  background: #ffebee;
  color: var(--error-color);
}

.categoria-tag {
  font-size: 0.85rem;
  color: var(--text-light);
}

.ficha-detalle {
  max-width: 900px;
  margin: 2rem auto;
  background: var(--bg-white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Título y meta info */
.ficha-titulo {
  padding: 2rem 2rem 1rem 2rem;
  background: var(--bg-white);
  border-bottom: 2px solid var(--border-color);
}

.ficha-titulo h1 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.ficha-titulo .meta-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Descripción técnica destacada */
.descripcion-principal {
  padding: 2rem;
  background: var(--bg-light);
  margin: 0;
}

.descripcion-principal h2 {
  color: var(--primary-color);
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.contenido-destacado {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-dark);
}

/* Sección de galería */
.ficha-galeria {
  padding: 2rem 2rem 0 2rem;
  text-align: center;
}

.ficha-contenido {
  padding: 2rem;
}

.seccion {
  margin-bottom: 2.5rem;
}

.seccion h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--secondary-color);
}

.seccion h3 {
  color: var(--text-dark);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem 0;
}

.seccion ul {
  list-style-position: inside;
  padding-left: 1rem;
}

.seccion li {
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.paso-a-paso {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: 8px;
}

.paso-a-paso ol {
  list-style-position: inside;
  padding-left: 1rem;
}

.paso-a-paso li {
  margin-bottom: 1rem;
  font-weight: 500;
}

.alerta {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.alerta-warning {
  background: #fff3e0;
  color: #e65100;
}

.alerta-danger {
  background: #ffebee;
  color: #b71c1c;
}

.alerta-info {
  background: #e3f2fd;
  color: #0d47a1;
}

.btn-volver {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  margin: 2rem 0;
  transition: background 0.3s;
}

.btn-volver:hover {
  background: #5c3317;
}

footer {
  background: var(--primary-color);
  color: white;
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
}

footer p {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

footer p.copyright {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-top: 0.5rem;
}

footer a {
  color: #a8c5e6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

footer a:hover {
  color: white;
  text-decoration: underline;
}

.ficha-header {
  padding: 2rem 2rem 0 2rem;
  text-align: center;
}

/* Contenedor de imagen + pie superpuesto */
.imagen-con-fuente {
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  transition: transform 0.2s ease;
}

.imagen-con-fuente:hover {
  transform: scale(1.01);
}

.imagen-con-fuente:hover .lupa-icon {
  opacity: 1;
}

/* Icono de lupa */
.lupa-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.lupa-icon svg {
  width: 24px;
  height: 24px;
  color: #333;
  stroke-width: 2.5;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox-content {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lightbox-close {
  position: absolute;
  top: 25px;
  right: 35px;
  color: #fff;
  font-size: 50px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
  line-height: 1;
  user-select: none;
}

.lightbox-close:hover {
  color: var(--secondary-color);
}

/* Imagen responsive */
.ficha-imagen-principal {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 600px;
}

/* Pie de foto superpuesto */
.pie-foto {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(80, 80, 80, 0.85);  /* gris oscuro semitransparente */
  padding: 0.35rem 0.6rem;
  margin: 0;
  font-size: 0.75rem;
  font-style: italic;
  text-align: center;
  line-height: 1.2;
  color: #fff;  /* texto blanco para contraste */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Descripción fuera de la imagen */
.descripcion-imagen {
  max-width: 800px;
  margin: 1rem auto 0;
  padding: 0 2rem;
  text-align: center;
  background: none;
  border: 0;
  line-height: 1.6;
}

/* Galería de thumbnails */
.galeria-thumbnails {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 1rem 0;
}

.thumbnail-item {
  width: 80px;
  height: 80px;
  border: 3px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.thumbnail-item:hover {
  border-color: var(--secondary-color);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.thumbnail-item.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--secondary-color);
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.no-resultados {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
  font-size: 1.1rem;
}
