/* ========================================================================== *
 *  CHATBOT / COPILOTO — estilo visual replicado del Copiloto de Cantera       *
 *  Navy #0d3b66 · shell con gradiente · hilo de burbujas · panel de ejemplos  *
 * ========================================================================== */
.copilot-shell {
    max-width: 1160px;
    margin: 0 auto;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
    border: 1px solid #dbe4f0;
    border-radius: 28px;
    box-shadow: 0 20px 45px rgba(13, 59, 102, 0.12);
    overflow: hidden;
}

.copilot-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 28px 18px;
    border-bottom: 1px solid rgba(13, 59, 102, 0.08);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(10px);
}

.copilot-title-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.copilot-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #0d3b66;
    color: white;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.copilot-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.copilot-topnote {
    font-size: 13px;
    color: #64748b;
    text-align: right;
}

.copilot-thread {
    min-height: 480px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}

.copilot-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.copilot-row-user { justify-content: flex-end; }
.copilot-row-assistant { justify-content: flex-start; }

.copilot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    flex: 0 0 36px;
}

.copilot-avatar-user {
    background: #0d3b66;
    color: white;
}

.copilot-avatar-assistant {
    background: #e2ecf8;
    color: #0d3b66;
    border: 1px solid #c8d8eb;
}

.copilot-bubble {
    max-width: min(820px, 82%);
    padding: 16px 18px;
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(13, 59, 102, 0.08);
}

.copilot-bubble-user {
    background: #0d3b66;
    color: white;
    border-bottom-right-radius: 8px;
}

.copilot-bubble-assistant {
    background: rgba(255, 255, 255, 0.98);
    color: #111827;
    border: 1px solid #dbe4f0;
    border-bottom-left-radius: 8px;
}

.copilot-bubble-pending { background: rgba(255, 255, 255, 0.92); }

.copilot-meta {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.72;
}

/* --- Tarjetas de jugador (cuando el backend las devuelve) --- */
.copilot-player-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.copilot-player-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
    border: 1px solid #d8e5f3;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.copilot-player-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(13, 59, 102, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
}

.copilot-player-photo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    background: #dbe4f0;
}

.copilot-player-text { display: flex; flex-direction: column; gap: 2px; }
.copilot-player-name { font-size: 13px; font-weight: 700; color: #0f172a; }
.copilot-player-subtitle { font-size: 12px; color: #64748b; }

/* --- Markdown de las respuestas --- */
.copilot-markdown > div > *:first-child { margin-top: 0; }
.copilot-markdown > div > *:last-child { margin-bottom: 0; }
.copilot-markdown p,
.copilot-markdown ul,
.copilot-markdown ol { margin-bottom: 0.75rem; }
.copilot-markdown a { color: #0d3b66; font-weight: 600; }

.copilot-markdown table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    margin: 4px 0 10px;
    display: block;
    overflow-x: auto;
}
.copilot-markdown th,
.copilot-markdown td {
    border: 1px solid #e2e8f0;
    padding: 6px 9px;
    text-align: left;
    white-space: nowrap;
}
.copilot-markdown th {
    background: #eef4fb;
    color: #0d3b66;
    font-weight: 700;
}
.copilot-markdown tr:nth-child(even) td { background: #f8fbff; }

/* --- Opciones de aclaración (botones pulsables bajo la pregunta del Copiloto) --- */
.copilot-options-wrap { margin-top: 14px; }

.copilot-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.copilot-option-btn {
    border: 1px solid #0d3b66;
    background: rgba(13, 59, 102, 0.06);
    color: #0d3b66;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.copilot-option-btn:hover {
    background: #0d3b66;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(13, 59, 102, 0.18);
}

.copilot-option-btn:active { transform: translateY(0); }

.copilot-options-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
    font-style: italic;
}

/* --- Indicador "Pensando…" --- */
.copilot-typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    color: #475569;
}
.copilot-typing-label { font-size: 14px; }
.copilot-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0d3b66;
    opacity: 0.3;
    animation: copilot-pulse 1.2s infinite ease-in-out;
}
.copilot-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.copilot-typing-dot:nth-child(3) { animation-delay: 0.3s; }
.copilot-typing-dot:nth-child(4) { animation-delay: 0.45s; }

/* --- Panel de ejemplos --- */
.copilot-suggestions { padding: 0 28px 18px; }

.copilot-suggestions-panel {
    border: 1px solid #dbe4f0;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 24px;
    padding: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.copilot-suggestions-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0d3b66;
}

.copilot-suggestions-subtitle {
    margin-top: 6px;
    font-size: 13px;
    color: #64748b;
}

.copilot-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.copilot-suggestion-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: 1px solid #c9d8ea;
    background: rgba(255, 255, 255, 0.92);
    color: #0d3b66;
    border-radius: 20px;
    padding: 14px 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copilot-suggestion-btn:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(13, 59, 102, 0.08);
}

.copilot-suggestion-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0d3b66;
    opacity: 0.78;
}

.copilot-suggestion-template {
    font-size: 14px;
    line-height: 1.45;
    font-weight: 700;
    color: #0f172a;
}

/* --- Compositor --- */
.copilot-composer { padding: 0 22px 22px; }

.copilot-composer-box {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #dbe4f0;
    border-radius: 24px;
    padding: 12px 14px 14px;
    box-shadow: 0 10px 24px rgba(13, 59, 102, 0.06);
}

.copilot-composer-box:focus-within {
    border-color: #9db8d6;
    box-shadow: 0 0 0 4px rgba(13, 59, 102, 0.08);
}

.copilot-textarea {
    width: 100%;
    min-height: 58px;
    max-height: 220px;
    padding: 8px 4px;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 1.55;
    color: #0f172a;
    background: transparent;
    font-family: inherit;
}

.copilot-textarea::placeholder { color: #94a3b8; }

.copilot-compose-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.copilot-hint { font-size: 12px; color: #64748b; }

.copilot-send-btn {
    background-color: #0d3b66;
    color: #fff;
    border: 1px solid #0d3b66;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    min-width: 116px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.copilot-send-btn:hover { background-color: #0f4a80; transform: translateY(-1px); }
.copilot-send-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

@keyframes copilot-pulse {
    0%, 80%, 100% { transform: scale(0.85); opacity: 0.25; }
    40% { transform: scale(1); opacity: 0.8; }
}

@media (max-width: 768px) {
    .copilot-topbar { flex-direction: column; align-items: flex-start; }
    .copilot-title-block { flex-wrap: wrap; }
    .copilot-thread { padding: 20px 16px; max-height: none; }
    .copilot-bubble { max-width: 100%; }
    .copilot-suggestions { padding: 0 16px 16px; }
    .copilot-composer { padding: 0 16px 16px; }
    .copilot-compose-actions { flex-direction: column; align-items: stretch; }
}
