/* ================= Reset & Tipografía ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
}

/* ================= Hero ================= */
#hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  height: 100vh;
  padding: 3rem;
  background: linear-gradient(to bottom, #1e293b, #0f172a);
  color: #f1f5f9;
  gap: 2rem;
}

/* Hero Izquierda */
.hero-left {
  flex: 1 1 400px;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.hero-left h1 {
  font-size: 3rem;
  line-height: 1.1;
  color: #3b82f6;
  text-align: center;
  max-width: 700px;
  margin: 0 auto 1rem;
}

.hero-left p {
  font-size: 1.2rem;
  color: #e2e8f0;
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Perfil */
.hero-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 2rem 2.5rem;
  border-radius: 12px;
  border: 2px solid #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.hero-profile img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #3b82f6;
}

.profile-info h3 {
  font-size: 1.3rem;
  margin-bottom: 0.2rem;
}

.profile-info p {
  font-size: 0.9rem;
  color: #cbd5e1;
}

/* Botones */
.hero-buttons {
  display: flex;
  gap: 1rem;
}

.hero-buttons button {
  padding: 0.9rem 1.8rem;
  border-radius: 12px;
  border: 2px solid #3b82f6;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hero-buttons button:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  border-color: #2563eb;
  transform: scale(1.05) translateY(-2px);
}

/* Hero Derecha */
.hero-right {
  flex: 1 1 400px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.hero-right img {
  max-width: 100%;
  width: 350px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

/* Destacados */
.hero-highlights {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.hero-highlights .highlight {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  color: #f1f5f9;
  font-weight: 500;
}

/* Animación flotante */
.floating {
  animation: floatCard 6s ease-in-out infinite;
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-15px); }
}

/* Hero Responsive */
@media (max-width: 900px) {
  #hero {
    flex-direction: column;
    text-align: center;
    height: auto;         
    min-height: auto;    /* evitamos forzar altura innecesaria */
    padding: 2rem 1rem 4rem;
    gap: 2rem;
  }

  .hero-left, .hero-right {
    max-width: 100%;
    align-items: center;
  }

  /* Título más compacto */
  .hero-left h1 { 
    font-size: 2rem; 
    line-height: 1.2; 
  }

  /* Descripción */
  .hero-left p { 
    font-size: 1rem; 
    margin-bottom: 1.2rem; 
  }

  /* Botones van arriba, antes del perfil */
  .hero-buttons {
    order: 2;
    justify-content: center;
    margin-bottom: 1.5rem;
  }

  /* Tarjeta de perfil más pequeña */
  .hero-profile {
    order: 3;
    padding: 1rem;
    max-width: 300px;
  }

  .hero-profile img {
    width: 100px;
    height: 100px;
  }

  /* Tech stack más pequeño */
  .tech-stack {
    order: 4;
    justify-content: center;
    font-size: 1.5rem;
    margin-top: 1rem;
  }

  /* Snippet de código al final */
  .hero-right {
    order: 5;
    width: 100%;
  }

  .code-editor-card {
    max-width: 100%;
    margin-top: 1.5rem;
  }
}

/* ================= Main Content ================= */
#main-content {
  width: 100%;
  background: linear-gradient(to bottom, #dbeafe, #bfdbfe);
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* ================= Proyectos ================= */
#projects {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

#projects h2 {
  margin-bottom: 1rem;
  color: #1e40af;
}

.section-subtitle {
  font-size: 1rem;
  color: #1e3a8a;
  margin-bottom: 2rem;
}

/* Tabs */
#tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

#tabs .tab {
  padding: 0.5rem 1rem;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  background: transparent;
  color: #3b82f6;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#tabs .tab.active {
  background: #3b82f6;
  color: #fff;
}

#tabs .tab:hover {
  background: #2563eb;
  color: #fff;
}

/* Grid Proyectos */
#projects-container {
  display: grid;
  gap: 2.5rem;
  margin-top: 1rem;
  grid-template-columns: repeat(2, minmax(680px, 1fr));
  justify-content: center;
  align-items: stretch;
}

