:root {
    --bg: #0b1020;
    --bg-soft: #121935;
    --fg: #e6e9f2;
    --muted: #9aa3bf;
    --accent: #6cf;
    --accent-2: #7af2c8;
    --card: #19224a;
    --border: #2a335c;
    --error-bg: #4a1a1a;
    --error-border: #802020;
    --wa: #25d366;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero {
    min-height: 80vh;
    background: radial-gradient(ellipse at top, var(--bg-soft), var(--bg));
    padding: 1.5rem 2rem 4rem;
    display: flex;
    flex-direction: column;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}
.brand-name {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
}
.brand-by { color: var(--muted); font-size: 0.8rem; font-weight: 400; }

.logo-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 12px var(--accent);
}

.cta-link {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.cta-link:hover {
    background: var(--card);
    border-color: var(--accent);
    text-decoration: none;
}

.hero-content {
    max-width: 720px;
    margin: auto;
    text-align: center;
    animation: fadeInUp 0.6s ease both;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent-2);
    font-size: 0.85rem;
    margin: 0 0 0.8rem;
}

.hero-content h1 {
    font-size: clamp(2rem, 5vw, 3.6rem);
    margin: 0 0 1rem;
    color: var(--fg);
}
.hero-content h1 .highlight {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}

.lead { color: var(--muted); font-size: 1.15rem; margin-bottom: 1rem; }
.hero-tag { color: var(--accent-2); font-size: 0.95rem; font-style: italic; margin: 0 0 1.8rem; }
.section-sub { color: var(--muted); margin: -1rem 0 2rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0b1020;
    border: 0;
    padding: 0.9rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(108, 204, 255, 0.25);
}

/* ---------- Sections ---------- */
.services, .contact, .clients, .values {
    max-width: 1100px;
    margin: 0 auto;
    padding: 4rem 2rem;
}
.services h2, .contact h2, .clients h2, .values h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}
.service-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.4rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.service-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}
.service-card h3 { margin: 0; font-size: 1.05rem; color: var(--fg); }

.clients { text-align: center; }
.client-list { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; }
.client-pill {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.value-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.value-card {
    background: linear-gradient(135deg, rgba(108,204,255,0.08), rgba(122,242,200,0.05));
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.4rem;
    text-align: center;
    font-weight: 500;
}

/* ---------- Contact (rediseñada) ---------- */
.contact {
    padding: 5rem 2rem;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(108,204,255,0.10), transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(122,242,200,0.10), transparent 55%);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.contact-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}
.contact-inner h2 {
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    margin: 0 0 1rem;
}
.contact-lead {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 620px;
    margin: 0 auto 2.5rem;
}

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

.contact-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1.5rem 1.3rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--fg);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}
.contact-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 0;
}
.contact-card > * { position: relative; z-index: 1; }
.contact-card:hover {
    transform: translateY(-4px);
    border-color: transparent;
    box-shadow: 0 18px 40px rgba(108,204,255,0.18);
    text-decoration: none;
}
.contact-card:hover::before { opacity: 0.08; }

.contact-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(108,204,255,0.1);
    color: var(--accent);
    margin-bottom: 0.3rem;
}
.contact-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--fg);
}
.contact-value {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    word-break: break-word;
}
.contact-cta {
    margin-top: auto;
    padding-top: 0.6rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease, transform 0.2s ease;
}
.contact-card:hover .contact-cta {
    color: var(--accent-2);
    transform: translateX(2px);
}

.contact-card-wa .contact-icon { background: rgba(37,211,102,0.12); color: var(--wa); }
.contact-card-wa:hover { box-shadow: 0 18px 40px rgba(37,211,102,0.22); }
.contact-card-wa:hover .contact-cta { color: var(--wa); }

