/* ═══════════════════════════════════════════════════════════════════════════
   🧬 GAJE Helix — static/css/messages.css
   Burbujas de Chat, Renderizado de Respuestas, Bloques de Código y CoT Box
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── MENSAJES (APPLE HIG + Y2K) ── */
.message {
    max-width: 86%;
    min-width: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.91rem;
    line-height: 1.48;
    position: relative;
    word-break: break-word;
    overflow-wrap: anywhere;
    animation: fadeInSlide 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Burbuja de Usuario (Apple iMessage + Y2K Cyberpunk Glass — Micro Layout) */
.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.2) 0%, rgba(94, 92, 230, 0.14) 100%);
    border: 1px solid rgba(10, 132, 255, 0.35);
    border-right: 3.5px solid var(--accent, #0a84ff);
    border-radius: 14px 14px 4px 14px;
    color: #f1f5f9;
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow: 0 4px 20px rgba(10, 132, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.35rem 0.75rem 0.25rem 0.8rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.user-msg-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-msg-content p,
.msg-content p {
    color: inherit;
    margin: 0;
    font-size: 0.91rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.user-msg-footer {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 1px;
    align-self: flex-end;
    user-select: none;
}

.user-msg-time {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.2px;
    line-height: 1;
}

.user-msg-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.message.user:hover .user-msg-actions {
    opacity: 1;
}

.user-msg-action-btn,
.user-action-btn {
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 1px 3px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.65);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.user-msg-action-btn svg,
.user-action-btn svg {
    width: 11px;
    height: 11px;
}

.user-msg-action-btn:hover,
.user-action-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
}

[data-theme="light"] .message.user {
    background: #ffffff !important;
    border: 1px solid rgba(44, 82, 52, 0.18) !important;
    border-right: 4px solid #0a84ff !important;
    border-radius: 0px !important;
    color: var(--text) !important;
    box-shadow: 0 3px 12px rgba(44, 53, 57, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
    padding: 0.35rem 0.75rem 0.25rem 0.8rem;
}

[data-theme="light"] .user-msg-time {
    color: #64748b !important;
}

[data-theme="light"] .user-msg-action-btn,
[data-theme="light"] .user-action-btn {
    color: #2c5234 !important;
    border-radius: 0px !important;
}

[data-theme="light"] .user-msg-action-btn:hover,
[data-theme="light"] .user-action-btn:hover {
    background: rgba(44, 82, 52, 0.1) !important;
    color: #1a301f !important;
}

[data-theme="light"] .msg-user-content p,
[data-theme="light"] .user-content p {
    color: #1e293b !important;
    font-size: 0.91rem;
    line-height: 1.45;
}

/* Burbuja del Asistente (Apple HIG Glassmorphism + Neon Accent) */
.message.bot {
    align-self: flex-start;
    background: rgba(24, 26, 40, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3.5px solid var(--accent-2);
    border-radius: 16px 16px 16px 5px;
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.45rem 0.85rem;
}

/* Cabecera Semántica del Mensaje (Header Component) */
.msg-header,
.bot-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.18rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.1rem;
}

.msg-author,
.bot-author {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.msg-avatar-icon,
.bot-author-icon {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.2), rgba(94, 92, 230, 0.2));
    border: 1px solid rgba(10, 132, 255, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

.msg-author-name,
.bot-author-title {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-color);
    letter-spacing: 0.2px;
}

.msg-model-tag,
.bot-model-chip {
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.25);
    color: #c4b5fd;
}

.msg-timestamp,
.bot-timestamp {
    font-family: var(--mono);
    font-size: 0.62rem;
    color: var(--text-muted);
}

[data-theme="light"] .message.bot {
    background: #ffffff;
    border: 1px solid rgba(44, 82, 52, 0.16);
    border-left: 4px solid var(--accent);
    color: var(--text);
    box-shadow: 0 4px 16px rgba(44, 53, 57, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-radius: 0px !important;
    position: relative;
    padding: 0.45rem 0.85rem;
}

[data-theme="light"] .msg-header,
[data-theme="light"] .bot-card-header {
    border-bottom-color: rgba(44, 82, 52, 0.1);
}

[data-theme="light"] .msg-avatar-icon,
[data-theme="light"] .bot-author-icon {
    background: rgba(44, 82, 52, 0.08);
    border-color: rgba(44, 82, 52, 0.25);
    color: var(--accent);
    border-radius: 0px !important;
}

[data-theme="light"] .msg-model-tag,
[data-theme="light"] .bot-model-chip {
    background: rgba(44, 82, 52, 0.08);
    border-color: rgba(44, 82, 52, 0.2);
    color: var(--accent);
    border-radius: 0px !important;
}

[data-theme="light"] .msg-timestamp,
[data-theme="light"] .bot-timestamp {
    color: var(--muted);
}

/* Tipografía de Markdown en respuestas */
.response-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.91rem;
    line-height: 1.48;
    color: var(--text-color);
    min-width: 0;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.response-body p {
    margin: 0;
}

.response-body ul,
.response-body ol {
    margin: 0.2rem 0;
    padding-left: 1.25rem;
}

.response-body li {
    margin-bottom: 0.12rem;
}

[data-theme="light"] .response-body {
    color: var(--text);
}

.md-heading {
    margin-top: 0.35rem;
    margin-bottom: 0.12rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.2px;
}

h1.md-heading { font-size: 1.2rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 3px; }
h2.md-heading { font-size: 1.05rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06); padding-bottom: 2px; }
h3.md-heading { font-size: 0.98rem; color: var(--accent-2); }
h4.md-heading { font-size: 0.9rem; color: var(--text-muted); }

[data-theme="light"] .md-heading { color: #1a1a1a; }
[data-theme="light"] h3.md-heading { color: var(--accent); }
[data-theme="light"] h1.md-heading,
[data-theme="light"] h2.md-heading { border-bottom-color: rgba(44, 82, 52, 0.12); }

.md-quote {
    border-left: 3px solid var(--accent-2);
    padding: 0.4rem 0.8rem;
    margin: 0.4rem 0;
    background: rgba(255, 255, 255, 0.025);
    border-radius: 0 6px 6px 0;
    color: var(--text-muted);
    font-style: italic;
}

[data-theme="light"] .md-quote {
    border-left-color: var(--accent);
    background: rgba(44, 82, 52, 0.04);
    border-radius: 0px !important;
}

/* Mensaje del Sistema (Holograma Cyberpunk) */
.message.system {
    align-self: center;
    background: linear-gradient(135deg, rgba(94, 92, 230, 0.12), rgba(0, 242, 254, 0.08));
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: 14px;
    color: var(--text-color);
    font-family: var(--mono);
    font-size: 0.76rem;
    width: 98%;
    padding: 0.75rem 1.1rem;
    text-align: left;
    box-shadow: 0 0 16px rgba(0, 242, 254, 0.12);
}

[data-theme="light"] .message.system {
    background: linear-gradient(135deg, rgba(44, 82, 52, 0.06), rgba(44, 53, 57, 0.04));
    border: 1px solid rgba(44, 82, 52, 0.22);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(44, 82, 52, 0.04);
}

.message.system::before {
    content: "🧬 SYSTEM_CORE ::";
    display: block;
    font-weight: 700;
    color: #00F2FE;
    margin-bottom: 4px;
    font-size: 0.68rem;
    letter-spacing: 1.2px;
}

[data-theme="light"] .message.system::before {
    color: var(--accent);
}

/* Metadatos del mensaje (Minimalist Micro-Tags) */
.message-meta {
    margin-top: 0.45rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted);
    font-family: var(--mono);
    flex-wrap: wrap;
}

/* Pie Semántico de Telemetría y Acciones (Footer Component) */
.msg-footer,
.message-meta {
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.msg-telemetry {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.telemetry-pill,
.meta-badge,
.meta-tag {
    background: rgba(255, 255, 255, 0.035);
    padding: 0.1rem 0.4rem;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.62rem;
    font-family: var(--mono);
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1.25;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.telemetry-pill svg,
.meta-badge svg,
.meta-tag svg {
    width: 10px;
    height: 10px;
}

.telemetry-pill:hover,
.meta-badge:hover,
.meta-tag:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
}

.telemetry-pill.pill-latency,
.telemetry-pill.pill-timer {
    border-color: rgba(56, 189, 248, 0.25);
    color: #93c5fd;
    background: rgba(56, 189, 248, 0.06);
    font-feature-settings: "tnum" 1, "zero" 1;
}

.telemetry-pill.pill-timer.live {
    border-color: rgba(10, 132, 255, 0.55);
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.16), rgba(94, 92, 230, 0.12));
    color: #60a5fa;
    animation: livePulseGlow 1.4s ease-in-out infinite;
}

.telemetry-pill.pill-timer.live svg {
    animation: liveClockTick 1s steps(1) infinite;
}

@keyframes livePulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(10, 132, 255, 0);
        border-color: rgba(10, 132, 255, 0.35);
    }
    50% {
        box-shadow: 0 0 8px 1px rgba(10, 132, 255, 0.3);
        border-color: rgba(10, 132, 255, 0.75);
    }
}

