/* stylesmobile.css: Advanced Mobile responsive styles for portfolio site */

/* Advanced Mobile Optimizations */
@media (max-width: 768px) {
  /* Reset and base optimizations */
  html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
  }

  body {
    font-size: 0.95rem;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    padding-top: 0; /* Remove white space at top */
  }

  .container {
    padding: 0.5rem;
    min-height: 100vh;
  }

  .max-width {
    max-width: 100%;
    padding: 0 8px;
  }

  /* Enhanced header with better mobile layout */
  .header {
    margin: 50px 0 1.5rem 0; /* Top margin to avoid button overlap */
    padding: 0 8px;
    flex-direction: column !important;
    text-align: center !important;
    gap: 20px !important;
  }

  .main-image {
    width: 120px !important;
    height: 120px !important;
    margin: 0 auto !important;
  }

  .header-text {
    max-width: 100% !important;
    text-align: center !important;
    margin: 0 !important;
  }

  .header-text h1 {
    font-size: 1.6rem !important;
    line-height: 1.2 !important;
    margin-bottom: 12px !important;
  }

  .header-text p {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    margin-bottom: 8px !important;
  }

  /* Enhanced social links */
  .header + div {
    justify-content: center !important;
    gap: 16px !important;
    margin: 16px 0 24px 0 !important;
    flex-wrap: wrap;
  }

  .header + div a {
    transform: scale(1.1);
    transition: transform 0.2s ease;
  }

  .header + div a:hover {
    transform: scale(1.2);
  }

  /* Enhanced navigation with better positioning */
  #cv-dropdown-container {
    position: fixed !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 1001;
  }

  #download-cv-btn {
    padding: 6px 8px !important;
    font-size: 0.65rem !important;
    gap: 0 !important;
    border-radius: 6px !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    color: transparent !important;
    min-width: 85px !important;
    max-width: 100px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    position: relative !important;
  }

  /* Hide original text and SVG completely */
  #download-cv-btn * {
    opacity: 0 !important;
    visibility: hidden !important;
  }

  #download-cv-btn::after {
    content: "⬇ CV" !important;
    color: white !important;
    font-size: 0.65rem !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    white-space: nowrap !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #language-btn {
    padding: 6px 8px !important;
    font-size: 0.7rem !important;
    gap: 3px !important;
    border-radius: 6px !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    color: white !important;
    min-width: 80px !important;
    max-width: 95px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    overflow: visible !important;
    white-space: nowrap !important;
    font-size: 0.65rem !important;
  }

  #language-dropdown-container {
    position: fixed !important;
    top: 8px !important;
    left: 8px !important;
    z-index: 1001;
  }

  /* Replace language button text with shorter version */
  #language-btn {
    padding: 6px 8px !important;
    font-size: 0.7rem !important;
    gap: 3px !important;
    border-radius: 6px !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    color: white !important;
    min-width: 80px !important;
    max-width: 95px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    overflow: visible !important;
    white-space: nowrap !important;
    font-size: 0.65rem !important;
    text-indent: -9999px !important;
    position: relative !important;
  }

  #language-btn::after {
    content: "🌐 Lang" !important;
    text-indent: 0 !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    white-space: nowrap !important;
  }

  /* Enhanced dropdowns */
  #cv-dropdown, #language-dropdown {
    top: 40px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
    backdrop-filter: blur(12px) !important;
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    min-width: 90px !important;
    font-size: 0.75rem !important;
    overflow: hidden;
  }

  #cv-dropdown {
    right: 0 !important;
    left: auto !important;
  }

  #language-dropdown {
    left: 0 !important;
    right: auto !important;
  }

  #cv-dropdown a, #language-dropdown button {
    padding: 10px 12px !important;
    font-size: 0.75rem !important;
    color: white !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    transition: background-color 0.2s ease !important;
    width: 100% !important;
    text-align: left !important;
  }

  #cv-dropdown a:hover, #language-dropdown button:hover {
    background: rgba(255,255,255,0.1) !important;
  }

  #cv-dropdown a:last-child, #language-dropdown button:last-child {
    border-bottom: none !important;
  }

  /* Enhanced grid layout for mobile */
  .grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .projects-column, .grades-column {
    width: 100% !important;
  }

  /* Enhanced section cards with better animations */
  .section-card {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin: 12px 8px;
    padding: 20px 16px;
    border-radius: 14px;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid rgba(255,255,255,0.1);
  }

  .section-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }

  .section-button {
    padding: 0 !important;
    background: none !important;
    border: none !important;
    width: 100% !important;
    text-align: left !important;
    cursor: pointer !important;
    pointer-events: auto !important;
  }

  .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    width: 100%;
  }

  .section-title {
    font-size: 1.1rem;
    line-height: 1.3;
    font-weight: 600;
    margin: 0;
  }

  .chevron-icon {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0;
    transition: transform 0.3s ease;
  }

  .section-card[data-open="true"] .chevron-icon {
    transform: rotate(90deg);
  }

  .section-content {
    padding: 16px 0 8px 0;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow: hidden;
  }

  .content-inner {
    padding: 0 !important;
  }

  /* Enhanced value displays */
  .percentage-value, .personal-value, .uni-value, .client-value {
    font-size: 1.1rem !important;
    margin-left: 8px !important;
    font-weight: 500 !important;
  }

  /* Enhanced client project cards */
  .client-project-card {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    margin: 12px auto;
    padding: 16px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
  }

  .client-project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  }

  /* Enhanced technology icons with better interactions */
  .tech-icon {
    width: 30px !important;
    height: 30px !important;
    margin: 0 6px 8px 0;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  }

  .tech-icon:hover, .tech-icon:active {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }

  .tech-icon.tutorial-glow {
    animation: mobileGlow 1s infinite alternate;
  }

  @keyframes mobileGlow {
    0% { 
      box-shadow: 0 0 12px 3px #8B5CF6, 0 0 24px 8px rgba(255,255,255,0.2);
      transform: scale(1.05);
    }
    100% { 
      box-shadow: 0 0 20px 8px #8B5CF6, 0 0 36px 16px rgba(255,255,255,0.4);
      transform: scale(1.1);
    }
  }

  /* Enhanced video embeds with better aspect ratios - 30% reducido para móvil */
  .vimeo-embed,
  iframe[src*="vimeo"],
  iframe[src*="youtube"] {
    width: calc((100vw - 24px) * 0.7) !important;
    height: calc((100vw - 24px) * 0.7 * 0.5625) !important;
    max-width: calc((100vw - 24px) * 0.7) !important;
    border-radius: 10px;
    margin: 12px auto 16px auto;
    display: block;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  }

  /* Enhanced media responsiveness - 30% reducido para móvil */
  img:not(.main-image):not([src*="icon"]):not([width="32"]):not([width="28"]):not([width="24"]), 
  video {
    max-width: calc((100vw - 24px) * 0.7);
    height: auto;
    border-radius: 10px;
    display: block;
    margin: 12px auto 16px auto;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  }

  /* Enhanced CTA text */
  .cta-text {
    font-size: 1.05rem;
    padding: 16px 12px;
    text-align: center;
    line-height: 1.5;
    font-weight: 500;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin: 12px 8px;
    backdrop-filter: blur(8px);
  }

  /* Enhanced tutorial system */
  /* Ocultar completamente los popups de tutorial en móvil */
  #tutorial-overlay {
    display: none !important;
  }

  /* Si por alguna razón aparece, ajustar estilos */
  #tutorial-overlay {
    backdrop-filter: blur(6px) !important;
  }

  .tutorial-popup, #tutorial-popup {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    font-size: 0.95rem !important;
    padding: 20px 16px !important;
    border-radius: 16px !important;
    left: 10px !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    line-height: 1.6;
    backdrop-filter: blur(12px) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3) !important;
    border: 1.5px solid rgba(255,255,255,0.2) !important;
  }

  #tutorial-title {
    font-size: 1.25rem !important;
    margin-bottom: 14px !important;
    line-height: 1.3;
    font-weight: 600 !important;
  }

  #tutorial-message {
    margin-bottom: 16px !important;
    line-height: 1.6;
  }

  .tutorial-footer {
    font-size: 0.85rem !important;
    opacity: 0.8;
    font-style: italic;
  }

  /* Enhanced SantiBot with better mobile UX */
  #santibot-container {
    bottom: 16px !important;
    right: 16px !important;
    width: 56px !important;
    height: 56px !important;
    z-index: 1000 !important;
  }

  #santibot-cta-text {
    position: fixed !important;
    bottom: 80px !important;
    right: 70px !important;
    background: rgba(15, 23, 42, 0.95) !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-size: 0.8rem !important;
    max-width: 180px !important;
    text-align: left !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    z-index: 999 !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
    white-space: normal !important;
  }

  /* Add arrow pointing to bot */
  #santibot-cta-text::after {
    content: '' !important;
    position: absolute !important;
    bottom: -5px !important;
    right: 20px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 6px solid transparent !important;
    border-right: 6px solid transparent !important;
    border-top: 6px solid rgba(15, 23, 42, 0.95) !important;
  }

  #santibot-button {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.6rem !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
    backdrop-filter: blur(10px) !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Ensure button image/content fits properly */
  #santibot-button img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
  }

  #santibot-button:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3) !important;
  }

  #santibot-modal {
    position: fixed !important;
    width: calc(100vw - 20px) !important;
    height: 85vh !important;
    max-width: calc(100vw - 20px) !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 75px !important;
    top: auto !important;
    border-radius: 16px !important;
    backdrop-filter: blur(12px) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25) !important;
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    z-index: 9999 !important;
    padding: 0 !important;
    overflow: hidden !important;
    flex-direction: column !important;
  }

  /* Only apply flex when modal is visible */
  #santibot-modal[style*="display: block"],
  #santibot-modal.show,
  #santibot-modal.visible {
    display: flex !important;
  }

  /* Ensure modal can be hidden */
  #santibot-modal[style*="display: none"],
  #santibot-modal.hide,
  #santibot-modal.hidden {
    display: none !important;
  }

  /* SantiBot modal header */
  #santibot-modal .modal-header,
  #santibot-modal > div:first-child {
    background: linear-gradient(135deg, #8B5CF6, #A855F7) !important;
    padding: 12px 16px !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    border-radius: 16px 16px 0 0 !important;
    flex-shrink: 0 !important;
    min-height: 50px !important;
  }

  /* Avatar in header */
  #santibot-modal .modal-header img,
  #santibot-modal > div:first-child img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255,255,255,0.3) !important;
  }

  /* Chat messages container */
  #santibot-modal .chat-messages,
  #santibot-modal .messages-area,
  #santibot-modal > div:nth-child(2) {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px !important;
    background: rgba(15, 23, 42, 0.98) !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  /* Bot message styling */
  #santibot-modal .bot-message,
  #santibot-modal .message {
    background: rgba(139, 92, 246, 0.2) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    border-radius: 12px !important;
    padding: 2px !important;
    margin-bottom: 12px !important;
    color: white !important;
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
  }

  /* Options container - Padding muy reducido para máximo espacio */
  #santibot-modal .chat-options,
  #santibot-modal .options-container,
  #santibot-modal > div:nth-child(3) {
    padding: 6px 16px 4px 16px !important; /* Reducido de 8px a 6px top, 6px a 4px bottom */
    background: rgba(15, 23, 42, 0.98) !important;
    border-top: 1px solid rgba(255,255,255,0.1) !important;
    flex-shrink: 0 !important;
  }

  /* Grid for question buttons - Una columna compacta para mejor UX móvil */
  #santibot-modal .options-grid,
  #santibot-modal .chat-options > div,
  .santibot-pred-btns,
  #santibot-modal .santibot-pred-btns {
    display: grid !important;
    grid-template-columns: 1fr !important; /* Cambiado de 2 columnas a 1 columna */
    grid-template-rows: repeat(6, auto) !important; /* Cambiado de 3 a 6 filas */
    gap: 4px !important; /* Reducido de 6px a 4px para menos espacio vertical */
    margin-bottom: 6px !important; /* Reducido de 8px a 6px */
  }

  /* Asegurar que no haya columnas en móvil */
  .santibot-pred-column {
    display: contents !important; /* Hace que los hijos se comporten como si fueran hijos directos del grid */
  }

  /* Question buttons - Layout compacto para una columna */
  #santibot-modal .chat-option,
  #santibot-modal .options-grid button,
  #santibot-modal .chat-options button:not(.send-btn):not([type="submit"]),
  .santibot-pred-btn {
    padding: 4px 16px !important; /* Reducido padding vertical de 6px a 4px */
    border-radius: 8px !important;
    background: linear-gradient(135deg, #8B5CF6, #A855F7) !important;
    border: none !important;
    color: white !important;
    font-size: 0.7rem !important; /* Reducido font-size para menos altura */
    font-weight: 500 !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3) !important;
    min-height: 28px !important; /* Reducido de 36px a 28px */
    max-height: 32px !important; /* Reducido de 42px a 32px */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    line-height: 1.1 !important; /* Reducido line-height */
    word-wrap: break-word !important;
    overflow: hidden !important;
  }

  #santibot-modal .chat-option:hover,
  #santibot-modal .options-grid button:hover,
  #santibot-modal .chat-options button:not(.send-btn):not([type="submit"]):hover,
  .santibot-pred-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 8px rgba(139, 92, 246, 0.4) !important;
    background: linear-gradient(135deg, #7C3AED, #9333EA) !important;
  }

  /* Input area */
  #santibot-modal .input-container,
  #santibot-modal .chat-input-area {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-end !important;
    margin-top: 8px !important;
  }

  #santibot-modal .chat-input,
  #santibot-modal input[type="text"],
  #santibot-modal textarea,
  #santibot-modal .santibot-input,
  #santibot-modal #santibot-input {
    flex: 1 !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    background: rgba(255,255,255,0.1) !important;
    color: white !important;
    font-size: 0.8rem !important;
    resize: none !important;
    max-height: 60px !important;
    min-height: 36px !important;
    font-family: inherit !important;
    outline: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    user-select: text !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    z-index: auto !important;
    position: relative !important;
  }

  #santibot-modal .chat-input:focus,
  #santibot-modal input[type="text"]:focus,
  #santibot-modal textarea:focus,
  #santibot-modal .santibot-input:focus,
  #santibot-modal #santibot-input:focus {
    border: 1px solid rgba(139, 92, 246, 0.5) !important;
    background: rgba(255,255,255,0.15) !important;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2) !important;
  }

  #santibot-modal .chat-input::placeholder,
  #santibot-modal input[type="text"]::placeholder,
  #santibot-modal textarea::placeholder,
  #santibot-modal .santibot-input::placeholder,
  #santibot-modal #santibot-input::placeholder {
    color: rgba(255,255,255,0.6) !important;
  }

  #santibot-modal .send-btn,
  #santibot-modal button[type="submit"] {
    padding: 8px 16px !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #10B981, #059669) !important;
    border: none !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    min-height: 36px !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
  }

  #santibot-modal .send-btn:hover,
  #santibot-modal button[type="submit"]:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-1px) !important;
  }

  /* Close button - mejorado para funcionalidad */
  #santibot-modal .close-btn,
  #santibot-modal [data-close="modal"],
  #santibot-modal .modal-close,
  #santibot-modal button[onclick*="closeModal"],
  #santibot-modal .close {
    position: absolute !important;
    top: 12px !important;
    right: 16px !important;
    background: rgba(255,255,255,0.2) !important;
    border: none !important;
    color: white !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    z-index: 10000 !important;
    font-size: 16px !important;
    font-weight: bold !important;
    user-select: none !important;
    pointer-events: auto !important;
  }

  #santibot-modal .close-btn:hover,
  #santibot-modal [data-close="modal"]:hover,
  #santibot-modal .modal-close:hover,
  #santibot-modal button[onclick*="closeModal"]:hover,
  #santibot-modal .close:hover {
    background: rgba(255,255,255,0.3) !important;
    transform: scale(1.1) !important;
  }

  /* Asegurar que el contenido del modal esté completamente interactivo */
  #santibot-modal,
  #santibot-modal * {
    pointer-events: auto !important;
  }

  /* Específicamente para el área de input */
  #santibot-modal .santibot-input-area,
  #santibot-modal .santibot-input-row,
  #santibot-modal .input-container,
  #santibot-modal .chat-input-area {
    pointer-events: auto !important;
    z-index: auto !important;
    position: relative !important;
  }

  /* Asegurar que los inputs sean completamente funcionales */
  #santibot-modal input,
  #santibot-modal textarea,
  #santibot-modal .santibot-input,
  #santibot-modal #santibot-input {
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    touch-action: manipulation !important;
    -webkit-touch-callout: default !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
  }

  /* Modal backdrop - alternativa más limpia */
  body.modal-open::before {
    content: '' !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.5) !important;
    z-index: 9997 !important;
  }

  /* Enhanced footer */
  .footer {
    font-size: 0.65rem;
    padding: 10px 6px;
    text-align: center;
    line-height: 1.2;
    margin-top: 14px;
  }

  /* Enhanced filtered projects */
  #filtered-projects-card {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    margin: 16px 8px !important;
    padding: 20px 16px !important;
    border-radius: 14px !important;
    backdrop-filter: blur(12px) !important;
  }

  #filtered-projects-card h2 {
    font-size: 1.2rem !important;
    margin-bottom: 16px !important;
    text-align: center !important;
  }

  .filtered-columns-wrapper {
    flex-direction: column !important;
    gap: 16px !important;
    padding: 12px 0 !important;
  }

  .filtered-column {
    gap: 16px !important;
  }

  #filtered-projects-card .client-project-card {
    width: 100% !important;
    min-width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  #clear-tech-filter {
    margin-top: 16px !important;
    padding: 10px 20px !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
    backdrop-filter: blur(8px) !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
  }

  #clear-tech-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }

  /* Enhanced grades display */
  .average-card {
    margin-bottom: 16px !important;
    padding: 16px 12px !important;
    border-radius: 10px !important;
    backdrop-filter: blur(8px) !important;
  }

  .average-value {
    font-size: 1.6rem !important;
  }

  .grades-list {
    gap: 10px !important;
  }

  .grade-item {
    padding: 12px !important;
    border-radius: 8px !important;
    backdrop-filter: blur(6px) !important;
  }

  /* Enhanced interactions and accessibility */
  button, .section-card, .client-project-card, .tech-icon, a {
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* Improved scrolling */
  .section-content {
    -webkit-overflow-scrolling: touch;
  }

  /* Hide desktop-only elements */
  .desktop-only {
    display: none !important;
  }

  /* Prevent horizontal overflow */
  * {
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Enhanced focus states for accessibility */
  button:focus, a:focus, .tech-icon:focus {
    outline: 2px solid #8B5CF6;
    outline-offset: 2px;
  }
}

/* Ultra-small devices optimizations */
@media (max-width: 480px) {
/* Ultra-small devices optimizations */
@media (max-width: 480px) {
  .header {
    margin-top: 45px !important; /* More space for small screens */
  }

  #cv-dropdown-container {
    right: 6px !important;
    top: 6px !important;
  }

  #language-dropdown-container {
    left: 6px !important;
    top: 6px !important;
  }

  #download-cv-btn {
    min-width: 80px !important;
    max-width: 95px !important;
    height: 30px !important;
    font-size: 0.6rem !important;
  }

  #download-cv-btn::after {
    font-size: 0.6rem !important;
  }

  #language-btn {
    padding: 5px 7px !important;
    font-size: 0.65rem !important;
    min-width: 75px !important;
    max-width: 90px !important;
    height: 30px !important;
  }

  #download-cv-btn svg {
    width: 10px !important;
    height: 10px !important;
  }

  #cv-dropdown, #language-dropdown {
    top: 35px !important;
    min-width: 80px !important;
  }

  #santibot-cta-text {
    bottom: 65px !important;
    right: 8px !important;
    max-width: 120px !important;
    font-size: 0.7rem !important;
    padding: 6px 8px !important;
  }

  .header-text h1 {
    font-size: 1.4rem !important;
  }
  
  .section-title {
    font-size: 1rem !important;
  }
  
  .section-content {
    font-size: 0.85rem !important;
  }
  
  .client-project-card {
    font-size: 0.85rem !important;
    padding: 12px 10px !important;
  }
  
  .tech-icon {
    width: 26px !important;
    height: 26px !important;
    margin: 0 4px 6px 0 !important;
  }

  #santibot-container {
    bottom: 12px !important;
    right: 12px !important;
    width: 50px !important;
    height: 50px !important;
  }

  #santibot-button {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.4rem !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Ensure button image fits properly on small devices */
  #santibot-button img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
  }

  /* SantiBot modal optimizations for ultra-small devices */
  #santibot-modal {
    width: calc(100vw - 12px) !important;
    height: 90vh !important;
    left: 6px !important;
    bottom: 55px !important;
    z-index: 9999 !important;
  }

  /* Ensure modal visibility control works on small devices too */
  #santibot-modal[style*="display: block"],
  #santibot-modal.show,
  #santibot-modal.visible {
    display: flex !important;
  }

  #santibot-modal[style*="display: none"],
  #santibot-modal.hide,
  #santibot-modal.hidden {
    display: none !important;
  }

  #santibot-modal .modal-header,
  #santibot-modal > div:first-child {
    padding: 10px 12px !important;
    font-size: 0.85rem !important;
    min-height: 45px !important;
  }

  #santibot-modal .modal-header img,
  #santibot-modal > div:first-child img {
    width: 28px !important;
    height: 28px !important;
  }

  #santibot-modal .chat-messages,
  #santibot-modal .messages-area,
  #santibot-modal > div:nth-child(2) {
    padding: 12px !important;
  }

  #santibot-modal .bot-message,
  #santibot-modal .message {
    padding: 10px !important;
    font-size: 0.8rem !important;
    margin-bottom: 10px !important;
  }

  #santibot-modal .chat-options,
  #santibot-modal .options-container,
  #santibot-modal > div:nth-child(3) {
    padding: 8px 10px 6px 10px !important;
  }

  #santibot-modal .options-grid,
  #santibot-modal .chat-options > div {
    gap: 6px !important;
    margin-bottom: 8px !important;
  }

  #santibot-modal .chat-option,
  #santibot-modal .options-grid button:not(.send-btn):not([type="submit"]),
  .santibot-pred-btn {
    padding: 6px 8px !important;
    font-size: 0.65rem !important;
    min-height: 32px !important;
    max-height: 38px !important;
    border-radius: 6px !important;
  }

  #santibot-modal .input-container,
  #santibot-modal .chat-input-area {
    gap: 6px !important;
    margin-top: 6px !important;
  }

  #santibot-modal .chat-input,
  #santibot-modal input[type="text"],
  #santibot-modal textarea,
  #santibot-modal .santibot-input,
  #santibot-modal #santibot-input {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
    min-height: 32px !important;
    max-height: 50px !important;
  }

  #santibot-modal .send-btn,
  #santibot-modal button[type="submit"] {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    min-height: 32px !important;
  }

  #santibot-modal .close-btn,
  #santibot-modal [data-close="modal"] {
    top: 10px !important;
    right: 12px !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    z-index: 10000 !important;
  }

  #santibot-cta-text {
    bottom: 65px !important;
    right: 60px !important;
    max-width: 140px !important;
    font-size: 0.7rem !important;
    padding: 6px 10px !important;
  }

  .vimeo-embed,
  iframe[src*="vimeo"],
  iframe[src*="youtube"] {
    max-height: 140px !important; /* 30% reducido: 200px * 0.7 = 140px */
  }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .header {
    flex-direction: row !important;
    gap: 24px !important;
    text-align: left !important;
  }

  .main-image {
    width: 80px !important;
    height: 80px !important;
  }

  .header-text {
    text-align: left !important;
  }

  .header-text h1 {
    font-size: 1.3rem !important;
  }

  .header + div {
    justify-content: flex-start !important;
  }
}

/* REGLA DE MÁXIMA PRIORIDAD PARA FORZAR UNA COLUMNA EN MÓVIL */
@media (max-width: 768px) {
  .santibot-pred-btns,
  #santibot-modal .santibot-pred-btns,
  body .santibot-pred-btns {
    grid-template-columns: 1fr !important;
    grid-template-rows: repeat(6, minmax(36px, auto)) !important;
  }
  
  .santibot-pred-column,
  #santibot-modal .santibot-pred-column {
    display: contents !important;
  }
}
