/* app/assets/css/coach.css — Workfit Coach (tarea #30)
   Marca Workfit: azul noche + lima, tipografía Inter. Objetivos táctiles ≥ 44 px. */

:root {
    --wfc-bg: #262E3D;
    --wfc-bg-2: #1E2532;
    --wfc-card: rgba(255, 255, 255, 0.06);
    --wfc-borde: rgba(235, 248, 164, 0.18);
    --wfc-lima: #C2F858;
    --wfc-lima-suave: #EBF8A4;
    --wfc-texto: #FFFFFF;
    --wfc-texto-2: #CBD5E1;
    --wfc-texto-3: #94A3B8;
    --wfc-tinta: #1E2532;
    --wfc-error: #FCA5A5;
}

/* ---------- Botón flotante ---------- */
.wfc-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--wfc-lima);
    color: var(--wfc-tinta);
    font: 700 15px/1 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(194, 248, 88, 0.18);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.wfc-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4), 0 0 0 6px rgba(194, 248, 88, 0.22); }
.wfc-fab-ico { font-size: 18px; line-height: 1; }

.wfc-fab:focus-visible,
.wfc-panel :focus-visible {
    outline: 3px solid var(--wfc-lima-suave);
    outline-offset: 2px;
}

/* ---------- Panel ---------- */
.wfc-panel {
    position: fixed;
    right: 20px;
    bottom: 84px;
    z-index: 9001;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: min(640px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: var(--wfc-bg-2);
    color: var(--wfc-texto);
    border: 1px solid var(--wfc-borde);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.wfc-panel[hidden] { display: none; }
.wfc-panel--abierto { opacity: 1; transform: none; }

.wfc-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 12px 12px 18px;
    background: var(--wfc-bg);
    border-bottom: 1px solid var(--wfc-borde);
}
.wfc-titulo { margin: 0; font-size: 17px; font-weight: 800; color: var(--wfc-lima); line-height: 1.2; }
.wfc-subtitulo { margin: 2px 0 0; font-size: 12px; color: var(--wfc-texto-3); }
.wfc-acciones { display: flex; gap: 6px; }
.wfc-btn-icono {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--wfc-borde);
    background: transparent;
    color: var(--wfc-texto);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.wfc-btn-icono:hover { background: var(--wfc-card); }

/* ---------- Mensajes ---------- */
.wfc-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
}
.wfc-bienvenida { display: flex; flex-direction: column; gap: 10px; }

.wfc-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.wfc-msg p { margin: 0 0 6px; }
.wfc-msg p:last-child { margin-bottom: 0; }
.wfc-msg--user {
    align-self: flex-end;
    background: var(--wfc-lima);
    color: var(--wfc-tinta);
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}
.wfc-msg--assistant {
    align-self: flex-start;
    background: var(--wfc-card);
    border: 1px solid var(--wfc-borde);
    color: var(--wfc-texto);
    border-bottom-left-radius: 4px;
}
.wfc-msg--assistant strong { color: var(--wfc-lima-suave); font-weight: 700; }
.wfc-lista { margin: 4px 0 6px 18px; padding: 0; }
.wfc-lista li { margin: 2px 0; }
ul.wfc-lista { list-style: disc; }
ol.wfc-lista { list-style: decimal; }
.wfc-msg--error {
    align-self: stretch;
    max-width: 100%;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--wfc-error);
}

/* ---------- Sugerencias ---------- */
.wfc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wfc-chip {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--wfc-borde);
    background: transparent;
    color: var(--wfc-lima-suave);
    font: 600 13px 'Inter', sans-serif;
    cursor: pointer;
}
.wfc-chip:hover { background: var(--wfc-card); border-color: var(--wfc-lima-suave); }