@keyframes liveClockTick {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(0.92); }
}

[data-theme="light"] .telemetry-pill.pill-timer.live {
    background: #edf7ef !important;
    border-color: #2c5234 !important;
    color: #2c5234 !important;
    box-shadow: 0 0 6px rgba(44, 82, 52, 0.18) !important;
}

.telemetry-pill .timer-display {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.telemetry-pill.pill-speed {
    border-color: rgba(251, 191, 36, 0.25);
    color: #fde047;
    background: rgba(251, 191, 36, 0.06);
}

.telemetry-pill.pill-compression {
    border-color: rgba(167, 139, 250, 0.25);
    color: #c4b5fd;
    background: rgba(167, 139, 250, 0.06);
}

.telemetry-pill.pill-memory {
    border-color: rgba(48, 209, 88, 0.25);
    color: #86efac;
    background: rgba(48, 209, 88, 0.06);
}

.telemetry-pill.pill-ppl {
    border-color: rgba(244, 114, 182, 0.25);
    color: #f472b6;
    background: rgba(244, 114, 182, 0.06);
}

.msg-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.msg-action-btn,
.meta-copy-btn,
.meta-btn-copy {
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.65);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--sans);
    font-weight: 600;
}

.msg-action-btn svg,
.meta-copy-btn svg,
.meta-btn-copy svg {
    width: 11px;
    height: 11px;
}

