/* ===================================
   Technical Skills No Cut Fix
   Arregla la sección Technical Skills para que no se corte en móvil
   =================================== */

/* ===== TECHNICAL SKILLS SECTION - NO CUT FIX ===== */
@media (max-width: 768px) {
    /* Contenedor principal de Technical Skills */
    #technical-skills,
    .technical-skills,
    .skills-section,
    .cv-skills {
        padding: 60px 15px !important;
        margin: 0 !important;
        width: 100% !important;
        overflow: visible !important;
        box-sizing: border-box !important;
        min-height: auto !important;
        background: rgba(0, 0, 0, 0.3) !important;
        border-radius: 0 !important; /* Sin border radius para evitar cortes */
    }

    /* Header de Technical Skills */
    .technical-skills-header,
    .skills-header {
        margin-bottom: 30px !important;
        padding: 0 10px !important;
        width: 100% !important;
        text-align: center !important;
    }

    /* Título principal */
    .technical-skills h2,
    .skills-section h2,
    h2:has(+ .technical-skills),
    .section-title:has(+ .skills-logos) {
        font-size: clamp(1.8rem, 6vw, 2.2rem) !important;
        line-height: 1.3 !important;
        margin: 0 0 25px 0 !important;
        padding: 0 10px !important;
        text-align: center !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        width: 100% !important;
        background: linear-gradient(135deg, #8b5cf6, #a78bfa) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
    }

    /* Subtítulos de categorías */
    .technical-skills h3,
    .skills-category-title,
    .skill-category h3 {
        font-size: clamp(1.2rem, 4.5vw, 1.4rem) !important;
        line-height: 1.4 !important;
        margin: 30px 0 20px 0 !important;
        padding: 0 10px 10px 10px !important;
        text-align: center !important;
        color: var(--accent) !important;
        border-bottom: 2px solid rgba(139, 92, 246, 0.3) !important;
        width: 100% !important;
        font-weight: 600 !important;
    }

    /* Contenedor de categorías */
    .skills-categories,
    .cv-skills-content {
        width: 100% !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    /* Cada categoría de skills */
    .skill-category,
    .skills-group {
        margin-bottom: 40px !important;
        padding: 20px 10px !important;
        background: rgba(139, 92, 246, 0.03) !important;
        border-radius: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    /* Grid de logos/iconos */
    .skills-logos,
    .tech-logos-grid,
    .skill-items {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
        padding: 10px 5px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        overflow: visible !important;
        justify-items: center !important;
        align-items: start !important;
    }

    /* Items individuales de skills */
    .skill-logo,
    .tech-logo-item,
    .skill-item {
        width: 100% !important;
        max-width: 100px !important;
        min-height: 90px !important;
        padding: 12px 8px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(139, 92, 246, 0.05) !important;
        border: 1px solid rgba(139, 92, 246, 0.2) !important;
        border-radius: 10px !important;
        transition: all 0.3s ease !important;
        overflow: visible !important;
        position: relative !important;
        box-sizing: border-box !important;
    }

    /* Iconos/Imágenes */
    .skill-logo img,
    .skill-icon,
    .tech-icon {
        width: 35px !important;
        height: 35px !important;
        object-fit: contain !important;
        margin-bottom: 8px !important;
        display: block !important;
        flex-shrink: 0 !important;
    }

    /* Texto/Labels de skills */
    .skill-logo span,
    .skill-name,
    .tech-name {
        font-size: clamp(0.65rem, 2.5vw, 0.75rem) !important;
        line-height: 1.2 !important;
        text-align: center !important;
        color: var(--text-secondary) !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        width: 100% !important;
        padding: 0 2px !important;
        margin: 0 !important;
        display: block !important;
    }

    /* Para grids con muchos items */
    .skills-logos.many-items {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 12px !important;
    }

    .skills-logos.many-items .skill-logo {
        max-width: 80px !important;
        min-height: 80px !important;
        padding: 10px 5px !important;
    }

    .skills-logos.many-items .skill-logo img {
        width: 30px !important;
        height: 30px !important;
    }

    .skills-logos.many-items .skill-logo span {
        font-size: 0.6rem !important;
    }

    /* Progress bars si existen */
    .skill-progress-container {
        width: 100% !important;
        padding: 15px !important;
        margin-bottom: 15px !important;
    }

    .skill-progress-item {
        margin-bottom: 20px !important;
        width: 100% !important;
    }

    .skill-progress-header {
        display: flex !important;
        justify-content: space-between !important;
        margin-bottom: 8px !important;
        padding: 0 5px !important;
    }

    .skill-progress-name {
        font-size: 0.9rem !important;
        color: var(--text-primary) !important;
    }

    .skill-progress-percentage {
        font-size: 0.85rem !important;
        color: var(--accent) !important;
        font-weight: 600 !important;
    }

    .skill-progress-bar {
        width: 100% !important;
        height: 8px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 10px !important;
        overflow: hidden !important;
    }

    .skill-progress-fill {
        height: 100% !important;
        background: linear-gradient(90deg, var(--accent), #a78bfa) !important;
        border-radius: 10px !important;
        transition: width 1s ease !important;
    }

    /* Tags de skills */
    .skills-tags,
    .tech-tags {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
        padding: 15px 10px !important;
        width: 100% !important;
    }

    .skill-tag,
    .tech-tag {
        padding: 6px 12px !important;
        background: rgba(139, 92, 246, 0.1) !important;
        border: 1px solid rgba(139, 92, 246, 0.3) !important;
        border-radius: 20px !important;
        font-size: clamp(0.7rem, 2.5vw, 0.8rem) !important;
        color: var(--text-primary) !important;
        white-space: nowrap !important;
    }

    /* Descripción de skills si existe */
    .skills-description,
    .technical-skills-intro {
        font-size: clamp(0.9rem, 3.5vw, 1rem) !important;
        line-height: 1.6 !important;
        padding: 15px !important;
        margin-bottom: 30px !important;
        background: rgba(139, 92, 246, 0.05) !important;
        border-radius: 10px !important;
        border-left: 3px solid var(--accent) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Espacio adicional para navegación fija */
    .technical-skills:first-child,
    #technical-skills:first-child {
        padding-top: 80px !important;
    }
}

/* ===== PANTALLAS MUY PEQUEÑAS (<375px) ===== */
@media (max-width: 375px) {
    /* Grid más compacto */
    .skills-logos,
    .tech-logos-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        padding: 8px !important;
    }

    /* Items más pequeños */
    .skill-logo,
    .skill-item {
        max-width: 90px !important;
        min-height: 85px !important;
        padding: 10px 6px !important;
    }

    /* Iconos más pequeños */
    .skill-logo img {
        width: 30px !important;
        height: 30px !important;
        margin-bottom: 6px !important;
    }

    /* Texto más pequeño */
    .skill-logo span {
        font-size: 0.6rem !important;
    }

    /* Títulos ajustados */
    .technical-skills h2 {
        font-size: 1.6rem !important;
    }

    .technical-skills h3 {
        font-size: 1.1rem !important;
    }

    /* Tags más pequeños */
    .skill-tag {
        padding: 5px 10px !important;
        font-size: 0.65rem !important;
    }
}

/* ===== PANTALLAS MUY PEQUEÑAS (<360px) ===== */
@media (max-width: 360px) {
    /* Opción: 2 columnas para pantallas muy pequeñas */
    .skills-logos.very-small {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .skills-logos.very-small .skill-logo {
        max-width: 130px !important;
        min-height: 100px !important;
    }
}

/* ===== LANDSCAPE MÓVIL ===== */
@media (max-width: 812px) and (orientation: landscape) {
    /* Sección con menos padding vertical */
    .technical-skills {
        padding: 40px 30px !important;
    }

    /* Grid de 4-5 columnas en landscape */
    .skills-logos {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 15px !important;
        max-width: 700px !important;
        margin: 0 auto !important;
    }

    /* Items más compactos */
    .skill-logo {
        max-width: 100px !important;
        min-height: 75px !important;
        padding: 10px 6px !important;
    }

    /* Iconos pequeños */
    .skill-logo img {
        width: 28px !important;
        height: 28px !important;
    }

    /* Texto pequeño */
    .skill-logo span {
        font-size: 0.6rem !important;
    }

    /* Títulos más pequeños */
    .technical-skills h2 {
        font-size: 1.8rem !important;
        margin-bottom: 20px !important;
    }

    .technical-skills h3 {
        font-size: 1.2rem !important;
        margin: 20px 0 15px 0 !important;
    }
}

/* ===== SAFE AREAS iOS ===== */
@supports (padding: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .technical-skills {
            padding-left: calc(15px + env(safe-area-inset-left)) !important;
            padding-right: calc(15px + env(safe-area-inset-right)) !important;
        }

        .technical-skills:last-child {
            padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
        }
    }
}

/* ===== PREVENCIÓN DE OVERFLOW ===== */
@media (max-width: 768px) {
    /* Asegurar que nada sobresalga */
    .technical-skills * {
        max-width: 100% !important;
    }

    /* Sin elementos flotantes que causen overflow */
    .skill-logo::before,
    .skill-logo::after {
        display: none !important;
    }

    /* Sin sombras excesivas que causen overflow */
    .skill-logo:hover,
    .skill-item:hover {
        box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3) !important;
        transform: translateY(-2px) !important;
    }
}

/* ===== THEME ADJUSTMENTS ===== */
@media (max-width: 768px) {
    /* Light theme */
    [data-theme="light"] .technical-skills {
        background: rgba(255, 255, 255, 0.5) !important;
    }

    [data-theme="light"] .skill-category {
        background: rgba(139, 92, 246, 0.03) !important;
    }

    [data-theme="light"] .skill-logo {
        background: rgba(139, 92, 246, 0.05) !important;
        border-color: rgba(139, 92, 246, 0.3) !important;
    }

    [data-theme="light"] .skill-logo span {
        color: #4a4a5e !important;
    }

    [data-theme="light"] .skill-tag {
        background: rgba(139, 92, 246, 0.08) !important;
        color: #4a4a5e !important;
    }
}

/* ===== ANIMACIONES MÓVIL ===== */
@media (max-width: 768px) {
    /* Entrada suave */
    @keyframes fadeInScale {
        from {
            opacity: 0;
            transform: scale(0.95);
        }
        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    .skill-logo {
        animation: fadeInScale 0.4s ease !important;
        animation-fill-mode: both !important;
    }

    /* Delay escalonado para cada item */
    .skill-logo:nth-child(1) { animation-delay: 0.05s !important; }
    .skill-logo:nth-child(2) { animation-delay: 0.1s !important; }
    .skill-logo:nth-child(3) { animation-delay: 0.15s !important; }
    .skill-logo:nth-child(4) { animation-delay: 0.2s !important; }
    .skill-logo:nth-child(5) { animation-delay: 0.25s !important; }
    .skill-logo:nth-child(6) { animation-delay: 0.3s !important; }
    .skill-logo:nth-child(7) { animation-delay: 0.35s !important; }
    .skill-logo:nth-child(8) { animation-delay: 0.4s !important; }
    .skill-logo:nth-child(9) { animation-delay: 0.45s !important; }
    .skill-logo:nth-child(10) { animation-delay: 0.5s !important; }
    .skill-logo:nth-child(11) { animation-delay: 0.55s !important; }
    .skill-logo:nth-child(12) { animation-delay: 0.6s !important; }

    /* Tap effect */
    .skill-logo:active {
        transform: scale(0.95) !important;
        background: rgba(139, 92, 246, 0.15) !important;
    }
}

/* ===== DEBUG MODE ===== */
/*
@media (max-width: 768px) {
    .technical-skills {
        border: 3px solid red !important;
    }

    .skills-logos {
        border: 3px solid blue !important;
    }

    .skill-logo {
        border: 3px solid green !important;
    }
}
*/