/* Importar fuentes de Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* Variables CSS para colores */
:root {
    /* Modo claro */
    --bg-primary: #fafafa;
    --text-primary: #0D0030;
    --text-secondary: #36188a;
    --accent: #36188a;
    
    /* Modo oscuro */
    --dark-bg-primary: #0D0030;
    --dark-text-primary: #ddda0f;
    --dark-text-secondary: #ddda0f;
    --dark-accent: #ddda0f;
    
    /* Otros colores */
    --white: #ffffff;
    --shadow: rgba(13, 0, 48, 0.1);
    --dark-shadow: rgba(221, 218, 15, 0.2);
}

/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

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

/* Navbar */
.navbar {
    background-color: var(--white);
    box-shadow: 0 2px 10px var(--shadow);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
}

.nav-title {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-secondary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

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

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

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

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

.theme-toggle {
    background: none;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--text-secondary);
    color: var(--white);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    transition: 0.3s;
}

/* Hero Section */
.hero {
    margin-top: 70px;
    padding: 80px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    min-height: 70vh;
}

.hero-content {
    flex: 1;
    max-width: 500px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: 20px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: var(--text-primary);
    opacity: 0.8;
}

.cta-button {
    background-color: var(--text-secondary);
    color: var(--white);
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(54, 24, 138, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(54, 24, 138, 0.4);
}

.hero-image {
    flex: 1;
    text-align: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: none;
    border: none;
    background: transparent;
}

/* Sections */
.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 50px;
    color: var(--text-secondary);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

/* About Section */
.about {
    padding: 80px 20px;
    background-color: var(--white);
}

.about-content {
    max-width: 1200px;
    margin: 0 auto;
}

.about-text {
    text-align: justify;
    line-height: 1.7;
    position: relative;
}

.about-image {
    float: right;
    margin: 0 0 20px 30px;
    max-width: 350px;
    width: 35%;
    shape-outside: margin-box;
}

.about-image img {
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: none;
    border: none;
    background: transparent;
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    clear: both;
}

.about-text p {
    margin-bottom: 25px;
    font-size: 1.1rem;
    line-height: 1.7;
}

.features-list {
    list-style: none;
    margin: 30px 0;
    display: block;
}

.features-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.features-list i {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.about-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Services Section - Grid Layout */
.services {
    padding: 80px 20px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.service-card {
    background: var(--card-background);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.service-image {
    width: 100%;
    height: 200px;
    margin-bottom: 2rem;
    border-radius: 15px;
    overflow: hidden;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: white;
    font-size: 3rem;
    opacity: 0.7;
}

.service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.service-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.service-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.service-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    flex: 1;
    font-weight: 300;
}

/* Responsive para servicios */
@media (max-width: 900px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .service-card {
        padding: 2rem;
    }
    
    .service-image {
        height: 150px;
    }
    
    .service-title {
        font-size: 1.3rem;
    }
    
    .service-description {
        font-size: 0.95rem;
    }
}

@media (max-width: 600px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    .service-image {
        height: 180px;
    }
}

/* Clients Section - Infinite Carousel */
.clients {
    padding: 6rem 0;
    background-color: var(--background-color);
    overflow: hidden;
}

.clients-carousel {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.clients-track {
    display: flex;
    width: calc(200px * 8 + 2rem * 8); /* 4 logos x 2 (duplicados) x 200px + gaps */
    animation: scroll-clients 20s linear infinite;
    gap: 2rem;
}

.client-logo {
    flex-shrink: 0;
    width: 200px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-background);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.client-logo:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.client-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.client-logo:hover img {
    filter: grayscale(0%);
}

/* Estilo específico para Safety World en modo claro */
.safety-world-logo {
    background: var(--card-background) !important;
    border: 1px solid var(--border-color) !important;
}

/* Invertir colores del logo Safety World en modo claro para que se vea */
.safety-world-logo img {
    filter: invert(1) grayscale(100%);
}

.safety-world-logo:hover img {
    filter: invert(1) grayscale(0%);
}

/* En modo oscuro, Safety World mantiene fondo y colores normales */
.dark-mode .safety-world-logo {
    background: var(--card-background) !important;
    border: 1px solid var(--border-color) !important;
}

.dark-mode .safety-world-logo img {
    filter: grayscale(100%);
}

.dark-mode .safety-world-logo:hover img {
    filter: grayscale(0%);
}

/* Animación de scroll infinito */
@keyframes scroll-clients {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-200px * 4 - 2rem * 4)); /* Mueve exactamente 4 logos + gaps para efecto infinito */
    }
}

/* Pausa la animación cuando se hace hover sobre el carrusel */
.clients-carousel:hover .clients-track {
    animation-play-state: paused;
}

/* Responsive para clientes */
@media (max-width: 900px) {
    .client-logo {
        width: 150px;
        height: 80px;
    }
    
    .clients-track {
        width: calc(150px * 8 + 1.5rem * 8);
        gap: 1.5rem;
    }
    
    @keyframes scroll-clients {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-150px * 4 - 1.5rem * 4));
        }
    }
}

@media (max-width: 600px) {
    .client-logo {
        width: 120px;
        height: 60px;
    }
    
    .clients-track {
        width: calc(120px * 8 + 1rem * 8);
        gap: 1rem;
    }
    
    @keyframes scroll-clients {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-120px * 4 - 1rem * 4));
        }
    }
}

