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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--txt);
    min-height: 100vh;
    overflow-x: hidden;
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--cream-d);
}

::-webkit-scrollbar-thumb {
    background: var(--terra-l);
    border-radius: 3px;
}

/* FONDO DE PANTALLA */
body {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cellipse cx='60' cy='72' rx='20' ry='16' fill='%23C8582E' opacity='.04'/%3E%3Ccircle cx='44' cy='50' r='8' fill='%23C8582E' opacity='.04'/%3E%3Ccircle cx='76' cy='50' r='8' fill='%23C8582E' opacity='.04'/%3E%3Ccircle cx='56' cy='42' r='6' fill='%23C8582E' opacity='.04'/%3E%3Ccircle cx='66' cy='40' r='5' fill='%23C8582E' opacity='.04'/%3E%3C/svg%3E");
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar);
    height: 100vh;
    background: var(--dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0;
    z-index: 300;
    gap: 3px;
}

.sb-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: transform .2s;
    flex-shrink: 0;
}

.sb-logo:hover {
    transform: scale(1.08);
}

.sb-logo-img {
    width: 47px;
    height: 47px;
    object-fit: contain;
}

.sb-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, color .2s;
    font-size: 16px;
    position: relative;
    flex-shrink: 0;
}

.sb-session-btn {
  margin: auto;
  margin-bottom: 0;
}

.sb-btn:hover,
.sb-btn.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.sb-btn.chat-on {
    background: var(--terra);
    color: #fff;
}

.sb-tip {
    position: absolute;
    left: calc(100% + 10px);
    background: rgba(24, 12, 4, .95);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: .72rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    border: 1px solid rgba(255, 255, 255, .08);
}

.sb-btn:hover .sb-tip {
    opacity: 1;
}

.sb-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    background: var(--terra-l);
    border-radius: 50%;
    border: 2px solid var(--dark);
}

.sb-sep {
    width: 28px;
    height: 1px;
    background: rgba(255, 255, 255, .1);
    border-radius: 1px;
    margin: 6px 0;
}

.sb-bottom {
    margin-top: auto;
}

/* PANEL CHAT LATERAL */
#chatPanel {
    position: fixed;
    left: var(--sidebar);
    top: 0;
    bottom: 0;
    width: 0;
    overflow: hidden;
    background: #fff;
    border-right: 1.5px solid var(--border);
    z-index: 195;
    transition: width .32s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 4px 0 24px rgba(80, 40, 16, .08);
    will-change: width;
}

#chatPanel.open {
    width: var(--chat-w);
}

.cp-inner {
    width: var(--chat-w);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: var(--header);
}

.cp-head {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.cp-head h3 {
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.cp-search {
    width: 100%;
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: .8rem;
    background: var(--cream);
    outline: none;
    transition: border-color .2s;
    color: var(--txt);
}

.cp-search:focus {
    border-color: var(--terra);
}

.cp-list {
    flex: 1;
    overflow-y: auto;
}

.cp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid rgba(224, 204, 186, .4);
}

.cp-item:hover {
    background: var(--soft);
}

.cp-item.selected {
    background: var(--cream-d);
}

.cp-av-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--terra);
    flex-shrink: 0;
}

.cp-info {
    flex: 1;
    min-width: 0;
}

