:root {
    --color-bg: #ffffff;
    --color-bg-alt: #f8f9fa;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-secondary: #64748b;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    --color-accent: #10b981;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
    --border-radius: 8px;
}

/* Dark theme variables */
[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-bg-alt: #1e293b;
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-secondary: #94a3b8;
    --color-text: #f1f5f9;
    --color-text-light: #cbd5e1;
    --color-border: #334155;
    --color-accent: #10b981;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Auto theme detection */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #0f172a;
        --color-bg-alt: #1e293b;
        --color-primary: #3b82f6;
        --color-primary-dark: #2563eb;
        --color-secondary: #94a3b8;
        --color-text: #f1f5f9;
        --color-text-light: #cbd5e1;
        --color-border: #334155;
        --color-accent: #10b981;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    }
}

/* Theme switcher styles */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 25px;
    padding: 8px 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 1002;
    /* Asegurar que esté por encima de otros elementos */
}

.theme-switcher:hover {
    box-shadow: var(--shadow-lg);
}

.theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    background: transparent;
}

.theme-option:hover {
    background: var(--color-bg-alt);
}

.theme-option.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.theme-option svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Smooth transition for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

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

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0 auto;
    /* Centrar el menú */
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.nav-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--color-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.active {
    color: var(--color-primary);
}

.nav-link.active::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 1003;
    /* Por encima del theme-switcher para que sea clickeable */
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--color-text);
    margin: 3px 0;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
    padding-top: 80px;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.hero-content h2 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-weight: 400;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--color-text-light);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
    background-color: var(--color-primary);
    color: white;
    cursor: pointer;
    position: relative;
    z-index: 10; /* Asegurar que esté por encima de pseudo-elementos */
}

.button:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.button.primary {
    background-color: var(--color-primary);
    color: white;
}

.button.primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.button.secondary {
    background-color: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.button.secondary:hover {
    background-color: var(--color-primary);
    color: white;
    transform: translateY(-2px);
}

.button.small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Sections */
section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--color-text);
}

/* About Section */
.about {
    background-color: var(--color-bg-alt);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text p {
    font-size: 1.1rem;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.skill-category {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.skill-category:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.skill-category h3 {
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    padding: 0.5rem 0;
    color: var(--color-text-light);
    border-bottom: 1px solid var(--color-border);
}

.skill-category li:last-child {
    border-bottom: none;
}

/* Projects Section */
.projects {
    background-color: var(--color-bg-alt);
}

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

.project-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.1));
    opacity: 0;
    transition: var(--transition);
    border-radius: var(--border-radius);
    pointer-events: none; /* Permitir que los clicks pasen a través */
}

.project-card {
    position: relative;
    overflow: hidden;
}

.project-card:hover::before {
    opacity: 1;
}