.msg-action-btn:hover,
.meta-copy-btn:hover,
.meta-btn-copy:hover {
    background: rgba(10, 132, 255, 0.15);
    border-color: var(--accent-color);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.25);
}

[data-theme="light"] .msg-footer,
[data-theme="light"] .message-meta {
    border-top-color: rgba(44, 82, 52, 0.1);
}

[data-theme="light"] .telemetry-pill,
[data-theme="light"] .meta-badge,
[data-theme="light"] .meta-tag {
    background: #fbfaf8;
    border-color: rgba(44, 82, 52, 0.18);
    color: var(--text);
    border-radius: 0px !important;
}

[data-theme="light"] .telemetry-pill:hover,
[data-theme="light"] .meta-badge:hover,
[data-theme="light"] .meta-tag:hover {
    background: #ffffff;
    border-color: var(--accent);
    color: var(--accent);
}

[data-theme="light"] .msg-action-btn,
[data-theme="light"] .meta-copy-btn,
[data-theme="light"] .meta-btn-copy {
    background: #ffffff;
    border-color: rgba(44, 82, 52, 0.2);
    color: var(--text);
    border-radius: 0px !important;
}

[data-theme="light"] .msg-action-btn:hover,
[data-theme="light"] .meta-copy-btn:hover,
[data-theme="light"] .meta-btn-copy:hover {
    background: rgba(44, 82, 52, 0.08);
    border-color: var(--accent);
    color: var(--accent);
}