.cp-name {
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.cp-prev {
    font-size: .72rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.cp-time {
    font-size: .68rem;
    color: var(--muted);
}

.cp-badge {
    background: var(--terra);
    color: #fff;
    border-radius: 50px;
    font-size: .62rem;
    font-weight: 700;
    padding: 1px 7px;
    min-width: 18px;
    text-align: center;
}

.cp-foot {
    padding: 12px 14px;
    border-top: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-new-chat {
    width: 100%;
    padding: 9px;
    background: var(--terra);
    color: #fff;
    border: none;
    border-radius: var(--r-s);
    font-family: 'DM Sans', sans-serif;
    font-size: .8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background .2s;
    cursor: pointer;
}

.btn-new-chat:hover {
    background: var(--terra-h);
}

.btn-open-full {
    width: 100%;
    padding: 9px;
    background: transparent;
    color: var(--muted);
    border: 1.5px solid var(--border);
    border-radius: var(--r-s);
    font-family: 'DM Sans', sans-serif;
    font-size: .8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: border-color .2s, color .2s;
    cursor: pointer;
}

.btn-open-full:hover {
    border-color: var(--terra);
    color: var(--terra);
}

/* HEADER */
header {
    position: fixed;
    top: 0;
    left: var(--sidebar);
    right: 0;
    height: var(--header);
    background: rgba(251, 246, 238, .98);
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    z-index: 200;
    gap: 20px;
    transition: left .32s cubic-bezier(.4, 0, .2, 1);
    will-change: left;
}

header.chat-open {
    left: calc(var(--sidebar) + var(--chat-w));
}

.hdr-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    flex-shrink: 0;
}

.hdr-logo-icon {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 40px;
    height: 40px;
}

.hdr-logo-txt {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #f87300;
    letter-spacing: -.5px;
}

nav {
    display: flex;
    gap: 3px;
    flex: 1;
    justify-content: center;
}

.nav-btn {
    position: relative;
    padding: 8px 18px;
    border: none;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: .875rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-radius: 50px;
    transition: background .2s, color .2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-btn:hover {
    background: var(--cream-d);
    color: var(--txt);
}

.nav-btn.active {
    background: var(--terra);
    color: #fff;
}

.nav-paw {
    font-size: .7rem;
    opacity: 0;
    transform: scale(0) rotate(-30deg);
    transition: opacity .35s cubic-bezier(.34, 1.6, .64, 1), transform .35s cubic-bezier(.34, 1.6, .64, 1);
}

.nav-btn.active .nav-paw {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.hdr-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.hdr-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: border-color .2s, color .2s;
    position: relative;
    font-size: 14px;
}

.hdr-icon-btn:hover {
    border-color: var(--terra);
    color: var(--terra);
}

.hdr-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background: var(--terra);
    border-radius: 50%;
    font-size: .58rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid var(--cream);
}

.login-btn {
    padding: 8px 20px;
    background: var(--terra);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
}

.login-btn:hover {
    background: var(--terra-h);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(200, 88, 46, .35);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    padding: 4px 12px 4px 4px;
    background: #fff;
    transition: border-color .2s;
}

.user-chip:hover {
    border-color: var(--terra);
}

.user-chip img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--terra);
}

.user-chip-name {
    font-size: .82rem;
    font-weight: 600;
}

/* MAIN */
main {
    margin-left: var(--sidebar);
    padding-top: var(--header);
    min-height: 100vh;
    position: relative;
    z-index: 1;
    transition: margin-left .32s cubic-bezier(.4, 0, .2, 1);
}

main.chat-open {
    margin-left: calc(var(--sidebar) + var(--chat-w));
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* CHAT COMPLETO */
.full-chat {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.94);
    width: min(calc(100vw - 140px), 1050px);
    height: min(calc(100vh - 60px), 700px);
    background: #fff;
    border-radius: 20px;
    z-index: 410;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s cubic-bezier(.34, 1.2, .64, 1), transform .35s cubic-bezier(.34, 1.2, .64, 1);
    display: flex;
    overflow: hidden;
    box-shadow: 0 20px 80px rgba(16, 8, 2, .4);
    will-change: transform, opacity;
}

.full-chat.open {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.fc-sidebar {
    width: 270px;
    border-right: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.fc-sb-head {
    padding: 18px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.fc-sb-head h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.fc-list {
    flex: 1;
    overflow-y: auto;
}

.fc-sb-foot {
    padding: 12px 14px;
    border-top: 1.5px solid var(--border);
}

.fc-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fc-main-head {
    padding: 14px 18px;
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.fc-main-head-info {
    display: flex;
    align-items: center;
    gap: 11px;
}

.fc-active-av {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--terra);
    flex-shrink: 0;
}

.online-dot {
    width: 9px;
    height: 9px;
    background: var(--green-l);
    border-radius: 50%;
    flex-shrink: 0;
}

.fc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fc-input-wrap {
    padding: 12px 18px;
    border-top: 1.5px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

/* RESPONSIVE */
@media(max-width:900px) {
    header {
        left: 0 !important;
        padding: 0 16px;
    }

    main {
        margin-left: 0 !important;
        padding-top: var(--header);
    }

    .sidebar {
        display: none;
    }

    #chatPanel {
        left: 0;
        z-index: 150;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-img-wrap {
        display: none;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    #sec-bienvenida,
    #sec-principal,
    #sec-faq {
        padding: 28px 18px 56px;
    }

    .faq-intro {
        grid-template-columns: 1fr;
    }

    .faq-intro-img {
        display: none;
    }

    .about-cards,
    .team-row {
        grid-template-columns: 1fr;
    }

    .full-chat {
        flex-direction: column;
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
    }

    .fc-sidebar {
        width: 100%;
        height: 180px;
        border-right: none;
        border-bottom: 1.5px solid var(--border);
    }

    .modal-body {
        padding: 18px 18px 24px;
    }

    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .cat-tabs {
        flex-wrap: wrap;
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .post-card,
    .stat-card,
    .step-card,
    .about-card,
    .team-card {
        will-change: auto;
    }

    #chatPanel,
    header,
    .modal,
    .login-modal,
    .full-chat {
        will-change: auto;
    }
}