.project-image {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.project-image:hover img {
    transform: scale(1.05);
}

.project-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.project-content {
    padding: 1.5rem;
}

.project-content h3 {
    color: var(--color-text);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.project-content p {
    color: var(--color-text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tech-tag {
    background-color: var(--color-bg-alt);
    color: var(--color-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.project-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Contact Section */
.contact-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-content p {
    font-size: 1.2rem;
    color: var(--color-text-light);
    margin-bottom: 2rem;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.contact-item {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.contact-item h4 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.contact-item p {
    color: var(--color-text-light);
    margin: 0;
}

.contact-item a {
    color: var(--color-primary);
    text-decoration: none;
}

.contact-item a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background-color: var(--color-text);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

/* Enhanced animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-scroll {
    animation: fadeInUp 0.6s ease forwards;
}

/* Enhanced contact section */
.contact {
    background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-bg-alt) 100%);
}

/* Dark theme specific improvements */
[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}

/* System dark theme support */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .navbar {
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid #334155;
    }

    :root:not([data-theme="light"]) .hero {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    }

    :root:not([data-theme="light"]) .project-placeholder {
        color: white !important;
    }

    :root:not([data-theme="light"]) .scroll-indicator {
        color: #3b82f6 !important;
    }

    /* System dark theme for cards and containers */
    :root:not([data-theme="light"]) .skill-category,
    :root:not([data-theme="light"]) .project-card,
    :root:not([data-theme="light"]) .contact-item {
        background: #1e293b;
        border: 1px solid #334155;
    }

    :root:not([data-theme="light"]) .project-card:hover,
    :root:not([data-theme="light"]) .skill-category:hover,
    :root:not([data-theme="light"]) .contact-item:hover {
        background: #334155;
        border-color: #94a3b8;
    }

    /* System dark theme for accordion content */
    :root:not([data-theme="light"]) .accordion-content {
        background: #1e293b;
        border: 1px solid #334155;
    }

    /* System dark theme for footer */
    :root:not([data-theme="light"]) footer {
        background-color: #1e293b;
        border-top: 1px solid #334155;
    }

    :root:not([data-theme="light"]) footer p {
        color: #cbd5e1;
    }

    /* System dark theme for tech tags */
    :root:not([data-theme="light"]) .tech-tag {
        background-color: #334155;
        color: #f1f5f9;
    }

    /* System dark theme for mobile navigation */
    :root:not([data-theme="light"]) .nav-menu {
        background-color: #0f172a;
    }

    :root:not([data-theme="light"]) .nav-menu.active {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    }

    /* System dark theme for hamburger menu */
    :root:not([data-theme="light"]) .bar {
        background-color: #f1f5f9;
    }

    /* System dark theme for theme switcher */
    :root:not([data-theme="light"]) .theme-switcher {
        background: #1e293b;
        border-color: #334155;
    }

    :root:not([data-theme="light"]) .theme-switcher:hover {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    }

    :root:not([data-theme="light"]) .theme-option:hover {
        background: #334155;
    }
}

/* Manual dark theme styles (keep existing) */
/* ...existing code... */

/* Responsive Design */
/* Responsive breakpoint para pantallas medianas donde se superponen */
@media (max-width: 1000px) and (min-width: 769px) {
    .nav-menu {
        gap: 1.5rem;
        /* Reducir espacio entre elementos del menú */
    }

    .theme-switcher {
        right: 1.5rem;
        padding: 6px 10px;
        gap: 6px;
    }

    .theme-option {
        width: 30px;
        height: 30px;
    }

    .theme-option svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--color-bg);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 2rem 0;
        z-index: 999;
        /* Menor que el theme-switcher */
        margin: 0;
        /* Reset margin para móviles */
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .theme-switcher {
        padding: 6px 8px;
        gap: 6px;
    }

    .theme-option {
        width: 28px;
        height: 28px;
    }

    .theme-option svg {
        width: 16px;
        height: 16px;
    }
}

/* Breakpoint para pantallas más estrechas donde necesitamos reducir más el gap */
@media (max-width: 900px) and (min-width: 769px) {
    .nav-menu {
        gap: 1rem;
        /* Reducir más el espacio */
    }

    .nav-link {
        font-size: 0.9rem;
        /* Texto ligeramente más pequeño */
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 1rem 1rem;
    }

    .theme-switcher {
        padding: 4px 6px;
        gap: 4px;
    }

    .theme-option {
        width: 24px;
        height: 24px;
    }

    .theme-option svg {
        width: 12px;
        height: 12px;
    }
}

/* Logos específicos para proyectos */
.facturabilidad-bg {
    background: #034e85;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1rem;
}

.facturabilidad-bg img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Estilos específicos para logos de validador y productos IQ-Tek */
.validador-logo {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1rem;
}

.validador-logo img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    width: auto;
    height: auto;
}

/* Borde específico solo para validador Android */
.validador-android img {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.validador-android img:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.02);
}

/* Estilos específicos para modo oscuro - solo validador Android */
[data-theme="dark"] .validador-android img {
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .validador-android img:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .validador-android img {
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    :root:not([data-theme="light"]) .validador-android img:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
}