/* Card Proyecto */
.project-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, #1e293b, #273449);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  min-height: 420px;
  opacity: 0;
  transform: translateY(20px);
}

.project-card.show {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 25px rgba(0,0,0,0.6);
}

.project-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 2px solid #3b82f6;
}

.project-card-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
  padding: 1.2rem;
}

.project-card h3 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: #60a5fa;
  font-weight: 700;
}

.project-card p {
  flex-grow: 1.1;
  font-size: 1rem;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

/* Chips */
.project-card .tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.project-card .tech span {
  background: #2563eb;
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Botones */
.project-card a {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.project-card a:first-of-type {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.project-card a:first-of-type:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  transform: scale(1.07) translateY(-2px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
}

.project-card a:last-of-type {
  background: transparent;
  border: 2px solid #3b82f6;
  color: #3b82f6;
}

.project-card a:last-of-type:hover {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
  transform: scale(1.05);
}

/* Proyectos Responsive */
@media (max-width: 900px) {
  #projects-container {
    grid-template-columns: 1fr;
  }

  .project-card h3 {
    font-size: 1.2rem; 
  }

  .project-card p {
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;     
    white-space: normal;       
    overflow-wrap: break-word;  
  }
}

@media (max-width: 600px) {
  .project-card h3 {
    font-size: 1.2rem; 
  }

  .project-card p {
    font-size: 0.85rem; 
  }
}

/* ================= Contacto ================= */
#contact {
  color: #0f172a;
  padding: 4rem 2rem;
  text-align: center;
  border-radius: 12px;
}

#contact h2 {
  margin-bottom: 1rem;
  color: #1e40af;
  font-size: 1.5rem;
}

#contact .section-subtitle {
  font-size: 1rem;
  color: #1e3a8a;
  margin-bottom: 2rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

/* Links de contacto */
.contact-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* Caja de contacto */
.contact-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 2rem;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  width: 320px;
  min-height: 120px;
  font-weight: 600;
  text-decoration: none;
  color: #0f172a;
  transition: all 0.3s ease;
}

.contact-box span {
  font-size: 1rem;
}

.contact-box small {
  font-size: 0.85rem;
  color: #475569;
  word-break: break-all;
}

/* Icono circular */
.icon-circle {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  transition: background 0.3s ease, transform 0.3s ease;
}

.icon-circle i {
  font-size: 1.6rem;
  color: #3b82f6;
  transition: color 0.3s ease;
}

/* Hover */
.contact-box:hover {
  background: #3b82f6;
  color: #fff;
  transform: scale(1.05);
}

.contact-box:hover small { color: #e0f2fe; }
.contact-box:hover .icon-circle { background: #2563eb; transform: scale(1.1); }
.contact-box:hover .icon-circle i { color: #fff; }

/* ================= Footer ================= */
footer {
  width: 100%;
  background: #0f172a;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: #3b82f6;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s ease, transform 0.3s ease;
}

.footer-links a i {
  margin-right: 0.4rem;
  font-size: 1.2rem;
}

.footer-links a:hover {
  color: #2563eb;
  transform: scale(1.05);
}

.footer-copy {
  text-align: center;
}

/* ================= Back to Top ================= */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 0.8rem 1rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  display: block;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: all 0.3s ease, opacity 0.3s ease;
  z-index: 1000;
}

#back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

#back-to-top:hover {
  transform: scale(1.05) translateY(-2px);
}

/* ================= Code Editor Card ================= */
.code-editor-card {
  background: #1e1e2e;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 450px;
  font-family: 'Fira Code', monospace;
  margin-top: 2rem;
}

/* Header estilo VSCode */
.code-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #2d2d3a;
  font-size: 0.85rem;
  color: #94a3b8;
}

