/* ───────────────────────────────────────────────
   VintageCodeDebug — estilos do módulo
   Tema: #0D0D0D bg, #00C9C9 cyan, JetBrains Mono
   ─────────────────────────────────────────────── */

:root {
    --vca-cyan: #89D8FF;
    --vca-gold: #D7B07A;
    --vca-bg: #08111F;
    --vca-surface: rgba(13,27,46,0.84);
    --vca-surface2: rgba(19,39,66,0.72);
    --vca-border: rgba(215,176,122,0.12);
    --vca-code-bg: #0B1525;
}

/* ── Layout principal (two-column) ── */
.debug-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 1fr;
    height: calc(100vh - 120px);
    min-height: 500px;
    gap: 0;
    border: 1px solid var(--vca-border);
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(13,27,46,0.92), rgba(8,17,31,0.96));
    backdrop-filter: blur(18px);
}

/* ── Sidebar esquerda ── */
.debug-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--vca-border);
    background: linear-gradient(180deg, rgba(16,29,49,0.98) 0%, rgba(8,17,31,0.98) 100%);
    overflow: hidden;
}

.debug-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 14px 12px;
    border-bottom: 1px solid var(--vca-border);
}

.debug-sidebar__credit {
    padding: 12px 14px;
    border-bottom: 1px solid var(--vca-border);
}

.debug-sidebar__sessions {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.debug-sessions-empty {
    padding: 32px 16px;
    text-align: center;
}

/* ── Cards de sessão ── */
.debug-session-card {
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.18s;
    border: 1px solid transparent;
}

.debug-session-card:hover {
    background: rgba(255,255,255,0.05);
}

.debug-session-card--active {
    background: linear-gradient(135deg, rgba(215,176,122,0.08), rgba(137,216,255,0.06));
    border-color: rgba(215,176,122,0.2);
}

.debug-session-card--skeleton {
    cursor: default;
    pointer-events: none;
}

.debug-session-card__title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.debug-session-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.debug-session-card__date {
    font-size: 10px;
    opacity: 0.45;
    margin-left: auto;
}

/* ── Coluna principal (chat) ── */
.debug-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ── Empty / gate states ── */
.debug-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 24px;
    text-align: center;
}

.debug-empty-icon {
    font-size: 3.5rem;
    filter: grayscale(0.3);
}

.debug-level-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 24px;
    text-align: center;
}

/* ── Chat header ── */
.debug-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--vca-border);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    flex-shrink: 0;
}

/* ── Área de mensagens ── */
.debug-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.debug-msg-skeleton {
    max-width: 70%;
}

.debug-msg-skeleton.right {
    align-self: flex-end;
}

.debug-msg-skeleton.left {
    align-self: flex-start;
}

/* ── Mensagens ── */
.debug-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 88%;
    animation: fadeInMsg 0.2s ease;
}

@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.debug-message--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.debug-message--assistant {
    align-self: flex-start;
}

.debug-message__avatar {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.debug-message__bubble {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debug-message--user .debug-message__bubble {
    align-items: flex-end;
}

.debug-message__content {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

.debug-message--user .debug-message__content {
    background: linear-gradient(135deg, rgba(215,176,122,0.16), rgba(141,104,64,0.18));
    border-bottom-right-radius: 4px;
    color: #fff4e4;
}

.debug-message--assistant .debug-message__content {
    background: linear-gradient(180deg, rgba(13,27,46,0.88), rgba(8,17,31,0.9));
    border-bottom-left-radius: 4px;
    color: #e4e4e4;
}

.debug-message__time {
    font-size: 11px;
    opacity: 0.3;
    padding: 0 4px;
}

/* ── Blocos de código ── */
.debug-code-block {
    background: var(--vca-code-bg);
    border: 1px solid rgba(137,216,255,0.18);
    border-radius: 10px;
    overflow: hidden;
    margin: 8px 0;
    font-family: 'JetBrains Mono', monospace;
}

.debug-code-header {
    background: linear-gradient(135deg, rgba(215,176,122,0.1), rgba(137,216,255,0.08));
    padding: 5px 12px;
    font-size: 11px;
    color: var(--vca-gold);
    opacity: 0.8;
    border-bottom: 1px solid rgba(215,176,122,0.12);
}

.debug-code-block pre {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.55;
    color: #cdd6f4;
}

.debug-code-block code {
    font-family: 'JetBrains Mono', monospace;
    background: none;
    padding: 0;
}

/* ── Indicador de digitação ── */
.debug-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
}

.debug-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--vca-cyan);
    opacity: 0.6;
    animation: typingPulse 1.2s infinite;
}

.debug-typing span:nth-child(2) { animation-delay: 0.2s; }
.debug-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 80%, 100% { transform: scale(1); opacity: 0.4; }
    40% { transform: scale(1.3); opacity: 1; }
}

/* ── Input area ── */
.debug-input-wrapper {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--vca-border);
    background: rgba(255,255,255,0.02);
    flex-shrink: 0;
}

.debug-input-area {
    width: 100%;
}

.debug-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* ── Credit widget ── */
.credit-widget {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Mobile toggle ── */
.debug-mobile-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--vca-border);
    background: linear-gradient(180deg, rgba(16,29,49,0.98), rgba(8,17,31,0.98));
}

/* ── Responsivo mobile ── */
@media (max-width: 768px) {
    .debug-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: calc(100vh - 80px);
        border-radius: 0;
    }

    .debug-sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 1200;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(.4,0,.2,1);
        border-right: 1px solid var(--vca-border);
    }

    .debug-layout--sidebar-open .debug-sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 32px rgba(0,0,0,0.6);
    }

    .debug-mobile-toggle {
        display: flex;
    }

    .debug-main {
        height: 100%;
    }
}
