/* ================= VARIABLES & RESET ================= */
:root {
    --primary-orange: #ff3c00;
    --text-main: #000000;
    --text-muted: #666666;
    --bg-body: #ffffff;
    --bg-card: #f9f9f9;
    --border-color: #e5e5e5;
    --header-height: 80px;
    --nav-text-initial: #000000; 
    --font-primary: 'Inter', sans-serif;
    --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="dark"] {
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --bg-body: #050505;
    --bg-card: #111111;
    --border-color: #333333;
    --nav-text-initial: #ffffff;
}

/* Solo en páginas con Hero Oscuro (detectado por JS) las letras inician blancas */
body.is-home { --nav-text-initial: #ffffff; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { margin: 0; padding: 0; }

body {
    font-family: var(--font-primary);
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    display: flex; flex-direction: column; 
    min-height: 100vh;
    position: relative;
    padding-top: var(--header-height); 
    margin: 0;
}

body.is-home { padding-top: 0; }

main { flex: 1 0 auto; width: 100%; display: flex; flex-direction: column; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ================= UTILITIES ================= */
.section-pad { padding: 100px 0; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.mb-40 { margin-bottom: 40px; }
.mb-60 { margin-bottom: 60px; }

.text-white { color: #ffffff !important; }
.section-title-left { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--text-main); }

/* Badges & Botones */
.pill-badge { display: inline-flex; padding: 6px 14px; border-radius: 50px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 15px; }
.pill-badge.dark { background: #000; color: #fff; }
.pill-badge.border { border: 1px solid var(--border-color); color: var(--text-muted); }
.pill-badge.white-bg { background: #fff; color: #000; }

.btn-cta { display: inline-flex; align-items: center; gap: 8px; padding: 12px 28px; border-radius: 50px; font-weight: 600; font-size: 0.9rem; transition: 0.3s; cursor: pointer; border: none; }
.btn-cta.orange { background: var(--primary-orange); color: #fff; }
.btn-cta.orange:hover { background: #d93300; transform: translateY(-2px); }

.fade-section { opacity: 0; transform: translateY(20px); transition: opacity 0.8s ease, transform 0.8s ease; }
.fade-section.visible { opacity: 1; transform: translateY(0); }

/* ================= HEADER (NAVBAR) ================= */
#main-header {
    position: fixed; top: 0; left: 0; width: 100%; height: var(--header-height); z-index: 1000;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    background-color: rgba(255, 255, 255, 0.98); backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

body.is-home #main-header { background-color: transparent; backdrop-filter: none; border-bottom: none; }

.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }

/* LOGO */
.logo { display: flex; align-items: center; text-decoration: none; }
.logo-img { height: 40px; width: auto; transition: transform 0.3s ease, filter 0.3s ease; }
.logo:hover .logo-img { transform: scale(1.05); }

/* LÓGICA LOGO BLANCO/NEGRO */
/* Si estamos en Home (Fondo oscuro) y NO hemos scrolleado, invertimos el logo negro a blanco */
body.is-home #main-header:not(.scrolled) .logo-img {
    filter: brightness(0) invert(1); 
}

/* NAV DESKTOP */
.nav-desktop { display: flex; align-items: center; gap: 40px; }
.nav-link { font-family: var(--font-primary); font-weight: 500; font-size: 0.95rem; position: relative; padding: 5px 0; color: var(--nav-text-initial); transition: color 0.3s; }

.nav-link::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 0%; height: 3px;
    background-color: var(--primary-orange); border-radius: 2px; transition: width 0.3s ease;
}
.nav-link:hover::after, .nav-link.active-page::after { width: 100%; }
.nav-link.active-page { font-weight: 500; }

/* HEADER SCROLLED (Siempre Fondo Blanco / Texto Negro) */
#main-header.scrolled { 
    background-color: rgba(255, 255, 255, 0.98) !important; 
    backdrop-filter: blur(10px); 
    box-shadow: 0 4px 20px rgba(0,0,0,0.05); 
}
#main-header.scrolled .nav-link { color: #000000 !important; }

/* ESTA ES LA REGLA QUE FALTABA: FORZAR HAMBURGUESA NEGRA AL SCROLLEAR */
#main-header.scrolled .hamburger-btn { color: #000000 !important; }

/* === MOBILE MENU === */
.hamburger-btn { 
    display: none; 
    font-size: 1.5rem; 
    cursor: pointer; 
    color: var(--nav-text-initial); 
    z-index: 1002; 
    transition: color 0.3s; 
}
/* El botón hamburguesa también debe ser blanco al inicio en Home */
body.is-home #main-header:not(.scrolled) .hamburger-btn { color: #ffffff; }

.mobile-menu {
    position: fixed; top: 0; right: -100%; width: 100%; height: 100vh;
    background: var(--bg-body); padding: 80px 40px;
    display: flex; flex-direction: column; gap: 30px;
    transition: 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 2000;
}
.mobile-menu.active { right: 0; }

.mobile-link { font-size: 1.5rem; font-weight: 700; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; color: var(--text-main); }

.close-menu-btn {
    position: absolute; top: 25px; right: 25px;
    background: none; border: none; font-size: 2rem; color: var(--text-main);
    cursor: pointer;
}

@media (max-width: 992px) {
    .nav-desktop { display: none; }
    .hamburger-btn { display: block; }
}

/* ================= CONTACTO GLOBAL ================= */
.global-contact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 40px; }
.global-contact-card {
    background-color: #fcfcfc; border-radius: 12px; padding: 40px 20px; text-align: center;
    display: flex; flex-direction: column; align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease; border: 1px solid transparent;
}
.global-contact-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.06); background-color: #fff; border-color: #eee; }
.contact-icon-lg { font-size: 2rem; margin-bottom: 20px; color: var(--text-main); }
.global-contact-card h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; color: var(--text-main); }
.global-contact-card p { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 25px; line-height: 1.5; max-width: 90%; }
.link-action { margin-top: auto; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; color: var(--text-main); transition: 0.3s; }
.link-action:hover { color: var(--primary-orange); }