.code-header .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-header .red { background: #ef4444; }
.code-header .yellow { background: #facc15; }
.code-header .green { background: #22c55e; }

.filename {
  margin-left: auto;
  font-style: italic;
}

/* Contenido */
.code-content {
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-line;
}

/* Coloreado estilo VSCode */
.keyword     { color: #c792ea; }
.class-name  { color: #82aaff; }
.this        { color: #ffcb6b; }
.property    { color: #f78c6c; }
.string      { color: #c3e88d; }

/* Tech stack */
.tech-stack {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.tech-item {
  font-size: 2rem;
  color: #3b82f6;
  transition: transform 0.3s ease, color 0.3s ease;
}

.tech-item:hover {
  color: #2563eb;
  transform: scale(1.2);
}

/* ================= Modal ================= */
#project-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-content {
  background: #1e293b;
  border-radius: 16px;
  padding: 2rem;
  max-width: 950px;
  width: 90%;
  height: 400px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  color: #f1f5f9;
  position: relative;
  animation: fadeIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

#modal-title {
  text-align: center;
  margin-bottom: 1rem;
  color: #60a5fa;
}

.modal-close {
  position: absolute;
  top: 15px; right: 20px;
  font-size: 2rem;
  color: #f1f5f9;
  cursor: pointer;
}

/* Modal body */
.modal-body {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  flex: 1;
  overflow: hidden;
}

/* Imagen izquierda */
.modal-image-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image-wrapper img {
  max-width: 300px;
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
}

/* Info derecha */
.modal-info {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.modal-details-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
}

.modal-info p {
  font-size: 1rem;
  color: #e2e8f0;
  text-align: left;
  margin: 0;
}

.modal-actions {
  margin-top: auto;
}

/* Chips */
.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.modal-tech .tech-chip {
  background: #2563eb;
  color: #fff;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ================= Botones modal ================= */
.modal-buttons {
  display: flex;
  gap: 1rem;
}

.modal-buttons a {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer; 
  transition: background 0.3s ease, transform 0.2s ease, opacity 0.2s ease;
}

/* GitHub */
.modal-buttons a:first-of-type {
  background: #3b82f6;
  color: #fff;
}

.modal-buttons a:first-of-type:hover {
  background: #2563eb;
  transform: scale(1.05);
  opacity: 0.95;
}

/* Demo */
.modal-buttons a:last-of-type {
  border: 2px solid #3b82f6;
  color: #3b82f6;
  background: transparent;
}

.modal-buttons a:last-of-type:hover {
  background: #3b82f6;
  color: #fff;
  transform: scale(1.05);
  opacity: 0.95;
}

/* Modal responsive */
@media (max-width: 768px) {
  .modal-content {
    padding: 1rem;
    max-width: 95%;
    height: auto;
  }

  #modal-title {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    text-align: center;
  }

  /* Ocultar imagen en móviles */
  .modal-image-wrapper {
    display: none;
  }

  .modal-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.8rem;
  }

  .modal-info {
    width: 100%;
    align-items: center;
  }

  .modal-info p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
    word-break: break-word;  
    white-space: normal;      
  }

  /* Chips más pequeños y en varias filas */
  .modal-tech {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .modal-tech .tech-chip {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 6px;
  }

  /* Botones más compactos y que fluyan en varias filas */
  .modal-buttons {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
  }

  .modal-buttons a {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
  }
}

/* ================= Popup ================= */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(30, 41, 59, 0.55); 
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
  font-size: 0.9rem;
  font-weight: 400;
  z-index: 3000;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.notification i { color: #60a5fa; font-size: 1rem; }
.notification.show { opacity: 1; transform: translateY(0); }

/* Asegurar cursor pointer en botones de tarjetas */
.project-links a,
.project-links a:visited {
  cursor: pointer;
}

/* ================= Títulos con líneas ================= */
#projects h2,
#contact h2 {
  position: relative;
  text-align: center;
  font-size: 2rem;
  margin: 2.5rem 0 2rem;
  color: #1e40af;
  z-index: 1;
}

#projects h2::before,
#projects h2::after,
#contact h2::before,
#contact h2::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(96, 165, 250, 0.5), transparent);
}

#projects h2::before,
#contact h2::before { top: -12px; }

#projects h2::after,
#contact h2::after { bottom: -12px; }

/* ================= No Projects ================= */
.no-projects {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 200px;
}

.no-projects p {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(90deg, #3b82f6, #1d409e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}
