/* Reset y Variables */
:root {
  --primary-color: #2c5aa0; /* Azul principal (serio/médico) */
  --secondary-color: #4a90e2; /* Azul secundario (más brillante) */
  --accent-color: #e8f4f8; /* Fondo claro/detalle */
  --text-dark: #222;
  --text-light: #666;
  --border-color: #ddd;
  --success-color: #4caf50; /* Verde */
  --error-color: #f44336; /* Rojo */
  --pending-color: #ff9800; /* Naranja (Pendiente/En Proceso) */
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius: 8px;
}

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

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: #f5f5f5;
  padding-bottom: 50px; /* Espacio para el footer */
}

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

/* =========================== */
/* HEADER Y NAVEGACIÓN */
/* =========================== */

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

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  width: 90px;
  height: 90px;
  object-fit: contain;   /* NO recorta */
  border-radius: 50%;    /* lo hace circular */
  background-color: white; /* opcional si el logo tiene transparencia */
  padding: 8px; /* opcional para que respire dentro del círculo */
}

.header-text {
  flex-grow: 1;
}

.header-text h1 {
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
}

.header-subtitle {
  font-size: 1rem;
  opacity: 0.8;
}

.header-contact {
  font-size: 0.9rem;
  text-align: right;
  display: none; /* Ocultar por defecto en móviles */
}

@media (min-width: 768px) {
  .header-text h1 {
    font-size: 2.5rem;
  }
  .header-contact {
    display: block;
  }
}

/* Navegación */
nav {
  background-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  padding: 0;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.8rem 1rem;
  display: block;
  font-weight: 500;
  transition: background-color 0.3s ease;
  border-bottom: 3px solid transparent;
}

nav a:hover {
  background-color: var(--secondary-color);
  border-bottom: 3px solid white;
}

/* =========================== */
/* TARJETAS Y CONTENIDO */
/* =========================== */

.card {
  background-color: white;
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 2rem 0;
}

.welcome-card {
  background: white;
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.welcome-icon {
    padding: 1rem;
    background-color: var(--accent-color);
    border-radius: 50%;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.welcome-card p {
    color: var(--text-light);
    max-width: 600px;
}

h2 {
  color: var(--primary-color);
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

h3 {
  color: var(--text-dark);
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

/* Formularios */
.form-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
  outline: none;
}

@media (min-width: 768px) {
  .form-container {
    flex-direction: row;
    align-items: flex-end;
  }
  .form-group {
    flex: 1;
  }
}

/* Botones */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 6px rgba(44, 90, 160, 0.3);
}

.btn-primary:hover {
  background-color: #244883;
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success-color);
  color: white;
  box-shadow: 0 4px 6px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
  background-color: #43a047;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #f0f0f0;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #e0e0e0;
}

.action-buttons {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Área de Mensajes */
.message-area {
  margin-top: 1rem;
  min-height: 40px; /* Para evitar CLS */
}

.message {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-weight: 500;
  animation: fadeIn 0.5s ease-out;
}

.message.error {
  background-color: #fde8e8;
  color: var(--error-color);
  border: 1px solid var(--error-color);
}

.message.success {
  background-color: #e8f5e9;
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.message.info {
  background-color: var(--accent-color);
  color: var(--primary-color);
  border: 1px solid var(--secondary-color);
}

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

/* Área de Resultados */
.results-area {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px dashed var(--border-color);
}

.exam-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--accent-color);
  border-radius: var(--radius);
}

.exam-details-grid p {
  padding: 0.5rem 0;
  border-bottom: 1px dotted #ccc;
}
.exam-details-grid p:last-child {
  border-bottom: none;
}

@media (min-width: 600px) {
  .exam-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.badge {
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.success {
  background-color: var(--success-color);
  color: white;
}

.badge.pending {
  background-color: var(--pending-color);
  color: white;
}

/* =========================== */
/* VISOR DICOM (ORTHANC) */
/* =========================== */

.viewer-note {
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.viewer-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.dicom-viewer-container {
  width: 100%;
  height: 500px; /* Altura estándar */
  border: 1px solid var(--primary-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.dicom-viewer-container iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

/* Fullscreen mode adjustments for the viewer */
.dicom-viewer-container:fullscreen {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    margin: 0;
}
.dicom-viewer-container:-webkit-full-screen {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    margin: 0;
}
.dicom-viewer-container:-ms-fullscreen {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    margin: 0;
}

/* =========================== */
/* AYUDA Y CONTACTO (FAQ) */
/* =========================== */

.faq h4 {
    color: var(--secondary-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* =========================== */
/* FOOTER */
/* =========================== */

footer {
  background-color: var(--text-dark);
  color: white;
  padding: 2rem 1rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--secondary-color);
}

.footer-section p {
  margin: 0.5rem 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.footer-section a {
  color: white;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.footer-section a:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-bottom p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  opacity: 0.8;
}
/* =========================== */
/* GALERÍA DE IMÁGENES DE EXAMEN */
/* =========================== */

.imagenes-galeria {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1.5rem;
    justify-content: center;
}

.imagenes-galeria img {
    width: 150px;          /* Tamaño fijo para miniaturas */
    height: 150px;         /* Mantiene proporción cuadrada */
    object-fit: cover;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.imagenes-galeria img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
    .imagenes-galeria img {
        width: 100px;
        height: 100px;
    }
}
/* =========================== */
/* CENTRADO DE TEXTOS ESPECÍFICOS */
/* =========================== */

/* Centrar título "Consultar Examen" */
.consulta-section > h2 {
    text-align: center;
}

/* Centrar sección Ayuda */
#ayuda h2,
#ayuda p,
#ayuda .faq {
    text-align: center;
}

/* Centrar Contacto */
#contacto h2,
#contacto ul {
    text-align: center;
}

/* Centrar los items dentro del ul de contacto */
#contacto ul li {
    display: block;
    margin: 0.3rem 0;
}
/* Centrar subtítulo "Portal de Resultados de Exámenes" */
.header-subtitle {
    text-align: center;
    width: 100%;
}


/* ============================================================
   RESPONSIVE MÓVIL
   ============================================================ */
@media (max-width: 600px) {

  /* Header más compacto */
  .header-content {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-text h1 {
    font-size: 1.3rem;
  }

  .logo {
    width: 60px;
    height: 60px;
  }

  /* Nav adaptado a móvil */
  .nav-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
  }

  nav a {
    font-size: 0.75rem;
    padding: 0.5rem 0.6rem;
    text-align: center;
    flex: 1 1 auto;
    min-width: 80px;
  }

  /* Contenedor principal */
  .container {
    padding: 0.5rem;
  }

  /* Cards */
  .card {
    padding: 1rem;
  }

  .welcome-card {
    padding: 1rem;
  }

  /* Formulario vertical */
  .form-container {
    flex-direction: column;
  }

  .form-group input {
    font-size: 1rem;
  }

  /* Botones */
  .action-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  /* Visor DICOM */
  .dicom-viewer-container {
    height: 300px;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}