/* =========================================================
   BYTE V1 - AGENTE INTELIGENTE GEEK
   ========================================================= */
:root {
    --byte-primary: #2e5e55;
    --byte-secondary: #5ec8aa;
    --byte-ink: #111827;
    --byte-muted: #6b7280;
    --byte-card: rgba(255, 255, 255, 0.94);
    --byte-border: rgba(46, 94, 85, 0.14);
}

.byte-launcher,
.byte-nudge,
.byte-modal {
    font-family: 'Poppins', sans-serif;
}

.byte-launcher {
    position: fixed;
    left: 1.25rem;
    bottom: 1.25rem;
    width: 62px;
    height: 62px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.62);
    background:
        radial-gradient(circle at 32% 22%, rgba(94, 200, 170, 0.95), rgba(46, 94, 85, 0.96) 58%, #234b45 100%);
    color: #ffffff;
    display: grid;
    place-items: center;
    box-shadow: 0 22px 55px rgba(46, 94, 85, 0.28);
    z-index: 70;
    cursor: pointer;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.byte-launcher:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 26px 70px rgba(46, 94, 85, 0.36);
}

.byte-launcher span {
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.byte-launcher::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 1px solid rgba(94, 200, 170, 0.30);
    animation: bytePulse 2.6s cubic-bezier(.4, 0, .2, 1) infinite;
    pointer-events: none;
}

@keyframes bytePulse {
    0% { opacity: 0.65; transform: scale(0.96); }
    70% { opacity: 0; transform: scale(1.28); }
    100% { opacity: 0; transform: scale(1.28); }
}

.byte-nudge {
    position: fixed;
    left: 1.25rem;
    bottom: 5.6rem;
    width: min(360px, calc(100vw - 2.5rem));
    background: var(--byte-card);
    color: var(--byte-ink);
    border: 1px solid var(--byte-border);
    border-radius: 1.35rem;
    box-shadow: 0 28px 85px rgba(17, 24, 39, 0.18);
    padding: 1rem;
    z-index: 70;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(18px);
}

.byte-nudge.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.byte-nudge-top {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.byte-avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 0.82rem;
    color: #ffffff;
    background: linear-gradient(135deg, var(--byte-primary), var(--byte-secondary));
    box-shadow: 0 12px 28px rgba(46, 94, 85, 0.22);
}

.byte-nudge h3 {
    margin: 0 1.6rem 0.25rem 0;
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--byte-ink);
}

