/* -----------------------------------
   🧱 ESTRUCTURA GENERAL DEL DOCUMENTO
------------------------------------ */

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #fafafa;
  color: #2c2c2c;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* -----------------------------------
   🧩 HEADER
------------------------------------ */

header {
  text-align: center;
  background-color: #2563eb;
  color: white;
  padding: 3rem 1rem;
  transition: background-color 0.3s ease;
}

.perfil {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid white;
  margin-bottom: 1.5rem;
  object-fit: cover;
}

header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2.2rem;
  font-weight: 400;
}

header p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.9;
}

/* -----------------------------------
   🧱 CONTENIDO PRINCIPAL
------------------------------------ */

main {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.proyectos,
.contacto,
.estadisticas {
  background: white;
  margin-bottom: 2.5rem;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.estadisticas .contador {
  font-size: 2.5rem;
  text-align: center;
  margin: 0;
  font-weight: 300;
  color: #2563eb;
}

.estadisticas .barra {
  position: relative;
  background: #f3f4f6;
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin: 1rem 0;
}

.estadisticas .relleno {
  background: #2563eb;
  height: 100%;
  width: 0;
  transition: width 0.6s ease;
}

h2 {
  color: #1f2937;
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  margin-top: 0;
}

a {
  color: #2563eb;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #1d4ed8;
}

/* -----------------------------------
   📝 PROJECT LIST STYLING
------------------------------------ */

.proyectos ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.proyectos li {
  padding: 0.8rem 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 1rem;
  color: #4b5563;
}

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

body.oscuro .proyectos li {
  border-bottom-color: #374151;
  color: #d1d5db;
}

/* -----------------------------------
   📬 FORMULARIO DE CONTACTO
------------------------------------ */

form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-width: 450px;
  margin: 0 auto;
}

form input,
form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form input:focus,
form textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

form textarea {
  resize: vertical;
  min-height: 100px;
}

form button {
  padding: 0.8rem;
  background-color: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  transition: background-color 0.2s ease;
}

form button:hover {
  background-color: #1d4ed8;
}

form button:active {
  transform: translateY(1px);
}

/* -----------------------------------
   💬 EFECTO MÁQUINA DE ESCRIBIR
------------------------------------ */

.typing {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 400;
  margin-top: 1rem;
  min-height: 2rem;
  color: rgba(255, 255, 255, 0.9);
}

body.oscuro .typing {
  color: rgba(255, 255, 255, 0.8);
}

/* -----------------------------------
   🔗 ICONOS DE REDES SOCIALES
------------------------------------ */

.socials {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.socials a {
  font-size: 1.5rem;
  color: #6b7280;
  transition: color 0.2s ease, transform 0.2s ease;
}

.socials a:hover {
  color: #2563eb;
  transform: translateY(-2px);
}

/* Fallback text for when Font Awesome doesn't load */
.socials a[href*="github"] i:not(.fa-github):empty::before {
  content: "GitHub";
  font-family: inherit;
  font-size: 1rem;
}

.socials a[href*="linkedin"] i:not(.fa-linkedin):empty::before {
  content: "LinkedIn";
  font-family: inherit;
  font-size: 1rem;
}

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

/* -----------------------------------
   🌗 BOTÓN DE MODO OSCURO + TOOLTIP
------------------------------------ */

.modo-wrapper {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#modo-toggle {
  position: relative;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  padding: 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #374151;
}

#modo-toggle:hover {
  background-color: #f3f4f6;
  transform: scale(1.05);
}

body.oscuro #modo-toggle {
  background-color: rgba(55, 65, 81, 0.9);
  color: #f9fafb;
  border-color: rgba(255, 255, 255, 0.1);
}

body.oscuro #modo-toggle:hover {
  background-color: #4b5563;
}

/* -----------------------------------
   🧾 TOOLTIP PERSONALIZADO
------------------------------------ */

.tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(55, 65, 81, 0.9);
  color: #f9fafb;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modo-wrapper:hover .tooltip {
  opacity: 1;
}

/* -----------------------------------
   🌑 MODO OSCURO (theme oscuro)
------------------------------------ */

body.oscuro {
  background-color: #111827;
  color: #e5e7eb;
}

body.oscuro header {
  background-color: #1f2937;
}

body.oscuro .proyectos,
body.oscuro .contacto,
body.oscuro .estadisticas {
  background-color: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

body.oscuro h2 {
  color: #f3f4f6;
}

body.oscuro .estadisticas .contador {
  color: #60a5fa;
}

body.oscuro .estadisticas .barra {
  background: #374151;
}

body.oscuro .estadisticas .relleno {
  background: #60a5fa;
}

body.oscuro a {
  color: #60a5fa;
}

body.oscuro a:hover {
  color: #93c5fd;
}

body.oscuro form input,
body.oscuro form textarea {
  background-color: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

body.oscuro form input:focus,
body.oscuro form textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

body.oscuro footer {
  background-color: #1f2937;
  color: #9ca3af;
}

/* -----------------------------------
   ⚓ FOOTER
------------------------------------ */

footer {
  text-align: center;
  background: #f3f4f6;
  padding: 2rem 1rem;
  font-size: 0.9rem;
  color: #6b7280;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* -----------------------------------
   📱 RESPONSIVE DESIGN
------------------------------------ */

@media (max-width: 768px) {
  main {
    padding: 1rem;
  }
  
  .proyectos,
  .contacto,
  .estadisticas {
    padding: 1.5rem;
  }
  
  header {
    padding: 2rem 1rem;
  }
  
  header h1 {
    font-size: 1.8rem;
  }
  
  .modo-wrapper {
    top: 1rem;
    right: 1rem;
  }
}