.meta-badge.meta-copy-btn.copied {
    border-color: #30d158;
    background: rgba(48, 209, 88, 0.15);
    color: #30d158;
}

/* ── BOT MESSAGE FOOTER STOP BUTTON (ZONA DE COPIAR) ── */
.msg-action-btn.msg-stop-btn,
.msg-header-stop-btn {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.65rem;
    font-family: var(--sans);
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 6px;
    background: rgba(255, 69, 58, 0.15);
    border: 1px solid rgba(255, 69, 58, 0.45);
    color: #ff453a;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.1), inset -1px -1px 0 rgba(0, 0, 0, 0.2);
}

.msg-action-btn.msg-stop-btn:hover,
.msg-header-stop-btn:hover {
    background: rgba(255, 69, 58, 0.3);
    border-color: #ff453a;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(255, 69, 58, 0.4);
    transform: translateY(-1px);
}

.msg-action-btn.msg-stop-btn:active,
.msg-header-stop-btn:active {
    transform: translateY(1px);
    box-shadow: inset -1px -1px 0 rgba(255, 255, 255, 0.1), inset 1px 1px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .msg-action-btn.msg-stop-btn,
[data-theme="light"] .msg-header-stop-btn {
    background: rgba(185, 28, 28, 0.08);
    border: 1px solid rgba(185, 28, 28, 0.35);
    color: #b91c1c;
    border-radius: 0px !important;
    box-shadow: none;
}

[data-theme="light"] .msg-action-btn.msg-stop-btn:hover,
[data-theme="light"] .msg-header-stop-btn:hover {
    background: #b91c1c;
    color: #ffffff;
    border-color: #b91c1c;
    box-shadow: 0 2px 6px rgba(185, 28, 28, 0.25);
}

/* ── DATA USAGE & DOWNLOAD ALERT BANNER ── */
.data-usage-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0.7rem 0.9rem;
    margin: 0.4rem 0 0.6rem 0;
    border-radius: 10px;
    background: rgba(255, 159, 10, 0.08);
    border: 1px solid rgba(255, 159, 10, 0.35);
    box-shadow: 0 4px 16px rgba(255, 159, 10, 0.08);
    animation: fadeInAlert 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.data-usage-alert.completed {
    background: rgba(48, 209, 88, 0.08);
    border-color: rgba(48, 209, 88, 0.35);
    box-shadow: 0 4px 16px rgba(48, 209, 88, 0.08);
}

.data-usage-alert.fade-out {
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.45s ease, padding 0.45s ease, margin 0.45s ease;
}

.data-alert-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ff9f0a;
}

.data-usage-alert.completed .data-alert-icon {
    color: #30d158;
}

.data-alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.data-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.data-alert-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #ff9f0a;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.data-usage-alert.completed .data-alert-title {
    color: #30d158;
}

.data-alert-badge {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 159, 10, 0.18);
    border: 1px solid rgba(255, 159, 10, 0.4);
    color: #ffd60a;
    text-transform: uppercase;
}

.data-usage-alert.completed .data-alert-badge {
    background: rgba(48, 209, 88, 0.18);
    border-color: rgba(48, 209, 88, 0.4);
    color: #86efac;
}

.data-alert-text {
    font-size: 0.74rem;
    color: var(--text-color);
    line-height: 1.45;
    margin: 0;
}

.data-alert-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.data-alert-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff9f0a, #ffd60a);
    transition: width 0.15s ease-out;
}

