:root {
    --mega-primary: #1268e5;
    --mega-primary-dark: #0a3f9e;
    --mega-accent: #ffbd17;
    --mega-success: #16a765;
    --mega-danger: #dc3545;
    --mega-text: #172033;
    --mega-muted: #6f7787;
    --mega-surface: #ffffff;
    --mega-bg: #eef3f9;
    --mega-border: #dfe6ef;
    --mega-shadow: 0 14px 38px rgba(24, 52, 89, .12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--mega-text);
    background:
        radial-gradient(circle at top left, rgba(18, 104, 229, .14), transparent 30rem),
        linear-gradient(180deg, #f8fbff 0%, var(--mega-bg) 100%);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding-bottom: 94px;
}

a { text-decoration: none; }

.mega-topbar {
    background: rgba(8, 37, 78, .94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.mega-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: #fff;
    font-weight: 800;
    letter-spacing: -.02em;
}

.mega-brand:hover { color: #fff; }

.mega-brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--mega-accent), #ff8a00);
    color: #15213a;
    box-shadow: 0 8px 22px rgba(255, 189, 23, .28);
}

.mega-brand small {
    display: block;
    margin-top: -2px;
    color: rgba(255,255,255,.66);
    font-size: .72rem;
    font-weight: 600;
}

.hero {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    background: linear-gradient(135deg, #0b2a58, #1268e5 62%, #18a1e5);
    color: #fff;
    box-shadow: var(--mega-shadow);
}

.hero::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -90px;
    top: -110px;
    border-radius: 50%;
    background: rgba(255,255,255,.11);
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: clamp(1.35rem, 4vw, 2.5rem);
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .85rem;
    padding: .38rem .75rem;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}

.hero h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: -.045em;
}

.hero p {
    max-width: 720px;
    margin: 1rem 0 0;
    color: rgba(255,255,255,.82);
    font-size: clamp(.98rem, 2.4vw, 1.12rem);
}

.smart-search {
    position: relative;
    z-index: 3;
    margin-top: 1.4rem;
    padding: .55rem;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 16px 35px rgba(0,0,0,.17);
}

.smart-search .form-control {
    min-height: 54px;
    border: 0;
    box-shadow: none;
    font-size: 1rem;
}

.smart-search .btn {
    min-width: 54px;
    border-radius: 15px;
}

.voice-btn {
    border: 0;
    background: transparent;
    color: var(--mega-primary);
}

.quick-chips {
    display: flex;
    gap: .55rem;
    overflow-x: auto;
    padding: .9rem 0 .15rem;
    scrollbar-width: none;
}

.quick-chips::-webkit-scrollbar { display: none; }

.quick-chip {
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 999px;
    background: rgba(255,255,255,.1);
    color: #fff;
    padding: .58rem .85rem;
    font-size: .86rem;
    font-weight: 700;
    transition: .2s ease;
}

.quick-chip:hover,
.quick-chip:focus {
    background: #fff;
    color: var(--mega-primary-dark);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-title h2 {
    margin: 0;
    font-size: clamp(1.15rem, 3vw, 1.45rem);
    letter-spacing: -.02em;
}

.section-title p {
    margin: .25rem 0 0;
    color: var(--mega-muted);
    font-size: .91rem;
}

.surface-card {
    border: 1px solid rgba(223, 230, 239, .84);
    border-radius: 22px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 10px 28px rgba(31, 60, 99, .08);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .85rem;
}

.service-card {
    display: flex;
    min-height: 128px;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.05rem;
    border: 1px solid var(--mega-border);
    border-radius: 20px;
    background: #fff;
    color: var(--mega-text);
    box-shadow: 0 8px 20px rgba(31, 60, 99, .06);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.service-card:hover {
    transform: translateY(-3px);
    border-color: rgba(18, 104, 229, .32);
    box-shadow: 0 14px 28px rgba(31, 60, 99, .12);
}

.service-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(18,104,229,.11);
    color: var(--mega-primary);
    font-size: 1.15rem;
}

.service-card strong { font-size: .96rem; }
.service-card small { color: var(--mega-muted); }

.chat-panel {
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--mega-border);
    background: #fff;
    box-shadow: var(--mega-shadow);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--mega-border);
    background: #f9fbfe;
}

.chat-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--mega-primary), #21a0e5);
    color: #fff;
}

.chat-log {
    display: flex;
    min-height: 140px;
    max-height: 360px;
    flex-direction: column;
    gap: .7rem;
    overflow-y: auto;
    padding: 1rem;
    background: linear-gradient(180deg, #fff, #f7fafe);
}

.chat-bubble {
    max-width: 88%;
    padding: .75rem .9rem;
    border-radius: 16px;
    font-size: .94rem;
    line-height: 1.42;
}

.chat-bubble.assistant {
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    background: #eaf2ff;
    color: #18375f;
}

.chat-bubble.user {
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    background: var(--mega-primary);
    color: #fff;
}

.typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .45;
    animation: typing 1.1s infinite ease-in-out;
}

.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

@keyframes typing {
    0%, 70%, 100% { transform: translateY(0); opacity: .35; }
    35% { transform: translateY(-4px); opacity: 1; }
}

