/* Variables - Paleta de colores formal y tecnológica */
:root {
  --primary-color: #0f172a; /* Slate 900 - Tono oscuro principal */
  --secondary-color: #0284c7; /* Sky 600 - Azul profesional para acentos */
  --accent-color: #38bdf8; /* Sky 400 - Detalles interactivos */
  --text-main: #334155;
  --text-muted: #64748b;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --border-light: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset básico y Tipografía */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

/* Animación de entrada inicial */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Contenedor Principal */
.container {
  display: flex;
  max-width: 1050px;
  margin: 50px auto;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  animation: fadeIn 0.6s ease-out;
}

/* Barra Lateral */
.sidebar {
  background: linear-gradient(180deg, var(--primary-color) 0%, #1e293b 100%);
  color: #f8fafc;
  width: 320px;
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Línea superior decorativa */
.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--secondary-color);
}

.sidebar .photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  transition:
    transform 0.3s ease,
    border-color 0.3s ease;
}

.sidebar .photo:hover {
  transform: scale(1.03);
  border-color: var(--accent-color);
}

.sidebar h1 {
  font-size: 24px;
  margin: 0 0 12px 0;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.sidebar .location {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar .contact,
.sidebar .links {
  width: 100%;
  font-size: 14px;
  margin-bottom: 24px;
}

.sidebar .contact {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 0;
  line-height: 1.8;
}

.sidebar .icon {
  margin-right: 8px;
  font-size: 16px;
  opacity: 0.8;
}

.sidebar a {
  color: var(--accent-color);
  text-decoration: none;
  transition:
    color 0.2s,
    padding-left 0.2s;
  display: inline-block;
}

.sidebar .links a {
  display: block;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.sidebar .links a:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--accent-color);
  color: #ffffff;
}

/* Contenido Principal */
.main {
  flex: 1;
  padding: 48px 56px;
  background: var(--bg-body);
}

/* Secciones (Tarjetas interactivas) */
section {
  margin-bottom: 36px;
  padding: 28px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

section:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

section h2 {
  font-size: 18px;
  margin: 0 0 20px 0;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  font-weight: 700;
}

section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
  margin-left: 16px;
}

p {
  margin-top: 0;
  margin-bottom: 16px;
  text-align: justify;
}

ul {
  margin: 0;
  padding-left: 24px;
  color: var(--text-main);
}

li {
  margin-bottom: 8px;
  padding-left: 4px;
}

li::marker {
  color: var(--secondary-color);
}

.meta {
  font-size: 14px;
  color: var(--secondary-color);
  font-weight: 600;
  margin-bottom: 10px;
}

/* Etiquetas de Habilidades (Skills) */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 20px;
}

.skills span {
  background-color: var(--bg-body);
  color: var(--primary-color);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  cursor: default;
}

.skills span:hover {
  background-color: var(--secondary-color);
  color: #ffffff;
  border-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.2);
}

strong {
  color: var(--primary-color);
  font-weight: 700;
}

/* Enlaces dentro del Main */
.main a {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 600;
  position: relative;
}

.main a::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--secondary-color);
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease-out;
}

.main a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* Responsividad para móviles */
@media (max-width: 900px) {
  .container {
    flex-direction: column;
    margin: 20px;
    border-radius: 12px;
  }
  .sidebar {
    width: 100%;
    padding: 40px 24px;
  }
  .main {
    padding: 32px 24px;
  }
  section {
    padding: 20px 16px;
  }
}

/* Optimización estricta para Impresión y PDF */
@media print {
  @page {
    margin: 1cm 1.5cm;
  }
  body,
  html {
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .container {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    max-width: 100%;
    display: block;
    animation: none !important;
  }

  /* Ajuste de la barra lateral para impresión (Foto + Textos alineados) */
  .sidebar {
    width: 100% !important;
    background: transparent !important;
    color: #000 !important;
    padding: 0 0 20px 0 !important;
    border-bottom: 2px solid #e2e8f0 !important;
    display: flex !important;
    flex-direction: row !important; /* Coloca la foto y texto lado a lado */
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 25px !important;
  }

  .sidebar::before {
    display: none !important;
  }

  /* Mantiene la foto visible en impresión */
  .sidebar .photo {
    display: block !important;
    width: 120px !important;
    height: 120px !important;
    margin: 0 !important;
    border: 2px solid #cbd5e1 !important;
    box-shadow: none !important;
  }

  /* Contenedor invisible para forzar el texto a la derecha de la foto */
  .sidebar h1,
  .sidebar .location,
  .sidebar .contact,
  .sidebar .links {
    text-align: left !important;
  }

  .sidebar h1 {
    color: #000 !important;
    font-size: 24px !important;
    margin-bottom: 4px !important;
  }

  .sidebar .location {
    color: #444 !important;
    margin-bottom: 8px !important;
  }

  .sidebar .contact,
  .sidebar .links {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
  }

  .sidebar .links a {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    color: #0284c7 !important;
  }

  .main {
    padding: 24px 0 0 0 !important;
    background: #fff !important;
  }

  section {
    margin-bottom: 20px !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    transform: none !important;
  }

  section h2 {
    color: #0f172a !important;
    border-bottom: 1px solid #e2e8f0 !important;
    font-size: 16px !important;
    padding-bottom: 4px !important;
    margin-bottom: 12px !important;
  }

  section h2::after {
    display: none !important;
  }

  .skills {
    gap: 8px !important;
  }

  .skills span {
    background: transparent !important;
    color: #000 !important;
    border: 1px solid #94a3b8 !important;
    padding: 2px 10px !important;
    font-size: 12px !important;
  }

  .main a {
    text-decoration: underline !important;
  }

  .main a::after {
    display: none !important;
  }
}