.data-usage-alert.completed .data-alert-progress-bar {
    background: #30d158;
}

.data-alert-stats {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

[data-theme="light"] .data-usage-alert {
    background: #fffbf5;
    border: 1px solid rgba(180, 83, 9, 0.3);
    border-radius: 0px !important;
    box-shadow: 0 2px 6px rgba(180, 83, 9, 0.05);
}

[data-theme="light"] .data-usage-alert.completed {
    background: #f4fbf5;
    border-color: rgba(44, 82, 52, 0.3);
}

[data-theme="light"] .data-alert-title {
    color: #b45309;
}

[data-theme="light"] .data-usage-alert.completed .data-alert-title {
    color: #2c5234;
}

[data-theme="light"] .data-alert-badge {
    background: rgba(180, 83, 9, 0.1);
    border-color: rgba(180, 83, 9, 0.25);
    color: #b45309;
    border-radius: 0px !important;
}

[data-theme="light"] .data-usage-alert.completed .data-alert-badge {
    background: rgba(44, 82, 52, 0.1);
    border-color: rgba(44, 82, 52, 0.25);
    color: #2c5234;
}

[data-theme="light"] .data-alert-text {
    color: var(--text);
}

[data-theme="light"] .data-alert-progress-track {
    background: rgba(44, 82, 52, 0.1);
    border-radius: 0px !important;
}

[data-theme="light"] .data-alert-progress-bar {
    background: linear-gradient(90deg, #b45309, #d97706);
    border-radius: 0px !important;
}

[data-theme="light"] .data-usage-alert.completed .data-alert-progress-bar {
    background: #2c5234;
}

@keyframes fadeInAlert {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── INPUT COMPOSER AREA (FLOATING APPLE DOCK) ── */
.input-area {
    padding: 0.65rem 0.9rem 0.55rem 1.1rem;
    margin: 0 1.5rem 1.25rem 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: rgba(22, 25, 38, 0.78);
    backdrop-filter: blur(36px) saturate(190%);
    -webkit-backdrop-filter: blur(36px) saturate(190%);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 980px;
    width: calc(100% - 3rem);
    align-self: center;
}

.composer-main-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
}

.composer-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0.2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

[data-theme="light"] .composer-meta-bar {
    border-top-color: rgba(44, 82, 52, 0.1);
}

.keycap {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 0.62rem;
    font-family: var(--mono);
    color: var(--text-color);
}

[data-theme="light"] .keycap {
    background: #f0eee9;
    border-color: rgba(44, 82, 52, 0.2);
    color: var(--text);
    border-radius: 0px !important;
}

.composer-stats {
    display: flex;
    align-items: center;
    gap: 6px;
}

.composer-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 600;
    color: #c4b5fd;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.25);
    padding: 1px 6px;
    border-radius: 4px;
}

[data-theme="light"] .composer-model-badge {
    border-radius: 0px !important;
    background: rgba(44, 82, 52, 0.08);
    border-color: rgba(44, 82, 52, 0.22);
    color: #2c5234;
}

.composer-status-badge {
    color: var(--neon-cyan);
    display: inline-flex;
    align-items: center;
}

[data-theme="light"] .composer-status-badge {
    color: var(--accent);
}

[data-theme="light"] .input-area {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(44, 82, 52, 0.2);
    box-shadow: 0 6px 24px rgba(44, 53, 57, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .input-area:focus-within {
    border-color: var(--accent);
    box-shadow: 0 8px 28px rgba(44, 53, 57, 0.08), 0 0 0 2.5px var(--accent-glow);
}

.input-area:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 2.5px var(--accent-glow), 0 0 24px rgba(10, 132, 255, 0.3);
}

textarea#user-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.45rem 0.2rem;
    color: var(--text-color);
    font-family: var(--sans);
    font-size: 0.94rem;
    line-height: 1.5;
    outline: none;
    box-shadow: none;
    resize: none;
    max-height: 160px;
    min-height: 24px;
    scrollbar-width: thin;
}

[data-theme="light"] textarea#user-input {
    color: var(--text);
}

