/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variables */
:root {
    --primary: #2563eb;
    --secondary: #3b82f6;
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --text: #f1f5f9;
    --text-light: #cbd5e1;
    --border: #334155;
    --shadow: rgba(59, 130, 246, 0.2);
}

/* Base */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: all 0.3s ease;
}

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

/* Particles Container */
#bubblesContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

[data-theme="dark"] .header {
    background: rgba(15, 23, 42, 0.9);
}

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

.logo h1 {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

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

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

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

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.language-selector {
    padding: 0.5rem 1rem;
    padding-right: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.7rem center;
    background-repeat: no-repeat;
    background-size: 1.2rem;
}

.language-selector:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--primary);
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 4px;
    z-index: 10001; /* MÁS ALTO QUE EL HEADER */
    position: relative;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.hero-content h2 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.highlight {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2.5rem;
    max-width: 650px;
    line-height: 1.7;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 2.5rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

/* Projects */
.projects {
    padding: 5rem 0;
    background: var(--bg-secondary);
}

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

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

.project-card {
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.15);
}

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 1rem;
    color: var(--text);
    font-weight: 600;
    font-size: 1.1rem;
}

.project-info p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

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

.project-links a {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.project-links a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Skills */
.skills {
    padding: 5rem 0;
}

.skills h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    font-weight: 700;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

.skill-item {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.skill-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow);
    border-color: var(--primary);
}

.skill-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.skill-item h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    padding: 5rem 0;
    text-align: center;
}

.footer h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

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

.contact-form {
    max-width: 600px;
    margin: 0 auto 3rem;
    background: var(--bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    text-decoration: none;
    color: var(--text);
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

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

/* Responsive */
@media (max-width: 1024px) {
    .skills-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .nav {
        padding: 0.8rem 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* LOGO IZQUIERDA */
    .logo {
        order: 1;
        flex: 1;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    /* OCULTAR MENÚ DESKTOP */
    .nav-menu {
        display: none !important; /* OCULTO POR DEFECTO */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background: var(--bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        z-index: 10000; /* MÁS ALTO QUE HEADER */
        padding: 2rem;
        list-style: none;
        margin: 0;
    }
    
    /* MENÚ ACTIVO */
    .nav-menu.active {
        display: flex !important; /* FORZAR MOSTRAR */
    }
    
    /* LINKS DEL MENÚ MÓVIL */
    .nav-menu li {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .nav-menu a {
        display: block !important;
        padding: 1rem 2rem !important;
        font-size: 1.3rem !important;
        font-weight: 600 !important;
        background: var(--bg-secondary) !important;
        border: 2px solid var(--border) !important;
        border-radius: 12px !important;
        text-align: center !important;
        width: 200px !important;
        color: var(--text) !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
        margin-bottom: 0.5rem !important;
    }
    
    .nav-menu a:hover {
        background: var(--primary) !important;
        color: white !important;
        transform: translateY(-3px) !important;
        box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3) !important;
    }
    
    .nav-menu a::after {
        display: none !important;
    }
    
    /* CONTROLES DERECHA - REORDENADOS */
    .header-controls {
        order: 2;
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
    
    /* THEME TOGGLE PRIMERO */
    .theme-toggle {
        order: 1;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    /* LANGUAGE SELECTOR SEGUNDO */
    .language-selector {
        order: 2;
        padding: 0.4rem 0.6rem;
        padding-right: 1.5rem;
        font-size: 0.8rem;
        min-width: 60px;
    }
    
    /* HAMBURGER TERCERO */
    .mobile-menu-toggle {
        order: 3;
        display: flex;
        z-index: 10001; /* MÁS ALTO QUE TODO */
        margin-left: 0.5rem;
    }
    
    .hero-content h2 {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .skill-item {
        padding: 1.5rem 0.8rem;
    }
    
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .nav {
        padding: 0.6rem 0.8rem;
    }
    
    .logo h1 {
        font-size: 1rem;
    }
    
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-content h2 {
        font-size: 1.8rem;
    }
    
    .language-selector {
        padding: 0.3rem 0.5rem;
        padding-right: 1.2rem;
        font-size: 0.75rem;
        min-width: 55px;
    }
    
    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .scroll-to-top {
        bottom: 15px;
        right: 15px;
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }
    
    .nav-menu a {
        font-size: 1rem;
        min-width: 130px;
        padding: 0.7rem 1.2rem;
    }
    
    .contact-form {
        margin: 0 1rem 3rem;
        padding: 2rem;
    }
}

@media (max-width: 360px) {
    .logo h1 {
        font-size: 0.9rem;
    }
    
    .header-controls {
        gap: 0.3rem;
    }
    
    .language-selector {
        padding: 0.2rem 0.4rem;
        padding-right: 1rem;
        font-size: 0.7rem;
        min-width: 50px;
    }
    
    .theme-toggle {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

/* AGREGAR AL FINAL DEL CSS - DARK THEME */
[data-theme="dark"] .nav-menu {
    background: var(--bg) !important;
}

[data-theme="dark"] .nav-menu a {
    background: var(--bg-secondary) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .nav-menu a:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* Agregar/actualizar estas reglas específicas para el menú desktop en modo oscuro: */

/* Desktop Navigation - modo oscuro */
[data-theme="dark"] .nav-menu {
    background: transparent; /* Sin fondo */
}

[data-theme="dark"] .nav-menu a {
    background: transparent !important; /* Sin fondo blanco */
    color: var(--text) !important; /* Color de texto correcto */
}

[data-theme="dark"] .nav-menu a:hover {
    background: transparent !important; /* Sin fondo al hover */
    color: var(--primary) !important; /* Solo cambiar color de texto */
}

/* Asegurar que en desktop no tenga fondo */
@media (min-width: 769px) {
    .nav-menu {
        background: transparent !important;
    }
    
    .nav-menu a {
        background: transparent !important;
        border: none !important;
    }
    
    [data-theme="dark"] .nav-menu a {
        background: transparent !important;
        border: none !important;
        color: var(--text) !important;
    }
    
    [data-theme="dark"] .nav-menu a:hover {
        background: transparent !important;
        color: var(--primary) !important;
    }
}

/* Solo en móvil debe tener fondo */
@media (max-width: 768px) {
    [data-theme="dark"] .nav-menu.active {
        background: var(--bg) !important; /* Fondo solo en móvil */
    }
    
    [data-theme="dark"] .nav-menu.active a {
        background: var(--bg-secondary) !important; /* Fondo solo en móvil */
        border: 2px solid var(--border) !important;
        color: var(--text) !important;
    }
    
    [data-theme="dark"] .nav-menu.active a:hover {
        background: var(--primary) !important;
        color: white !important;
    }
}