/* Optimizaciones específicas para diferentes viewports de laptop */

/* Viewport específico para 1360x768 - máxima precisión */
@media screen and (min-device-width: 1360px) and (max-device-width: 1360px) and
       (min-device-height: 768px) and (max-device-height: 768px) {

  /* Reset del layout para esta resolución específica */
  * {
    box-sizing: border-box;
  }

  body {
    margin: 0;
    padding: 0;
    padding-left: 13.5rem !important;
    overflow-x: hidden;
  }

  /* Sidebar ultra optimizado */
  #sideNav {
    width: 13.5rem !important;
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #sideNav .navbar-brand {
    flex-shrink: 0 !important;
    padding: 0.3rem !important;
    margin-bottom: 0.5rem !important;
  }

  #sideNav .navbar-collapse {
    flex-grow: 1 !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 120px) !important;
  }

  #sideNav .navbar-nav {
    padding: 0.2rem 0 !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  #sideNav .navbar-nav .nav-item {
    margin-bottom: 0.1rem !important;
    flex-shrink: 0 !important;
  }

  #sideNav .navbar-nav .nav-item .nav-link {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.7rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Imagen de perfil más pequeña */
  .view .over {
    max-width: 5rem !important;
    max-height: 5rem !important;
    border-radius: 50% !important;
  }

  /* Optimizar menús desplegables */
  .nav_item.nav__item {
    margin-bottom: 0.1rem !important;
  }

  .nav__item nav ul {
    margin: 0 !important;
    padding: 0 !important;
  }

  .nav__item nav ul li {
    margin: 0 !important;
    padding: 0 !important;
  }

  .nav__item nav ul li a {
    padding: 0.15rem 0.4rem !important;
    font-size: 0.65rem !important;
    line-height: 1 !important;
    display: block !important;
  }

  /* Botón de contacto más pequeño */
  .boton-contacto-menu {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.65rem !important;
    margin-top: 0.2rem !important;
    margin-bottom: 0.2rem !important;
    border-radius: 15px !important;
  }

  /* Selectores de idioma más compactos */
  #sideNav .subheading {
    font-size: 0.6rem !important;
    margin: 0.1rem 0 !important;
    padding: 0.1rem 0.5rem !important;
    cursor: pointer !important;
  }

  /* Legal link más pequeño */
  #sideNav .nav-item a[href="#footer"] {
    font-size: 0.6rem !important;
    padding: 0.2rem 0.5rem !important;
  }

  /* Contenido principal optimizado */
  .container-fluid {
    width: calc(100vw - 13.5rem) !important;
    max-width: calc(100vw - 13.5rem) !important;
    padding: 0 1rem !important;
    margin: 0 !important;
  }

  /* Secciones ultra compactas */
  section.resume-section {
    padding: 1rem 0 !important;
    min-height: auto !important;
    border-bottom: 1px solid #dee2e6;
  }

  /* Títulos muy compactos */
  h1 {
    font-size: 3.2rem !important;
    line-height: 2.8rem !important;
    margin-bottom: 0.8rem !important;
  }

  h2 {
    font-size: 2rem !important;
    margin-bottom: 1.2rem !important;
  }

  h3 {
    font-size: 1.3rem !important;
    line-height: 1.2 !important;
    margin-bottom: 0.5rem !important;
  }

  /* About section súper compacta */
  #about {
    padding: 0.5rem 0 1rem 0 !important;
  }

  #about .my-auto {
    padding: 0 !important;
  }

  #about h1 {
    margin-top: 0 !important;
  }

  #about p {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.8rem !important;
  }

  /* Experience section optimizada */
  #experience {
    padding: 1rem 0 !important;
  }

  .resume-item {
    margin-bottom: 1.2rem !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .resume-item .resume-content {
    margin-bottom: 0.5rem !important;
  }

  .resume-item .resume-content h3 {
    font-size: 1.1rem !important;
    margin-bottom: 0.3rem !important;
  }

  .resume-item .resume-content p {
    font-size: 0.85rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.3rem !important;
  }

  .resume-item .resume-date {
    font-size: 0.8rem !important;
    color: #7a98b9 !important;
    font-weight: 600 !important;
    min-width: auto !important;
  }

  /* Education section compacta */
  #education {
    padding: 1rem 0 !important;
  }

  #education .resume-content h3 {
    font-size: 1.05rem !important;
    line-height: 1.2 !important;
  }

  #education .resume-content h4 {
    font-size: 0.95rem !important;
  }

  #education .subheading {
    font-size: 0.85rem !important;
    margin-bottom: 0.3rem !important;
  }

  /* Skills section ultra optimizada */
  #skill {
    padding: 1rem 0 !important;
  }

  #skill .container .row {
    margin: 0 !important;
    gap: 0.5rem !important;
  }

  #skill .col {
    padding: 0 0.5rem !important;
  }

  .sb-container,
  .sb-container2 {
    width: 90px !important;
    height: 240px !important;
    margin: 10px auto !important;
  }

  .sb-container div,
  .sb-container2 div {
    width: 80px !important;
    height: 240px !important;
  }

  .sb-icon {
    max-width: 30px !important;
    max-height: 30px !important;
    margin: 5px auto !important;
  }

  .sb-container h4 span,
  .sb-container2 h4 span {
    font-size: 0.65rem !important;
    line-height: 1 !important;
    margin-top: 2px !important;
  }

  /* Portfolio section muy compacta */
  #Porfolio {
    padding: 1rem 0 !important;
  }

  .carousel-inner {
    max-height: 280px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
  }

  .carousel-item {
    height: 280px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
  }

  .img-galeria {
    max-height: 180px !important;
    max-width: 100% !important;
    object-fit: contain !important;
    margin-bottom: 0.5rem !important;
  }

  .carousel-item h4 {
    font-size: 1rem !important;
    margin: 0.3rem 0 !important;
  }

  .carousel-item h5 {
    font-size: 0.85rem !important;
    margin: 0.2rem 0 !important;
  }

  .carousel-item p {
    font-size: 0.75rem !important;
    margin: 0 !important;
  }

  /* Competencias muy pequeñas */
  #interests {
    padding: 1rem 0 !important;
  }

  .competencias {
    max-width: 320px !important;
    max-height: 192px !important;
    width: auto !important;
    height: auto !important;
    transition: transform 0.2s ease !important;
  }

  .competencias:hover {
    transform: scale(1.05) !important;
  }

  #interests .text-center h3 {
    font-size: 0.9rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Videos section compacta */
  #video {
    padding: 1rem 0 !important;
  }

  .youtube-player-container {
    max-width: 450px !important;
  }

  #youtube-player {
    height: 250px !important;
  }

  .custom-controls {
    margin-top: 0.5rem !important;
  }

  .custom-controls .btn {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
    margin: 0 1px !important;
    border-radius: 15px !important;
  }

  /* Footer muy compacto */
  footer {
    padding: 1rem 0 !important;
    margin-top: 1rem !important;
  }

  footer p {
    margin-bottom: 0.3rem !important;
    font-size: 0.85rem !important;
  }

  footer .legal-info p {
    font-size: 0.75rem !important;
  }

  /* Popup de contacto optimizado */
  .popup {
    max-width: 400px !important;
    max-height: 60vh !important;
    padding: 1.2rem !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  .popup h1 {
    font-size: 1.5rem !important;
    margin-bottom: 0.8rem !important;
  }

  .contenedor-inputs {
    margin-bottom: 1rem !important;
  }

  .contenedor-inputs input,
  .contenedor-inputs textarea {
    width: 100% !important;
    padding: 0.4rem !important;
    margin-bottom: 0.6rem !important;
    font-size: 0.85rem !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
  }

  .contenedor-inputs textarea {
    height: 80px !important;
    resize: vertical !important;
  }

  #boton {
    padding: 0.6rem 1.5rem !important;
    font-size: 0.9rem !important;
    background-color: #7a98b9 !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
  }

  /* Modales optimizados */
  .modal-dialog {
    max-width: 550px !important;
    margin: 0.3rem auto !important;
  }

  .modal-body {
    padding: 0.8rem !important;
    font-size: 0.85rem !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
  }

  .modal-header {
    padding: 0.8rem !important;
  }

  .modal-header .modal-title {
    font-size: 1.1rem !important;
  }

  .modal-footer {
    padding: 0.6rem !important;
  }

  /* Navegación desplegable compacta */
  .nav__item ul {
    max-height: 100px !important;
    overflow-y: auto !important;
    font-size: 0.75rem !important;
  }

  .nav__item ul li {
    margin: 0 !important;
  }

  .nav__item ul li a {
    padding: 0.25rem 0.5rem !important;
    line-height: 1.2 !important;
  }

  /* Botón de contacto */
  .boton-contacto-menu {
    padding: 0.5rem 1rem !important;
    font-size: 0.8rem !important;
    margin-top: 0.3rem !important;
    border-radius: 20px !important;
  }

  /* Carrusel controls más pequeños */
  .carousel-control-prev,
  .carousel-control-next {
    width: 6% !important;
  }

  .carousel-control-prev-icon,
  .carousel-control-next-icon {
    width: 20px !important;
    height: 20px !important;
  }

  /* Scroll optimizado */
  html {
    scroll-behavior: smooth;
    overflow-x: hidden;
  }

  body {
    overflow-x: hidden;
  }

  /* Asegurar que nada se desborde horizontalmente */
  * {
    max-width: 100% !important;
  }

  img {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Media query adicional para laptops con ratio 16:9 cerca de 1360x768 */
@media screen and (min-width: 1300px) and (max-width: 1400px) and
       (min-height: 720px) and (max-height: 800px) {

  /* Aplicar algunos de los mismos estilos pero menos agresivos */
  body {
    padding-left: 14rem !important;
  }

  #sideNav {
    width: 14rem !important;
  }

  section.resume-section {
    padding: 1.5rem 0 !important;
  }

  h1 {
    font-size: 3.8rem !important;
    line-height: 3.4rem !important;
  }

  h2 {
    font-size: 2.4rem !important;
  }

  .sb-container,
  .sb-container2 {
    height: 260px !important;
  }

  .carousel-inner {
    max-height: 320px !important;
  }

  .competencias {
    max-width: 380px !important;
    max-height: 230px !important;
  }
}