@media (max-width: 1024px) { .global-contact-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .global-contact-grid { grid-template-columns: 1fr; } }

/* ================= WHATSAPP ================= */
.floating-chat {
    position: fixed; bottom: 30px; right: 30px;
    width: 60px; height: 60px;
    background-color: #000000;
    color: #ffffff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); z-index: 2000;
    font-size: 1.5rem; transition: transform 0.3s, background-color 0.3s;
}
.floating-chat:hover { transform: scale(1.1); background-color: #222; }

/* ================= MODALES (FIXED) ================= */
.modal-overlay {
    display: none !important;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 3000;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex !important; }

/* Estilos internos del modal */
.modal-content { background: #fff; padding: 20px; width: 90%; max-width: 800px; border-radius: 12px; position: relative; }
#close-modal-btn { 
    position: absolute; top: 10px; right: 10px; 
    background: none; border: none; font-size: 2rem; 
    cursor: pointer; color: #333; transition: 0.3s;
}
#close-modal-btn:hover { color: var(--primary-orange); }

/* ================= FOOTER ================= */
#global-footer { flex-shrink: 0; width: 100%; margin-top: auto; background-color: #000; }
.minimal-footer { background-color: #000; color: #fff; padding: 60px 20px; text-align: center; font-size: 0.95rem; }
.footer-row-links, .footer-row-legal { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.footer-row-links a, .footer-row-legal a { color: #fff; transition: 0.2s; opacity: 0.8; }
.footer-row-links a:hover, .footer-row-legal a:hover { text-decoration: none; opacity: 1; color: var(--primary-orange); }
.sep { margin: 0 5px; opacity: 0.5; }
.footer-row-desc { margin-top: 20px; max-width: 900px; margin-left: auto; margin-right: auto; color: #777; line-height: 1.5; font-size: 0.85rem; }

@media (max-width: 768px) {
    .footer-row-links, .footer-row-legal { flex-direction: column; gap: 10px; }
    .sep { display: none; }
}