:root {
  /* Colores modo claro */
  --primary-light: #2c3e50;
  --secondary-light: #2980b9;
  --text-light: #333;
  --light-light: #f8f9fa;
  --gray-light: #6c757d;
  --bg-light: #ffffff;
  --card-light: #ffffff;
  --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);

  /* Colores modo oscuro */
  --primary-dark: #1a1a2e;
  --secondary-dark: #4cc9f0;
  --text-dark: #f8f9fa;
  --light-dark: #16213e;
  --gray-dark: #a8a8a8;
  --bg-dark: #0f3460;
  --card-dark: #1a1a2e;
  --shadow-dark: 0 1px 3px rgba(0, 0, 0, 0.3);

  /* Variables actuales */
  --primary: var(--primary-light);
  --secondary: var(--secondary-light);
  --text: var(--text-light);
  --light: var(--light-light);
  --gray: var(--gray-light);
  --bg: var(--bg-light);
  --card: var(--card-light);
  --shadow: var(--shadow-light);
}

body {
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Estilos para el modo oscuro */
body.dark-mode {
  --primary: var(--primary-dark);
  --secondary: var(--secondary-dark);
  --text: var(--text-dark);
  --light: var(--light-dark);
  --gray: var(--gray-dark);
  --bg: var(--bg-dark);
  --card: var(--card-dark);
  --shadow: var(--shadow-dark);
}

header {
  background-color: var(--primary);
  color: white;
  padding: 2rem 0;
  text-align: left;
  transition: background-color 0.3s ease;
}

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

/* Botón de tema flotante */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

h1 {
  margin: 0;
  font-size: 2.5rem;
}

.profile-section, .about-section {
  background-color: var(--card);
  padding: 2rem;
  margin: 2rem 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.profile-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.profile-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
}

.profile-image:hover {
  transform: scale(1.03);
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

a.project-card {
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

a.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.project-preview {
  width: 100%;
  height: 180px;
  border: none;
  object-fit: cover;
  pointer-events: auto;
}

.project-content {
  padding: 1rem;
}

.project-content h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.project-content p {
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
  white-space: normal;
}

.ver-mas-container {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  color: var(--secondary);
  font-weight: bold;
}

.symbol {
  font-size: 1.5rem;
  font-weight: bold;
  transition: transform 0.3s ease;
}

.hidden-projects {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.hidden-projects.active {
  max-height: 1000px;
}

footer {
  background-color: var(--primary);
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  transition: background-color 0.3s ease;
}

/* =========================================
   BOTONES FLOTANTES (Columna derecha)
   ========================================= */
.floating-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse; /* Se apilan hacia arriba */
  align-items: flex-end;
  gap: 15px;
  z-index: 1000;
}

.floating-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  padding: 0;
  border: none;
  outline: none;
  color: white;
}

.floating-button:hover {
  transform: scale(1.1);
}

.floating-button .icon {
  font-size: 28px;
  margin-bottom: 0; /* Centrado si no hay texto */
  pointer-events: none;
}

/* Ocultar texto dentro de los botones para diseño limpio */
.floating-button .text {
  display: none; 
}

/* Colores */
.contacto-flotante { background-color: var(--secondary); }
.language-flotante { background-color: var(--gray); }

/* --- BOTÓN PDF ROJO Y PEQUEÑO --- */
#botonPDF {
  background-color: #e74c3c; /* Rojo */
  width: 50px; /* Un poco más pequeño que los otros */
  height: 50px;
  margin-right: 5px; /* Ligero ajuste para centrar visualmente en la pila */
}
#botonPDF:hover {
  background-color: #c0392b;
}
#botonPDF .icon {
  font-size: 20px;
}

/* Menús flotantes */
.floating-content {
  position: fixed;
  right: 20px;
  width: 280px;
  background-color: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  z-index: 1001;
  transform: scale(0);
  transform-origin: bottom right;
  opacity: 0;
  transition: all 0.3s ease;
}

.contacto-contenido { bottom: 100px; }
.language-contenido { bottom: 180px; }

.floating-content.mostrar {
  transform: scale(1);
  opacity: 1;
}

.floating-content h3 {
  margin-top: 0;
  color: var(--secondary);
  font-size: 1.2rem;
}

.floating-content ul {
  padding-left: 1.2rem;
  margin: 0.8rem 0;
  list-style: none;
}

.floating-content li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
}

.floating-content li:hover {
  background-color: rgba(0,0,0,0.1);
}

.floating-content li.active {
  font-weight: bold;
  color: var(--secondary);
}

.floating-content a {
  color: var(--secondary);
  text-decoration: none;
}

.floating-content a:hover {
  text-decoration: underline;
}

.cerrar-floating {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
}

.fa-envelope, .fa-github, .fa-linkedin, .fa-globe {
  margin-right: 8px;
  width: 16px;
  text-align: center;
}

.about-section ul li i {
  margin-right: 4px;
  margin-left: 4px;
  width: 16px;
  text-align: center;
  color: var(--secondary);
}

.profile-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  overflow: auto;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 40px;
  box-sizing: border-box;
}

.modal-content {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  border: 15px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
  cursor: zoom-in;
  transform-origin: center center;
}