.byte-nudge p {
    margin: 0;
    color: var(--byte-muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.byte-nudge-actions {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.9rem;
}

.byte-nudge-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.byte-btn {
    border: none;
    border-radius: 999px;
    padding: 0.76rem 1rem;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
}

.byte-btn:hover { transform: translateY(-1px); }

.byte-btn-primary {
    background: var(--byte-primary);
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(46, 94, 85, 0.24);
}

.byte-btn-primary:hover { background: #244e47; }

.byte-btn-soft {
    background: rgba(46, 94, 85, 0.08);
    color: var(--byte-primary);
}

.byte-btn-ghost {
    background: transparent;
    color: var(--byte-muted);
}

.byte-modal {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.3rem;
    background: rgba(17, 24, 39, 0.64);
    backdrop-filter: blur(10px);
}

.byte-modal.is-open { display: flex; }

.byte-modal-card {
    width: min(1080px, 100%);
    max-height: min(92vh, 880px);
    overflow: hidden;
    display: grid;
    grid-template-columns: 0.88fr 1.12fr;
    background: #ffffff;
    border-radius: 2rem;
    box-shadow: 0 34px 110px rgba(0, 0, 0, 0.26);
    border: 1px solid rgba(255, 255, 255, 0.44);
}

.byte-panel-left {
    position: relative;
    padding: 2rem;
    color: #ffffff;
    background:
        radial-gradient(circle at 18% 22%, rgba(94, 200, 170, 0.55), transparent 36%),
        linear-gradient(145deg, #234b45 0%, #2e5e55 56%, #173630 100%);
    overflow: hidden;
}

.byte-panel-left::after {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    right: -170px;
    bottom: -120px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.035), 0 0 0 74px rgba(255, 255, 255, 0.025);
}

.byte-modal-avatar {
    position: relative;
    z-index: 1;
    width: 62px;
    height: 62px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-bottom: 1.25rem;
}

.byte-panel-left h2 {
    position: relative;
    z-index: 1;
    font-size: clamp(1.8rem, 3vw, 3rem);
    line-height: 1.05;
    font-weight: 900;
    margin: 0 0 1rem;
}

.byte-panel-left p {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.7;
    font-size: 0.96rem;
}

.byte-mini-steps {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.7rem;
    margin-top: 1.6rem;
}

.byte-mini-step {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.86rem;
}

.byte-mini-step span {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.72rem;
    font-weight: 900;
}

.byte-panel-right {
    position: relative;
    padding: 2rem;
    overflow-y: auto;
    background:
        radial-gradient(circle at 82% 0%, rgba(94, 200, 170, 0.12), transparent 34%),
        #ffffff;
}

.byte-modal-close {
    position: absolute;
    top: 1.05rem;
    right: 1.05rem;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    background: rgba(17, 24, 39, 0.06);
    color: #6b7280;
    font-size: 1.4rem;
    cursor: pointer;
}

.byte-form-header {
    padding-right: 2.5rem;
    margin-bottom: 1.2rem;
}

.byte-form-header h3 {
    font-size: 1.35rem;
    line-height: 1.2;
    font-weight: 900;
    color: var(--byte-ink);
    margin: 0 0 0.45rem;
}

.byte-form-header p {
    color: var(--byte-muted);
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0;
}

.byte-fieldset {
    border: none;
    padding: 0;
    margin: 1.15rem 0;
}

.byte-label {
    display: block;
    font-size: 0.86rem;
    font-weight: 900;
    color: var(--byte-ink);
    margin-bottom: 0.65rem;
}

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

.byte-choice {
    position: relative;
}

.byte-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.byte-choice span {
    min-height: 54px;
    display: flex;
    align-items: center;
    padding: 0.78rem 0.85rem;
    border-radius: 1rem;
    background: rgba(46, 94, 85, 0.045);
    border: 1px solid rgba(46, 94, 85, 0.10);
    color: #374151;
    font-size: 0.83rem;
    font-weight: 700;
    line-height: 1.32;
    cursor: pointer;
    transition: border 0.2s ease, background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.byte-choice input:checked + span {
    background: rgba(46, 94, 85, 0.13);
    border-color: rgba(46, 94, 85, 0.48);
    color: var(--byte-primary);
    box-shadow: 0 12px 30px rgba(46, 94, 85, 0.10);
}

.byte-choice span:hover {
    transform: translateY(-1px);
    border-color: rgba(46, 94, 85, 0.26);
}

.byte-textarea {
    width: 100%;
    min-height: 128px;
    resize: vertical;
    border-radius: 1.1rem;
    border: 1px solid rgba(46, 94, 85, 0.16);
    background: rgba(249, 250, 251, 0.9);
    color: var(--byte-ink);
    padding: 0.95rem 1rem;
    outline: none;
    font-size: 0.9rem;
    line-height: 1.55;
}

.byte-textarea:focus {
    border-color: rgba(46, 94, 85, 0.55);
    box-shadow: 0 0 0 4px rgba(46, 94, 85, 0.10);
}

.byte-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.1rem;
}

.byte-helper-text {
    color: var(--byte-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.byte-loading {
    display: none;
    align-items: center;
    gap: 0.6rem;
    color: var(--byte-primary);
    font-weight: 800;
    font-size: 0.86rem;
}

.byte-loading.is-visible { display: flex; }

.byte-loader {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 3px solid rgba(46, 94, 85, 0.14);
    border-top-color: var(--byte-primary);
    animation: byteSpin 0.75s linear infinite;
}

@keyframes byteSpin { to { transform: rotate(360deg); } }

.byte-results {
    display: none;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(46, 94, 85, 0.10);
}

.byte-results.is-visible { display: block; }

.byte-result-summary {
    background: rgba(46, 94, 85, 0.07);
    border: 1px solid rgba(46, 94, 85, 0.12);
    border-radius: 1.2rem;
    padding: 1rem;
    color: #374151;
    line-height: 1.6;
    font-size: 0.9rem;
}

.byte-recommendations {
    display: grid;
    gap: 0.75rem;
    margin: 0.9rem 0;
}

.byte-rec-card {
    border-radius: 1.1rem;
    border: 1px solid rgba(46, 94, 85, 0.12);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.95rem;
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 12px 35px rgba(17, 24, 39, 0.055);
}

.byte-rec-img {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(46, 94, 85, 0.08);
}

.byte-rec-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.byte-rec-card h4 {
    margin: 0 0 0.25rem;
    color: var(--byte-primary);
    font-size: 0.96rem;
    font-weight: 900;
}

.byte-rec-card p {
    margin: 0;
    color: var(--byte-muted);
    font-size: 0.79rem;
    line-height: 1.48;
}

.byte-rec-card .byte-btn {
    white-space: nowrap;
    padding: 0.65rem 0.85rem;
}

.byte-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin-top: 0.9rem;
}

.byte-next-step {
    margin: 0.8rem 0 0;
    color: var(--byte-muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.byte-error {
    display: none;
    margin-top: 0.85rem;
    border-radius: 1rem;
    padding: 0.85rem;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.14);
    color: #991b1b;
    font-size: 0.84rem;
    line-height: 1.5;
}

.byte-error.is-visible { display: block; }

body.dark-mode .byte-nudge,
body.dark-mode .byte-modal-card,
body.dark-mode .byte-panel-right,
body.dark-mode .byte-rec-card {
    background: rgba(31, 41, 55, 0.97);
    color: #f9fafb;
}

body.dark-mode .byte-nudge h3,
body.dark-mode .byte-form-header h3,
body.dark-mode .byte-label,
body.dark-mode .byte-panel-right,
body.dark-mode .byte-rec-card h4 {
    color: #f9fafb;
}

body.dark-mode .byte-nudge p,
body.dark-mode .byte-form-header p,
body.dark-mode .byte-helper-text,
body.dark-mode .byte-rec-card p,
body.dark-mode .byte-next-step {
    color: #d1d5db;
}

body.dark-mode .byte-choice span,
body.dark-mode .byte-textarea,
body.dark-mode .byte-result-summary {
    background: rgba(17, 24, 39, 0.58);
    color: #e5e7eb;
    border-color: rgba(94, 200, 170, 0.18);
}

body.dark-mode .byte-choice input:checked + span {
    background: rgba(94, 200, 170, 0.14);
    border-color: rgba(94, 200, 170, 0.46);
    color: #a7f3d0;
}

@media (max-width: 900px) {
    .byte-modal-card {
        grid-template-columns: 1fr;
        max-height: 92vh;
    }

    .byte-panel-left {
        padding: 1.5rem;
    }

    .byte-panel-left p,
    .byte-mini-steps {
        display: none;
    }

    .byte-panel-left h2 {
        font-size: 1.75rem;
        margin-bottom: 0;
    }

    .byte-panel-right {
        padding: 1.45rem;
    }
}

@media (max-width: 620px) {
    .byte-launcher {
        left: 1rem;
        bottom: 1rem;
        width: 56px;
        height: 56px;
    }

    .byte-nudge {
        left: 1rem;
        bottom: 4.9rem;
        width: calc(100vw - 2rem);
    }

    .byte-choice-grid {
        grid-template-columns: 1fr;
    }

    .byte-form-actions,
    .byte-result-actions,
    .byte-nudge-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .byte-rec-card {
        grid-template-columns: 46px 1fr;
    }

    .byte-rec-card .byte-btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .byte-rec-img {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }
}


/* =========================================================
   AJUSTE V13.1 - MODAL BYTE CON SCROLL INTERNO
   Evita que los resultados queden cortados en pantallas medianas.
   ========================================================= */
.byte-modal-card {
    height: min(92vh, 880px);
    max-height: min(92vh, 880px);
    min-height: 0;
}

.byte-panel-left,
.byte-panel-right {
    min-height: 0;
}

.byte-panel-right {
    max-height: min(92vh, 880px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(46, 94, 85, 0.42) rgba(46, 94, 85, 0.08);
    padding-bottom: 2.4rem;
}

.byte-panel-right::-webkit-scrollbar {
    width: 9px;
}

.byte-panel-right::-webkit-scrollbar-track {
    background: rgba(46, 94, 85, 0.06);
    border-radius: 999px;
}

.byte-panel-right::-webkit-scrollbar-thumb {
    background: rgba(46, 94, 85, 0.36);
    border-radius: 999px;
}

.byte-results {
    scroll-margin-top: 1rem;
}

@media (max-width: 900px) {
    .byte-modal-card {
        height: 92vh;
        max-height: 92vh;
        overflow-y: auto;
        display: block;
    }

    .byte-panel-right {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 620px) {
    .byte-modal {
        padding: 0.75rem;
    }

    .byte-modal-card {
        height: 94vh;
        max-height: 94vh;
        border-radius: 1.45rem;
    }
}

/* Icono visual de Byte */
.byte-launcher,
.byte-avatar,
.byte-modal-avatar {
    overflow: hidden;
}

.byte-icon-img {
    display: block;
    width: 68%;
    height: 68%;
    object-fit: contain;
}

.byte-avatar .byte-icon-img {
    width: 72%;
    height: 72%;
}

.byte-modal-avatar .byte-icon-img {
    width: 74%;
    height: 74%;
}