/* ---------- Escribiendo ---------- */
.wfc-escribiendo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px 8px;
    font-size: 13px;
    color: var(--wfc-texto-3);
}
.wfc-escribiendo[hidden] { display: none; }
.wfc-puntos { display: inline-flex; gap: 3px; }
.wfc-puntos span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--wfc-lima);
    animation: wfc-bote 1s infinite ease-in-out;
}
.wfc-puntos span:nth-child(2) { animation-delay: 0.15s; }
.wfc-puntos span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wfc-bote {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- Formulario ---------- */
.wfc-formulario {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--wfc-borde);
    background: var(--wfc-bg);
}
.wfc-entrada {
    flex: 1;
    min-height: 44px;
    max-height: 140px;
    resize: none;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid var(--wfc-borde);
    background: var(--wfc-bg-2);
    color: var(--wfc-texto);
    font: 14px/1.4 'Inter', sans-serif;
}
.wfc-entrada::placeholder { color: var(--wfc-texto-3); }
.wfc-enviar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 0;
    border-radius: 14px;
    background: var(--wfc-lima);
    color: var(--wfc-tinta);
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
}
.wfc-enviar:disabled,
.wfc-chip:disabled,
.wfc-boton:disabled,
.wfc-btn-icono:disabled { opacity: 0.5; cursor: not-allowed; }
.wfc-contador {
    padding: 0 14px 8px;
    font-size: 12px;
    color: var(--wfc-texto-3);
    text-align: right;
    background: var(--wfc-bg);
}
.wfc-contador[hidden] { display: none; }

/* ---------- Tarjeta de borrador ---------- */
.wfc-borrador {
    align-self: stretch;
    padding: 14px;
    border-radius: 16px;
    background: rgba(194, 248, 88, 0.06);
    border: 1px solid var(--wfc-lima);
}
.wfc-borrador-etiqueta {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--wfc-texto-3);
}
.wfc-borrador-titulo { margin: 0 0 4px; font-size: 16px; font-weight: 800; color: var(--wfc-lima); }
.wfc-borrador-meta { margin: 0 0 8px; font-size: 12px; color: var(--wfc-texto-2); }
.wfc-borrador-desc { margin: 0 0 8px; font-size: 13px; color: var(--wfc-texto-2); }
.wfc-borrador-estado { margin: 0; font-size: 13px; color: var(--wfc-texto-3); }
.wfc-ejercicios { list-style: none; margin: 0 0 12px; padding: 0; }
.wfc-ejercicio {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.wfc-ejercicio-num {
    flex: 0 0 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--wfc-lima-suave);
    color: var(--wfc-tinta);
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wfc-ejercicio-datos { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wfc-ejercicio-nombre { font-size: 14px; font-weight: 600; color: var(--wfc-texto); }
.wfc-ejercicio-pauta { font-size: 12px; color: var(--wfc-texto-2); }
.wfc-ejercicio-nota { font-size: 12px; color: var(--wfc-texto-3); font-style: italic; }
.wfc-borrador-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.wfc-boton {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--wfc-borde);
    background: transparent;
    color: var(--wfc-texto);
    font: 700 14px 'Inter', sans-serif;
    cursor: pointer;
}
.wfc-boton:hover { background: var(--wfc-card); }
.wfc-boton--primario { background: var(--wfc-lima); border-color: var(--wfc-lima); color: var(--wfc-tinta); }
.wfc-boton--primario:hover { background: var(--wfc-lima-suave); }

.wfc-guardada { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wfc-guardada-texto { font-size: 14px; font-weight: 700; color: var(--wfc-lima); }
.wfc-enlace {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    background: var(--wfc-lima);
    color: var(--wfc-tinta);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
.wfc-enlace:hover { background: var(--wfc-lima-suave); }

/* ---------- Solo lectores de pantalla ---------- */
.wfc-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Móvil: pantalla completa ---------- */
@media (max-width: 640px) {
    .wfc-fab { right: 16px; bottom: 16px; }
    .wfc-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }
    .wfc-msg { max-width: 92%; }
    body.wfc-abierto { overflow: hidden; }
    body.wfc-abierto .wfc-fab { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .wfc-panel,
    .wfc-fab { transition: none; }
    .wfc-puntos span { animation: none; }
}