.modal-content.zoomed { cursor: grab; }
.modal-content.zoomed:active { cursor: grabbing; }

.close-modal {
  position: absolute;
  top: 30px;
  right: 40px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
  z-index: 2001;
  background: rgba(0, 0, 0, 0.5);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.close-modal:hover,
.close-modal:focus {
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

/* MEDIA QUERIES PARA MÓVILES */
@media (max-width: 768px) {
  .projects { grid-template-columns: 1fr; gap: 1rem; }
  .profile-section { flex-direction: column; text-align: center; }
  .project-content { padding: 0.8rem; }
  .project-content h3 { font-size: 1.1rem; line-height: 1.3; margin-bottom: 0.3rem; }
  .project-content p { font-size: 0.85rem; line-height: 1.4; }
  .project-preview { height: 150px; }
  .theme-toggle { width: 45px; height: 45px; font-size: 1.3rem; }
  .modal-content-container { padding: 20px; }
  .modal-content { max-width: 95%; max-height: 95%; border-width: 10px; }
  .close-modal { top: 20px; right: 25px; font-size: 30px; width: 40px; height: 40px; }
  .floating-buttons { bottom: 15px; right: 15px; gap: 10px; }
  .floating-button { width: 60px; height: 60px; }
  .floating-content { width: 250px; right: 15px; }
}

@media (max-width: 480px) {
  .project-content h3 { font-size: 1rem; }
  .project-content p { font-size: 0.8rem; }
  .project-preview { height: 130px; }
  .floating-button { width: 55px; height: 55px; }
  .floating-button .icon { font-size: 24px; }
}

/* =========================================
   ESTILOS DE IMPRESIÓN (LAYOUT 2 PÁGINAS)
   ========================================= */
@media print {
    @page {
        margin: 0.5cm; /* Márgenes muy reducidos para ganar espacio */
        size: letter;
    }

    body {
        font-family: 'Arial', sans-serif;
        font-size: 9pt; /* Letra compacta */
        line-height: 1.25;
        color: #000 !important;
        background: #fff !important;
        margin: 0;
        padding: 0;
    }

    /* 1. OCULTAR LO QUE NO SIRVE EN PAPEL */
    .theme-toggle, .floating-buttons, .floating-content, .ver-mas-container, 
    #simboloMas, .profile-modal, footer, header, h4[data-i18n="info"] {
        display: none !important;
    }

    /* 2. HEADER PDF */
    .profile-section {
        flex-direction: row !important;
        border-bottom: 2px solid #333;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .profile-image {
        width: 60px !important;
        height: 60px !important;
        border: 1px solid #ccc;
        margin-right: 15px !important;
    }

    /* Nombre visible en el perfil */
    .profile-section div h2 {
        display: block !important;
        font-size: 18pt;
        margin: 0;
        color: #2c3e50 !important;
    }
    .profile-section div p {
        display: block !important;
        font-size: 10pt;
        color: #555;
        margin: 0;
    }

    /* 3. TÍTULOS Y TEXTOS */
    h2 {
        font-size: 12pt;
        border-bottom: 1px solid #ccc;
        margin-top: 10px;
        margin-bottom: 5px;
        color: #2c3e50 !important;
        text-transform: uppercase;
    }
    h3 { font-size: 10pt; margin: 2px 0; color: #000 !important; }
    p, li { margin-bottom: 2px; }

    .about-section { margin-bottom: 8px; padding: 0 !important; box-shadow: none !important; }

    /* Habilidades en 3 columnas */
    .about-section ul {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 2px 10px;
        margin: 0;
        padding-left: 15px;
    }

    /* 4. PROYECTOS (Compactos en Pag 1) */
    .project-preview, iframe { display: none !important; } /* Ocultar imágenes de proyectos */
    
    #hiddenProjects { display: block !important; max-height: none !important; }

    .projects {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .project-card {
        border: 1px solid #ddd;
        padding: 5px;
        box-shadow: none !important;
        page-break-inside: avoid;
        background: none !important;
    }

    .project-content { padding: 0 !important; }
    
    /* 5. SECCIONES ESPECIALES (Certificaciones y Cartas) */
    /* Truco: Usamos float para ponerlas lado a lado en la PÁGINA 2 */
    
    #certificaciones, #cartas-recomendacion {
        display: block;
        width: 48%; /* Casi la mitad del ancho */
        float: left; /* Flotar a la izquierda */
        margin-right: 2%;
        page-break-inside: avoid; /* No romper la sección */
        margin-top: 20px; /* Separación de lo anterior */
    }

    /* Forzar que las imágenes se vean y sean pequeñas */
    #certificaciones img.project-preview,
    #cartas-recomendacion img.project-preview {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        width: 100% !important;
        height: auto !important;
        max-height: 200px;
        object-fit: contain;
        border: 1px solid #ddd;
        margin-top: 5px;
    }

    /* Layout interno de estas secciones */
    #certificaciones .projects,
    #cartas-recomendacion .projects {
        display: block !important; /* Quitar grid aquí para que sea simple */
    }

    a { text-decoration: none; color: black !important; }
}