.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .9rem;
}

.filter-row {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .25rem;
    scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-pill {
    flex: 0 0 auto;
    padding: .48rem .76rem;
    border: 1px solid var(--mega-border);
    border-radius: 999px;
    background: #fff;
    color: #344157;
    font-size: .84rem;
    font-weight: 700;
}

.filter-pill.active {
    border-color: var(--mega-primary);
    background: var(--mega-primary);
    color: #fff;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}

.result-card {
    position: relative;
    display: flex;
    min-height: 175px;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--mega-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(31, 60, 99, .07);
}

.result-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18px;
    bottom: 18px;
    width: 4px;
    border-radius: 0 7px 7px 0;
    background: var(--mega-primary);
}

.result-card.type-commerce::before { background: #1ba7c9; }
.result-card.type-comunicado::before { background: var(--mega-accent); }
.result-card.type-bus::before { background: var(--mega-primary); }

.result-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.result-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #eef4ff;
    color: var(--mega-primary);
}

.result-card.type-commerce .result-icon {
    background: #e8f8fc;
    color: #13809a;
}

.result-card.type-comunicado .result-icon {
    background: #fff7dc;
    color: #9b6d00;
}

.result-card h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.25;
}

.result-meta {
    margin-top: .28rem;
    color: var(--mega-muted);
    font-size: .78rem;
}

.result-description {
    margin: .8rem 0 1rem;
    color: #465168;
    font-size: .9rem;
    line-height: 1.5;
    white-space: pre-line;
}

.result-actions {
    display: flex;
    gap: .55rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.result-actions .btn {
    border-radius: 12px;
    font-size: .84rem;
    font-weight: 700;
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--mega-muted);
}

.empty-state i {
    display: block;
    margin-bottom: .8rem;
    color: #a8b4c6;
    font-size: 2rem;
}

.whatsapp-float {
    position: fixed;
    z-index: 1050;
    right: 18px;
    bottom: 92px;
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .78rem 1rem;
    border-radius: 999px;
    background: #25d366;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(37, 211, 102, .34);
}

.whatsapp-float:hover { color: #fff; transform: translateY(-2px); }

.mobile-nav {
    position: fixed;
    z-index: 1040;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    grid-template-columns: repeat(4, 1fr);
    padding: .5rem .45rem calc(.5rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--mega-border);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(16px);
    box-shadow: 0 -8px 24px rgba(31, 60, 99, .1);
}

.mobile-nav a {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: .22rem;
    color: #7d8798;
    font-size: .69rem;
    font-weight: 700;
}

.mobile-nav a i { font-size: 1.05rem; }
.mobile-nav a.active { color: var(--mega-primary); }

.list-search {
    position: sticky;
    z-index: 10;
    top: 72px;
    padding: .75rem;
    border: 1px solid var(--mega-border);
    border-radius: 18px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 24px rgba(31, 60, 99, .08);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.category-btn {
    min-height: 82px;
    padding: .7rem;
    border: 1px solid var(--mega-border);
    border-radius: 16px;
    background: #fff;
    color: var(--mega-text);
    font-size: .82rem;
    font-weight: 700;
    text-align: center;
}

.category-btn i {
    display: block;
    margin-bottom: .35rem;
    color: var(--mega-primary);
    font-size: 1.15rem;
}

.category-btn.active {
    border-color: var(--mega-primary);
    background: #edf4ff;
    color: var(--mega-primary-dark);
}

.route-box {
    padding: 1rem;
    border: 1px solid var(--mega-border);
    border-radius: 18px;
    background: #fff;
}

.route-select {
    min-height: 50px;
    border-radius: 14px;
}

.swap-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: .25rem auto;
    border: 0;
    border-radius: 14px;
    background: #eaf2ff;
    color: var(--mega-primary);
}

.toast-lite {
    position: fixed;
    z-index: 1080;
    left: 50%;
    bottom: 106px;
    transform: translateX(-50%) translateY(15px);
    max-width: calc(100vw - 30px);
    padding: .75rem 1rem;
    border-radius: 13px;
    background: #14213a;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
    box-shadow: 0 10px 25px rgba(0,0,0,.22);
}

.toast-lite.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 991.98px) {
    .service-grid, .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
    body { padding-bottom: 92px; }
    .desktop-nav { display: none !important; }
    .mobile-nav { display: grid; }
    .hero { border-radius: 0 0 26px 26px; margin-inline: calc(-.75rem); }
    .hero-content { padding-top: 1.25rem; }
    .smart-search { border-radius: 17px; }
    .smart-search .form-control { min-height: 48px; font-size: .94rem; }
    .service-grid { gap: .65rem; }
    .service-card { min-height: 112px; padding: .85rem; }
    .result-card { min-height: 0; }
    .whatsapp-float span { display: none; }
    .whatsapp-float {
        right: 15px;
        bottom: 88px;
        width: 54px;
        height: 54px;
        justify-content: center;
        padding: 0;
        font-size: 1.3rem;
    }
    .list-search { top: 8px; }
}

@media (max-width: 420px) {
    .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero h1 { font-size: 1.75rem; }
    .result-actions .btn { flex: 1 1 auto; }
}