textarea#user-input::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

.composer-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
}

button#send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(10, 132, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

button#send-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    color: var(--text-muted) !important;
    transform: none !important;
}

button#send-btn:hover:not(:disabled) {
    transform: scale(1.06) translateY(-1px);
    box-shadow: 0 6px 22px rgba(10, 132, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    filter: brightness(1.12);
}

button#send-btn:active:not(:disabled) {
    transform: scale(0.94) translateY(1px);
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.35);
}

.send-icon,
button#send-btn .send-icon,
button#send-btn .y2k-icon,
button#send-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor !important;
    stroke: none !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

button#send-btn:not(:disabled) .send-icon,
button#send-btn:not(:disabled) .y2k-icon,
button#send-btn:not(:disabled) svg {
    color: #ffffff !important;
    fill: #ffffff !important;
}

button#send-btn:hover:not(:disabled) .send-icon {
    transform: translate(2px, -2px) rotate(-8deg) scale(1.08);
}

[data-theme="light"] button#send-btn {
    background: #2c5234;
    color: #ffffff !important;
    border: 1px solid #1e3a24;
    box-shadow: 2px 2px 0px rgba(44, 82, 52, 0.35);
    border-radius: 0px !important;
}

[data-theme="light"] button#send-btn:not(:disabled) .send-icon,
[data-theme="light"] button#send-btn:not(:disabled) .y2k-icon,
[data-theme="light"] button#send-btn:not(:disabled) svg {
    color: #ffffff !important;
    fill: #ffffff !important;
}

[data-theme="light"] button#send-btn:disabled {
    opacity: 0.4;
    background: #e8e6e2;
    border: 1px solid #d4d1cb;
    color: #9e9a93 !important;
    box-shadow: none;
    transform: none !important;
}

[data-theme="light"] button#send-btn:hover:not(:disabled) {
    background: #376541;
    border-color: #23432a;
    box-shadow: 3px 3px 0px rgba(44, 82, 52, 0.45);
    transform: translate(-1px, -1px);
    filter: none;
}

[data-theme="light"] button#send-btn:active:not(:disabled) {
    background: #23432a;
    box-shadow: 0px 0px 0px rgba(44, 82, 52, 0.4);
    transform: translate(1px, 1px);
}

.stop-btn {
    background: rgba(255, 69, 58, 0.15);
    border: 1px solid rgba(255, 69, 58, 0.5);
    color: var(--red);
    box-shadow: 0 0 12px rgba(255, 69, 58, 0.25);
    animation: pulseStop 1.5s infinite;
}

[data-theme="light"] .stop-btn {
    background: rgba(185, 28, 28, 0.12);
    border-color: #b91c1c;
    color: #b91c1c;
    border-radius: 0px !important;
}

.stop-btn:hover {
    background: rgba(255, 69, 58, 0.3);
    border-color: var(--red);
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(255, 69, 58, 0.5);
}

@keyframes pulseStop {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.98); }
}

.stop-btn[hidden] { display: none; }


/* ── BLOQUES DE CÓDIGO & PENSAMIENTO (CoT) ── */
/* Código / macOS Terminal Block & Wrappers */
.code-block-wrapper {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    margin: 0.4rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(12, 14, 24, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.code-block-wrapper pre,
.response-body pre,
.msg-content pre,
.code-block {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.55rem 0.8rem;
    margin: 0;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--text-color);
    text-align: left;
    white-space: pre;
    word-break: normal;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.68rem;
    font-family: var(--mono);
    color: var(--text-muted);
}

.code-lang {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-color);
}