/* Technologies Section - Infinite Carousel */
.technologies {
    padding: 6rem 0;
    background-color: var(--card-background);
    overflow: hidden;
}

.technologies-carousel {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.technologies-track {
    display: flex;
    width: calc(140px * 36); /* 18 techs x 2 (duplicados) x 140px cada uno */
    animation: scroll-technologies 42s linear infinite;
    gap: 2rem;
    align-items: center;
}

.tech-logo {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background-color);
    border-radius: 50%;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    position: relative;
}

.tech-logo:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border-color: var(--accent-color);
}

.tech-logo img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.tech-logo i {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.tech-logo:hover img,
.tech-logo:hover i {
    transform: scale(1.1);
}

.tech-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    transition: color 0.3s ease;
}

.tech-logo:hover .tech-name {
    color: var(--accent-color);
}

/* Animación de scroll infinito para tecnologías */
@keyframes scroll-technologies {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-140px * 18 - 2rem * 18)); /* Mueve exactamente 18 techs + gaps */
    }
}

/* Pausa la animación cuando se hace hover sobre el carrusel */
.technologies-carousel:hover .technologies-track {
    animation-play-state: paused;
}

/* Responsive para tecnologías */
@media (max-width: 900px) {
    .tech-logo {
        width: 110px;
        height: 110px;
    }
    
    .tech-logo img {
        width: 45px;
        height: 45px;
    }
    
    .tech-logo i {
        font-size: 2.8rem;
    }
    
    .tech-name {
        font-size: 0.8rem;
    }
    
    .technologies-track {
        width: calc(110px * 36);
        gap: 1.5rem;
        animation: scroll-technologies-tablet 42s linear infinite;
    }
    
    @keyframes scroll-technologies-tablet {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-110px * 18 - 1.5rem * 18));
        }
    }
}

@media (max-width: 600px) {
    .tech-logo {
        width: 90px;
        height: 90px;
    }
    
    .tech-logo img {
        width: 35px;
        height: 35px;
    }
    
    .tech-logo i {
        font-size: 2.2rem;
    }
    
    .tech-name {
        font-size: 0.7rem;
    }
    
    .technologies-track {
        width: calc(90px * 36);
        gap: 1rem;
        animation: scroll-technologies-mobile 42s linear infinite;
    }
    
    @keyframes scroll-technologies-mobile {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-90px * 18 - 1rem * 18));
        }
    }
}

/* Projects Section */
.projects {
    padding: 80px 20px;
    background-color: var(--white);
}

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

.project-card {
    background-color: var(--bg-primary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px var(--shadow);
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
}

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

.project-content {
    padding: 25px;
}

.project-content h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

.project-content p {
    margin-bottom: 20px;
    line-height: 1.6;
    opacity: 0.8;
}

.project-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    background-color: var(--text-secondary);
    color: var(--white);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Contact Section */
.contact {
    padding: 80px 20px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

.contact-info h3 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--text-secondary);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.contact-item i {
    color: var(--text-secondary);
    font-size: 1.3rem;
    width: 20px;
}

.contact-item p {
    font-size: 1.1rem;
}

.social-links {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

.social-links a {
    width: 45px;
    height: 45px;
    background-color: var(--text-secondary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.social-links a:hover {
    transform: scale(1.1);
}

/* Contact Form */
.contact-form {
    background-color: var(--white);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px var(--shadow);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.submit-btn {
    background-color: var(--text-secondary);
    color: var(--white);
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.submit-btn:hover {
    background-color: var(--text-primary);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    background-color: var(--text-primary);
    color: var(--white);
    padding: 40px 20px 20px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-brand h3 {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

/* Logo del footer en modo claro: blanco sobre fondo oscuro */
.footer-brand .logo {
    filter: brightness(0) invert(1); /* Convierte a blanco */
}

/* Logo del footer en modo oscuro: normal sobre fondo amarillo */
body.dark-mode .footer-brand .logo {
    filter: none; /* Sin filtro, mantiene color original */
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-links a {
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 0.8;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.8;
}

/* Modo Oscuro */
body.dark-mode {
    --bg-primary: var(--dark-bg-primary);
    --text-primary: var(--dark-text-primary);
    --text-secondary: var(--dark-text-secondary);
    --white: var(--dark-bg-primary);
    --shadow: var(--dark-shadow);
}

body.dark-mode .navbar {
    background-color: var(--dark-bg-primary);
    border-bottom: 1px solid rgba(221, 218, 15, 0.2);
}

body.dark-mode .about,
body.dark-mode .projects {
    background-color: #1a0f4d;
}

body.dark-mode .service-card,
body.dark-mode .contact-form {
    background-color: #1a0f4d;
}

body.dark-mode .project-card {
    background-color: var(--dark-bg-primary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background-color: #1a0f4d;
    border-color: rgba(221, 218, 15, 0.3);
    color: var(--dark-text-primary);
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group textarea:focus {
    border-color: var(--dark-accent);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: var(--white);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 50px;
        transition: left 0.3s ease;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        font-size: 1.2rem;
        padding: 20px 0;
    }
    
    .hero {
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .about-image {
        float: none;
        margin: 0 auto 30px;
        max-width: 100%;
        width: 100%;
        text-align: center;
    }
    
    .about-text {
        text-align: left;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 40px 15px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .contact-form {
        padding: 25px;
    }
}

/* Animaciones de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-content,
.service-card,
.project-card {
    animation: fadeInUp 0.8s ease-out;
}

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