/* ====== VARIABLES CSS ====== */
:root {
  --color-primary: #b30000;
  --color-primary-dark: #8c0000;
  --color-primary-light: #ffeaea;
  --color-bg: #fdf9f9;
  --color-text: #333;
  --color-text-light: #444;
  --color-border: #e0e0e0;
  --color-white: #ffffff;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== RESET Y ESTILOS BASE ====== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 
               'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #fdf9f9 0%, #fff5f5 100%);
  color: var(--color-text);
  text-align: center;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ====== ENCABEZADO MODERNIZADO ====== */
header {
  background: linear-gradient(135deg, var(--color-primary) 0%, #950000 100%);
  color: var(--color-white);
  padding: clamp(1rem, 3vw, 1.5rem) clamp(1.25rem, 5vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

header h1 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.5px;
}

header nav {
  display: flex;
  gap: clamp(1rem, 3vw, 1.5rem);
}

header nav a {
  color: var(--color-white);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}

header nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-white);
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

header nav a:hover::after,
header nav .activo::after {
  width: 80%;
}

header nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ====== SECCIÓN PRINCIPAL ====== */
main {
  padding: clamp(2rem, 8vw, 4rem) clamp(1rem, 4vw, 2rem);
  flex: 1;
}

main h2 {
  color: var(--color-primary);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin-bottom: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

main p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--color-text-light);
  max-width: 700px;
  margin: 0.75rem auto 2.5rem;
  line-height: 1.7;
}

/* ====== BOTONES PRINCIPALES MODERNOS ====== */
.botones-inicio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.5rem, 4vw, 2.5rem);
  margin-top: clamp(2rem, 6vw, 4rem);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
}

.btn-inicio {
  background: linear-gradient(135deg, var(--color-primary) 0%, #950000 100%);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-md);
  padding: clamp(1rem, 3vw, 1.5rem) clamp(2rem, 5vw, 3rem);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.btn-inicio::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-inicio:hover::before {
  left: 100%;
}

.btn-inicio:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.btn-inicio:active {
  transform: translateY(-2px) scale(0.98);
}

.btn-inicio:focus-visible {
  outline: 3px solid rgba(179, 0, 0, 0.4);
  outline-offset: 4px;
}

/* ===== FORMULARIOS MODERNOS ===== */
.formulario-container {
  background: var(--color-white);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  margin: 2.5rem auto;
  width: min(90%, 750px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.formulario-container:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.formulario-container[hidden] {
  display: none !important;
}

.formulario-container h3 {
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 700;
}

.formulario {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.formulario label {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  gap: 0.5rem;
  font-size: 0.95rem;
}

.formulario input,
.formulario select,
.formulario textarea {
  padding: 0.875rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--color-white);
}

.formulario input:focus,
.formulario select:focus,
.formulario textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(179, 0, 0, 0.1);
}

.formulario textarea {
  resize: vertical;
  min-height: 120px;
}

.btn-form {
  margin-top: 1rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, #950000 100%);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

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

.btn-form:active {
  transform: scale(0.98);
}

.btn-agregar {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
}

.btn-agregar:hover {
  background: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.producto-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  align-items: center;
  margin-bottom: 0.875rem;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.info-usuario {
  background: #f0f8ff;
  border: 1px solid #2c5aa0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.info-usuario h4 {
  margin: 0 0 10px 0;
  color: #2c5aa0;
  font-size: 16px;
}

.info-usuario p {
  margin: 5px 0;
  font-size: 14px;
}

.info-usuario strong {
  color: #333;
}
/* Estudiantes adicionales */
#listaEstudiantes {
  background: var(--color-primary-light);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-top: 1.25rem;
  border: 1px solid rgba(179, 0, 0, 0.2);
}

.estudiante-extra {
  background: var(--color-white);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

/* ====== PIE DE PÁGINA ====== */
footer {
  background: linear-gradient(135deg, var(--color-primary) 0%, #950000 100%);
  color: var(--color-white);
  text-align: center;
  padding: 1.5rem 1rem;
  margin-top: auto;
  font-size: 0.95rem;
  box-shadow: var(--shadow-md);
}

/* ====== ANIMACIONES ====== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.formulario-container,
.btn-inicio {
  animation: fadeIn 0.5s ease-out;
}

/* ====== MODO OSCURO (OPCIONAL) ====== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a1a;
    --color-text: #e0e0e0;
    --color-text-light: #b0b0b0;
    --color-border: #333;
  }
  
  body {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  }
  
  .formulario-container {
    background: #2d2d2d;
  }
  
  .formulario input,
  .formulario select,
  .formulario textarea {
    background: #1a1a1a;
    color: var(--color-text);
    border-color: var(--color-border);
  }
  
  .producto-item {
    background: #242424;
  }
  
  .estudiante-extra {
    background: #242424;
  }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  header nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .botones-inicio {
    grid-template-columns: 1fr;
  }

  .producto-item {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ====== UTILIDADES ====== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}