/* Custom styles for the portfolio */

/* Google Fonts */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #3b82f6, #6366f1);
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #2563eb, #4f46e5);
}

/* Section spacing */
section {
    scroll-margin-top: 100px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.animate-fade-in-up-delay {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Skill bars animation */
.skill-bar {
    width: 0;
    transition: width 1.5s ease-out;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.skill-bar.animate {
    width: var(--width);
}

/* Skills Filter Menu */
.skills-filter-menu {
    position: relative;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.skill-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(229, 231, 235, 0.8);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.skill-filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%);
    transition: left 0.5s ease;
}

.skill-filter-btn:hover::before {
    left: 100%;
}

.skill-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.skill-filter-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
    color: white;
    border-color: transparent;
    box-shadow: 
        0 4px 12px rgba(59, 130, 246, 0.3),
        0 2px 4px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.skill-filter-btn.active::before {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%);
}

.skill-filter-btn.active:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 6px 16px rgba(59, 130, 246, 0.4),
        0 4px 8px rgba(59, 130, 246, 0.3);
}

.skill-filter-btn i {
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

.skill-filter-btn:hover i {
    transform: scale(1.1);
}

.skill-filter-btn.active i {
    transform: scale(1.1);
}

/* Skill badge filter states */
.premium-skill-badge.hidden {
    display: none;
}

.premium-skill-badge.filtering {
    animation: fadeOutScale 0.3s ease-out forwards;
}

.premium-skill-badge.filtering-in {
    animation: fadeInScale 0.4s ease-out forwards;
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Premium Skills Section Styles - Rediseño Compacto y Visual */
.premium-skill-badge {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    backdrop-filter: blur(10px);
    border-radius: 1.25rem;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -1px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

.premium-skill-badge.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.premium-skill-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.05) 0%, 
        rgba(99, 102, 241, 0.05) 50%,
        rgba(139, 92, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.premium-skill-badge:hover::before {
    opacity: 1;
}

.premium-skill-badge:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 0 rgba(255, 255, 255, 1);
    border-color: rgba(59, 130, 246, 0.3);
}

.skill-icon-wrapper {
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    z-index: 1;
}

.skill-icon-bg {
    position: absolute;
    inset: -8px;
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.1) 0%, 
        rgba(99, 102, 241, 0.1) 50%,
        rgba(139, 92, 246, 0.1) 100%);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-skill-badge:hover .skill-icon-bg {
    opacity: 1;
    transform: scale(1);
}

.premium-skill-badge:hover .skill-icon-wrapper i {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.skill-icon-wrapper i {
    position: relative;
    z-index: 2;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 0.025em;
    transition: color 0.3s ease;
}

.premium-skill-badge:hover .skill-name {
    color: #3b82f6;
}

/* Skill Level Container */
.skill-level-container {
    width: 100%;
    margin-top: 0.5rem;
}

.skill-level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.skill-level-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.skill-level-percentage {
    font-size: 0.75rem;
    font-weight: 700;
    color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.skill-level-indicator {
    width: 100%;
    height: 8px;
    background: rgba(229, 231, 235, 0.8);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.skill-level-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        #3b82f6 0%, 
        #6366f1 50%,
        #8b5cf6 100%);
    border-radius: 9999px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 0;
    box-shadow: 
        0 0 10px rgba(59, 130, 246, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.premium-skill-badge.revealed .skill-level-bar {
    width: var(--skill-width, 0%);
}

.skill-level-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.5) 50%,
        transparent 100%);
    animation: shimmer-skill 2s infinite;
}

.premium-skill-badge:hover .skill-level-bar {
    box-shadow: 
        0 0 15px rgba(59, 130, 246, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

@keyframes shimmer-skill {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Legacy support for old skill cards */
.skill-card {
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-card:hover {
    transform: translateY(-8px);
}

.skill-item {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.4s ease-out;
}

.skill-card.active .skill-item {
    opacity: 1;
    transform: translateX(0);
}

.skill-card.active .skill-item:nth-child(1) { transition-delay: 0.1s; }
.skill-card.active .skill-item:nth-child(2) { transition-delay: 0.2s; }
.skill-card.active .skill-item:nth-child(3) { transition-delay: 0.3s; }
.skill-card.active .skill-item:nth-child(4) { transition-delay: 0.4s; }
.skill-card.active .skill-item:nth-child(5) { transition-delay: 0.5s; }
.skill-card.active .skill-item:nth-child(6) { transition-delay: 0.6s; }
.skill-card.active .skill-item:nth-child(7) { transition-delay: 0.7s; }

/* Modern Progress Bars */
.skill-bar-progress {
    width: 0;
    transition: width 1.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.skill-bar-progress.animate {
    width: var(--progress-width);
}

/* Shimmer animation */
@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(0);
    }
    100% {
        transform: translateX(100%) translateY(0);
    }
}

.animate-shimmer {
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

/* Tool badges hover effect */
.tool-badge {
    position: relative;
    overflow: hidden;
}

.tool-badge::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.tool-badge:hover::before {
    width: 300px;
    height: 300px;
}

/* Reveal animation improvements */
.reveal {
    opacity: 0;
    transform: translateY(60px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation for skill cards */
.skill-card.reveal:nth-child(1) { transition-delay: 0.1s; }
.skill-card.reveal:nth-child(2) { transition-delay: 0.2s; }
.skill-card.reveal:nth-child(3) { transition-delay: 0.3s; }
.skill-card.reveal:nth-child(4) { transition-delay: 0.4s; }

/* Experiencias adicionales animation */
#experiencias-adicionales {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: opacity 0.5s ease-out, max-height 0.5s ease-out;
}

#experiencias-adicionales:not(.hidden) {
    max-height: 5000px;
}

.experiencia-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.experiencia-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Timeline line animation */
#timeline-line {
    transition: height 0.8s ease-out;
    height: auto;
}

/* Navbar scroll effect */
nav.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Hover effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #3b82f6, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glassmorphism effect */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Timeline adjustments for mobile */
@media (max-width: 768px) {
    .timeline-item {
        padding-left: 3rem;
    }
    
    section {
        scroll-margin-top: 80px;
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    /* Skills section mobile optimizations */
    .skill-card {
        margin-bottom: 1rem;
    }

    .premium-skill-badge {
        padding: 0.875rem 0.5rem;
    }

    .skill-icon-wrapper {
        width: 3rem;
        height: 3rem;
    }

    .skill-icon-wrapper i {
        font-size: 1.5rem !important;
    }

    .skill-name {
        font-size: 0.7rem;
        margin-bottom: 0.375rem;
    }

    .skill-level-indicator {
        height: 6px;
    }

    .skill-level-header {
        margin-bottom: 0.25rem;
    }

    .skill-level-label {
        font-size: 0.6rem;
    }

    .skill-level-percentage {
        font-size: 0.7rem;
    }

    /* Skills filter menu mobile */
    .skill-filter-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
    }

    .skill-filter-btn i {
        font-size: 0.75rem;
        margin-right: 0.375rem;
    }

    .reveal {
        transform: translateY(30px);
    }
}

/* Mobile Optimizations - General */
@media (max-width: 640px) {
    /* Reduce section padding */
    section {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    /* Optimize headings */
    h1 {
        font-size: 1.875rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
        line-height: 1.4 !important;
    }
    
    /* Better button sizing */
    button, a.btn, a[class*="px-"][class*="py-"] {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Improve card spacing */
    .card, [class*="rounded-"], [class*="shadow"] {
        margin-bottom: 1rem;
    }
    
    /* Optimize text sizes */
    p {
        font-size: 0.9375rem;
        line-height: 1.6;
    }
    
    /* Better container padding */
    .container, [class*="max-w-"] {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Profile image size */
    #profile-placeholder, #profile-image {
        width: 160px !important;
        height: 160px !important;
    }
    
    /* Navigation improvements */
    nav {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Hero section adjustments */
    #inicio {
        padding-top: 6rem !important;
        padding-bottom: 3rem !important;
        min-height: auto !important;
    }
    
    /* Hide decorative elements on very small screens */
    [class*="absolute"][class*="blur"] {
        opacity: 0.1 !important;
    }
    
    /* Better form inputs */
    input, textarea, select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem !important;
    }
    
    /* Improve mobile menu */
    #mobile-menu {
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Timeline mobile adjustments */
    .timeline-item {
        padding-left: 2.5rem !important;
    }
    
    /* Project cards mobile */
    [class*="group"][class*="bg-white"][class*="rounded"] {
        margin-bottom: 1.5rem;
    }
    
    /* Skills grid mobile */
    .skills-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
}

/* Very small screens (320px - 375px) */
@media (max-width: 375px) {
    /* Further reduce sizes */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    #profile-placeholder, #profile-image {
        width: 140px !important;
        height: 140px !important;
    }
    
    .premium-skill-badge {
        padding: 0.75rem 0.5rem !important;
    }
    
    .skill-icon-wrapper {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
    
    button, a.btn {
        padding: 0.625rem 1.25rem !important;
        font-size: 0.8125rem !important;
    }
}

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
    nav {
        height: auto;
        min-height: 64px;
    }
    
    #mobile-menu-btn {
        padding: 0.5rem;
        border-radius: 0.5rem;
        transition: background-color 0.2s;
    }
    
    #mobile-menu-btn:active {
        background-color: rgba(59, 130, 246, 0.1);
    }
    
    #mobile-menu {
        animation: slideDown 0.3s ease-out;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #mobile-menu a {
        transition: all 0.2s ease;
    }
    
    #mobile-menu a:active {
        background-color: rgba(59, 130, 246, 0.15);
        transform: scale(0.98);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Touch improvements for mobile */
@media (max-width: 768px) {
    /* Larger tap targets */
    button, a, input[type="submit"], .premium-skill-badge {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Prevent text size adjustment on iOS */
    input, textarea, select {
        font-size: 16px !important;
    }
    
    /* Better scroll behavior */
    * {
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
    }
    
    /* Improve button spacing */
    .flex.flex-col.gap-3 > *,
    .flex.flex-col.gap-4 > * {
        margin-bottom: 0.5rem;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    #inicio {
        min-height: auto !important;
        padding-top: 5rem !important;
        padding-bottom: 2rem !important;
    }
}

/* Print styles */
@media print {
    nav,
    footer,
    #contacto {
        display: none;
    }
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth transitions */
* {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Profile placeholder animation */
#profile-placeholder {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    will-change: opacity;
}

#profile-image {
    will-change: opacity, transform;
}

/* Loading state */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Optimize image loading */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