.code-copy-btn {
    cursor: pointer;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.65rem;
    font-family: var(--sans);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.code-copy-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Reglas Escandinavas (y2k-light) — Estricto 0px border-radius según AGENTS.md */
[data-theme="light"] .code-block-wrapper,
[data-theme="light"] .code-block {
    background: #fbfaf8;
    border: 1px solid rgba(44, 82, 52, 0.18);
    color: #1e293b;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.03);
    border-radius: 0px !important;
}

[data-theme="light"] .code-block-header {
    background: rgba(44, 82, 52, 0.05);
    border-bottom: 1px solid rgba(44, 82, 52, 0.12);
}

[data-theme="light"] .code-copy-btn {
    border-radius: 0px !important;
    border: 1px solid rgba(44, 82, 52, 0.2);
    color: #2c5234;
}

[data-theme="light"] .code-copy-btn:hover {
    background: rgba(44, 82, 52, 0.1);
    color: #16331e;
}

/* Reglas Zen (y2k-zen) */
[data-theme="zen"] .code-block-wrapper {
    background: #0e0e0e !important;
    border: 1px solid #2d2c2c !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

[data-theme="zen"] .code-block-header {
    background: #141313 !important;
    border-bottom: 1px solid #2d2c2c !important;
}

[data-theme="zen"] .code-copy-btn {
    border: 1px solid #2d2c2c !important;
    color: #e5e2e1 !important;
    border-radius: 2px !important;
}

.inline-code {
    background: rgba(94, 92, 230, 0.12);
    border: 1px solid rgba(94, 92, 230, 0.3);
    border-radius: 6px;
    padding: 0.15rem 0.4rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: #c4b5fd;
}

[data-theme="light"] .inline-code {
    background: rgba(180, 83, 9, 0.08);
    border: 1px solid rgba(180, 83, 9, 0.22);
    color: #b45309;
}

/* ============================================================
   APPLE HIG — THOUGHT DISCLOSURE BOX (Pensamiento Desplegable)
   ============================================================ */
.apple-thought-box {
    margin: 0.2rem 0 0.35rem 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.apple-thought-box[open] {
    margin: 0.25rem 0 0.45rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(94, 92, 230, 0.25);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .apple-thought-box {
    background: #fbfaf8;
    border: 1px solid rgba(44, 82, 52, 0.18);
    border-left: 3.5px solid #b45309;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border-radius: 0px !important;
}

[data-theme="light"] .apple-thought-box[open] {
    background: #ffffff;
    border-color: rgba(44, 82, 52, 0.22);
    border-left-color: #b45309;
    box-shadow: 0 4px 16px rgba(44, 82, 52, 0.06);
}

.apple-thought-summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    outline: none;
    padding: 0.28rem 0.6rem;
    transition: background 0.2s ease;
}

.apple-thought-summary::-webkit-details-marker {
    display: none;
}

.apple-thought-summary:hover {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .apple-thought-summary:hover {
    background: rgba(44, 82, 52, 0.04);
}

.apple-thought-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    letter-spacing: -0.01em;
}

[data-theme="light"] .apple-thought-header {
    color: var(--text);
}

.apple-thought-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
    opacity: 0.9;
}

[data-theme="light"] .apple-thought-icon {
    color: #b45309;
}

.apple-thought-title {
    flex: 1;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
}

.apple-thought-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.45);
    transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
}

[data-theme="light"] .apple-thought-chevron {
    color: var(--muted);
}

.apple-thought-box[open] .apple-thought-chevron {
    transform: rotate(180deg);
}

.apple-thought-content {
    padding: 0.75rem 0.9rem 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    font-size: 0.84rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.62);
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

[data-theme="light"] .apple-thought-content {
    border-top-color: rgba(44, 82, 52, 0.1);
    color: #334155;
    background: #fbfaf8;
}

.apple-thought-content pre.code-block {
    margin: 0.4rem 0;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 0.78rem;
}

.response-body {
    margin-top: 0.5rem;
    line-height: 1.65;
}