.contact-card-ig .contact-icon {
    background: linear-gradient(135deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888);
    color: #fff;
}
.contact-card-ig:hover { box-shadow: 0 18px 40px rgba(220,39,67,0.25); }
.contact-card-ig:hover .contact-cta {
    background: linear-gradient(135deg, #f09433, #dc2743, #bc1888);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.contact-card-bot {
    background: linear-gradient(135deg, rgba(108,204,255,0.10), rgba(122,242,200,0.06));
    border-color: rgba(108,204,255,0.35);
}
.contact-card-bot .contact-icon {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0b1020;
}
.contact-card-bot:hover { box-shadow: 0 18px 40px rgba(108,204,255,0.32); }

/* ---------- Footer ---------- */
footer {
    padding: 1.8rem 2rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.footer-inner p { margin: 0; }
.footer-social { display: flex; gap: 0.6rem; }
.footer-social a {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.footer-social a:hover {
    transform: translateY(-2px);
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, #f09433, #dc2743, #bc1888);
}

/* ---------- Chat FAB ---------- */
.chat-fab {
    position: fixed;
    bottom: 24px; right: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0b1020;
    border: 0;
    padding: 0.9rem 1.4rem;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.chat-fab:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 30px rgba(108,204,255,0.4);
}
.chat-fab.hidden { display: none; }
.fab-pulse {
    position: relative;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #0b1020;
}
.fab-pulse::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(11,16,32,0.5);
    animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
    0% { transform: scale(0.6); opacity: 0.7; }
    70% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- Chat widget ---------- */
.chat-widget {
    position: fixed;
    bottom: 24px; right: 24px;
    width: min(400px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 48px));
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.55);
    z-index: 101;
    overflow: hidden;
    transform-origin: bottom right;
    animation: chatOpen 0.22s ease both;
}
.chat-widget.hidden {
    display: none;
}
@keyframes chatOpen {
    0% { opacity: 0; transform: translateY(12px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.chat-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.chat-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.chat-title-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.chat-title-text strong {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-subtitle { color: var(--muted); font-size: 0.75rem; font-weight: 400; }

.chat-controls { display: flex; align-items: center; gap: 0.25rem; }
.icon-btn {
    background: transparent;
    color: var(--fg);
    border: 0;
    width: 34px; height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
    text-decoration: none;
}
.icon-btn:hover { background: rgba(255,255,255,0.06); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn-wa { color: var(--wa); }
.icon-btn-wa:hover { background: rgba(37, 211, 102, 0.12); }

#close-chat { font-size: 1.6rem; line-height: 1; }

/* ---------- Messages ---------- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    scroll-behavior: smooth;
}

.msg {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    max-width: 90%;
}
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-error { align-self: flex-start; }
.msg-anim { animation: msgIn 0.22s ease both; }
@keyframes msgIn {
    0% { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    flex-shrink: 0;
}

.msg-bubble {
    padding: 0.55rem 0.85rem;
    border-radius: 14px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}
.msg-bot .msg-bubble {
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.msg-user .msg-bubble {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0b1020;
    border-bottom-right-radius: 4px;
}
.msg-error .msg-bubble {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #ffd;
}

.msg-content { white-space: pre-wrap; }
.msg-content p { margin: 0 0 0.4rem; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul, .msg-content ol { margin: 0.2rem 0 0.4rem; padding-left: 1.3rem; }
.msg-content li { margin: 0.15rem 0; }
.msg-content code {
    background: rgba(0,0,0,0.35);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.92em;
}
.msg-content pre {
    background: rgba(0,0,0,0.35);
    padding: 0.6rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.4rem 0;
}
.msg-content pre code { background: transparent; padding: 0; }
.msg-content a { color: inherit; text-decoration: underline; }
.msg-user .msg-content a { color: #06203a; }

.msg-time {
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 0.25rem;
    text-align: right;
}
.msg-user .msg-time { color: rgba(11,16,32,0.6); }
.msg-error .msg-time { color: rgba(255,255,221,0.6); }

/* ---------- Typing indicator ---------- */
.msg-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.7rem 0.85rem;
}
.msg-typing .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--muted);
    animation: typingBounce 1.2s infinite ease-in-out;
}
.msg-typing .dot:nth-child(2) { animation-delay: 0.18s; }
.msg-typing .dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Quick replies ---------- */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem 0;
    animation: msgIn 0.3s ease both;
}
.quick-replies.hidden { display: none; }
.qr {
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.qr:hover {
    border-color: var(--accent);
    background: var(--card);
}
.qr:active { transform: scale(0.97); }

/* ---------- Form ---------- */
.chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.7rem;
    border-top: 1px solid var(--border);
    background: var(--card);
}
.chat-form input {
    flex: 1;
    padding: 0.7rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--fg);
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-form input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,204,255,0.18);
}
.chat-form button[type=submit] {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0b1020;
    border: 0;
    padding: 0 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.chat-form button[type=submit]:hover { transform: translateY(-1px); }
.chat-form button[type=submit]:disabled { opacity: 0.45; cursor: wait; transform: none; }

/* ---------- Animations ---------- */
@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .hero { padding: 1rem 1.2rem 3rem; min-height: 70vh; }
    .nav { margin-bottom: 2.5rem; }
    .services, .contact, .clients, .values { padding: 2.5rem 1.2rem; }
    .services h2, .contact h2, .clients h2, .values h2 { font-size: 1.5rem; }

    .chat-fab {
        bottom: 14px; right: 14px;
        padding: 0.8rem 1.2rem;
        font-size: 0.92rem;
    }

    .chat-widget {
        position: fixed;
        bottom: 0; right: 0; left: 0; top: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: 0;
    }
    .chat-header { padding: 0.7rem 0.8rem; }
    .chat-avatar { width: 32px; height: 32px; }
    .chat-title-text strong { font-size: 0.95rem; }

    .msg { max-width: 95%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
