/* ============================================================
   COPILOTO T3P — Overlay Styles
   Dark Minimal + Glass Morphism + T3P Brand + Floating Card
   ============================================================ */

/* --- Overlay backdrop --- */
.copiloto-overlay-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.06);
    z-index: 9000;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* --- FAB tab (borda direita) --- */
.copiloto-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    background: #2563eb;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    z-index: 9010;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4),
                0 2px 6px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copiloto-fab:hover {
    background: #1d4ed8;
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5),
                0 3px 8px rgba(0, 0, 0, 0.2);
}

.copiloto-fab svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* --- Painel lateral --- */
.copiloto-painel {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: 400px;
    background: rgba(15, 15, 30, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.45),
                0 0 80px rgba(37, 99, 235, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 9050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(110%);
    transition: transform 0.3s ease-out;
}

.copiloto-painel.copiloto-painel-visivel {
    transform: translateX(0);
}

/* --- Header --- */
.copiloto-header {
    background: linear-gradient(135deg, #1e3a5f, #0f172a);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.copiloto-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 7px;
    border-radius: 6px;
    line-height: 1;
    flex-shrink: 0;
}

.copiloto-titulo {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    margin-right: auto;
}

/* --- Coin badge (header) --- */
.copiloto-coin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2px 8px 2px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #93C5FD;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.copiloto-coin-icon {
    font-size: 12px;
    color: #60A5FA;
}

.copiloto-coin-num {
    font-variant-numeric: tabular-nums;
}

/* Low coins (<=5) — red warning */
.copiloto-coin-badge.copiloto-coin-low {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #FCA5A5;
}

.copiloto-coin-badge.copiloto-coin-low .copiloto-coin-icon {
    color: #EF4444;
    animation: copiloto-pulse 2s ease-in-out infinite;
}

/* Warning coins (<=20) — amber */
.copiloto-coin-badge.copiloto-coin-warn {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.2);
    color: #FCD34D;
}

.copiloto-coin-badge.copiloto-coin-warn .copiloto-coin-icon {
    color: #FBBF24;
}

/* --- Toggle switch (Lateral / Modal) --- */
.copiloto-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
}

.copiloto-toggle-label {
    color: rgba(255, 255, 255, 0.45);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.copiloto-toggle-label.copiloto-active {
    color: rgba(255, 255, 255, 0.8);
}

.copiloto-toggle {
    position: relative;
    width: 28px;
    height: 14px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    padding: 0;
    flex-shrink: 0;
}

.copiloto-toggle.copiloto-on {
    background: #2563eb;
}

.copiloto-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.copiloto-toggle.copiloto-on .copiloto-toggle-knob {
    transform: translateX(14px);
}

/* --- Header buttons (minimizar, fechar) --- */
.copiloto-header-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    transition: color 0.15s, background 0.15s;
    font-size: 14px;
    flex-shrink: 0;
}

.copiloto-header-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
}

/* --- Chat body --- */
.copiloto-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 31px,
        rgba(255, 255, 255, 0.015) 31px,
        rgba(255, 255, 255, 0.015) 32px
    );
}

.copiloto-body::-webkit-scrollbar {
    width: 4px;
}

.copiloto-body::-webkit-scrollbar-track {
    background: transparent;
}

.copiloto-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.copiloto-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* --- Mensagem Assistant --- */
.copiloto-msg-assistant {
    align-self: flex-start;
    max-width: 92%;
}

.copiloto-bubble-assistant {
    background: rgba(255, 255, 255, 0.06);
    color: #c8cdd3;
    font-size: 13px;
    line-height: 1.6;
    padding: 10px 14px;
    border-radius: 12px 12px 12px 4px;
    word-break: break-word;
}

.copiloto-bubble-assistant b,
.copiloto-bubble-assistant strong {
    color: #e2e8f0;
    font-weight: 600;
}

.copiloto-bubble-assistant .copiloto-highlight {
    color: #60a5fa;
    font-weight: 500;
}

.copiloto-bubble-assistant .copiloto-warn {
    color: #f59e0b;
    font-weight: 500;
}

.copiloto-bubble-assistant .copiloto-success {
    color: #10b981;
    font-weight: 500;
}

/* --- Mensagem User --- */
.copiloto-msg-user {
    align-self: flex-end;
    max-width: 82%;
}

.copiloto-bubble-user {
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    padding: 8px 14px;
    border-radius: 12px 12px 4px 12px;
    word-break: break-word;
}

/* --- Source tags --- */
.copiloto-source-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 4px;
    margin-top: 6px;
}

.copiloto-source-tag-sistema {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.copiloto-source-tag-doc {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

/* --- Data cards --- */
.copiloto-data-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 8px;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #c8cdd3;
}

.copiloto-data-card-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.copiloto-data-card-label {
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

.copiloto-data-card-value {
    color: #e2e8f0;
    text-align: right;
    word-break: break-word;
}

/* --- Semaforo cards --- */
.copiloto-sem-card {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 6px;
    font-size: 12px;
    color: #c8cdd3;
    line-height: 1.5;
}

.copiloto-sem-red {
    border-left: 3px solid #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

.copiloto-sem-yellow {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.06);
}

.copiloto-sem-green {
    border-left: 3px solid #10b981;
    background: rgba(16, 185, 129, 0.06);
}

/* --- Loading --- */
.copiloto-loading {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.copiloto-loading-text {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-style: italic;
}

.copiloto-loading-bar {
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.copiloto-loading-bar-inner {
    height: 100%;
    width: 40%;
    border-radius: 2px;
    background: linear-gradient(90deg, #2563eb, #6366f1, #2563eb);
    background-size: 200% 100%;
    animation: copiloto-loading-slide 1.5s ease-in-out infinite;
}

@keyframes copiloto-loading-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* --- Input area --- */
.copiloto-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    background: rgba(15, 15, 30, 0.5);
}

.copiloto-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 12px;
    color: #e2e8f0;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
}

.copiloto-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.copiloto-input:focus {
    border-color: rgba(37, 99, 235, 0.5);
}

.copiloto-btn-enviar {
    width: 28px;
    height: 28px;
    background: #2563eb;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.15s, transform 0.1s;
}

.copiloto-btn-enviar:hover {
    background: #1d4ed8;
}

.copiloto-btn-enviar:active {
    transform: scale(0.93);
}

.copiloto-btn-enviar:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

.copiloto-btn-enviar svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* --- Empty state --- */
.copiloto-vazio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    gap: 8px;
}

.copiloto-vazio-icone {
    font-size: 32px;
    color: #2563eb;
    opacity: 0.6;
    margin-bottom: 4px;
}

.copiloto-vazio-texto {
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 600;
}

.copiloto-vazio-sub {
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    line-height: 1.5;
    max-width: 260px;
}

/* --- Timestamp (● Copiloto · agora) --- */
.copiloto-timestamp {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 4px;
}

.copiloto-timestamp::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

/* --- Tool/fonte tags inline --- */
.copiloto-fontes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.copiloto-fonte-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    border-radius: 4px;
}

.copiloto-fonte-tag[data-tipo="sistema"] {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.copiloto-fonte-tag[data-tipo="doc"] {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

/* --- Loading dots (3-dot animation) --- */
.copiloto-loading-bubble {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.copiloto-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: copiloto-dot-pulse 1.2s ease-in-out infinite;
}

.copiloto-dot:nth-child(2) { animation-delay: 0.2s; }
.copiloto-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes copiloto-dot-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* --- Firefox scrollbar --- */
.copiloto-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ============================================================
   MODO MODAL
   ============================================================ */
.copiloto-painel.copiloto-modal {
    top: auto;
    right: auto;
    bottom: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    width: 100%;
    max-width: 560px;
    height: auto;
    max-height: 80vh;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.copiloto-painel.copiloto-modal.copiloto-painel-visivel {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* ============================================================
   ANIMACOES
   ============================================================ */
@keyframes copiloto-slide-in {
    from { transform: translateX(110%); }
    to   { transform: translateX(0); }
}

@keyframes copiloto-fade-scale-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
    .copiloto-painel {
        width: 100%;
        top: 0;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }

    .copiloto-painel.copiloto-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        left: 0;
        top: 0;
        transform: translateY(100%);
        opacity: 1;
    }

    .copiloto-painel.copiloto-modal.copiloto-painel-visivel {
        transform: translateY(0);
    }

    .copiloto-fab {
        right: 16px;
        bottom: 16px;
    }
}

/* ============================================================
   QUOTA LIMIT — Recharging UI
   ============================================================ */

/* Card base */
.copiloto-quota-card {
    align-self: flex-start;
    max-width: 88%;
    border-radius: 12px;
    padding: 14px 16px;
    border-bottom-left-radius: 4px;
    animation: copiloto-fadeIn 0.4s ease-out;
}

/* RPM variant (blue) */
.copiloto-quota-rpm {
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

/* Daily variant (amber) */
.copiloto-quota-daily {
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.12);
}

.copiloto-quota-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.copiloto-quota-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.copiloto-quota-icon-rpm {
    background: rgba(37, 99, 235, 0.15);
    animation: copiloto-pulse 2s ease-in-out infinite;
}

.copiloto-quota-icon-daily {
    background: rgba(251, 191, 36, 0.12);
}

@keyframes copiloto-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.7; }
}

.copiloto-quota-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.copiloto-quota-countdown {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

.copiloto-countdown-num {
    font-weight: 700;
    color: #60A5FA;
    font-variant-numeric: tabular-nums;
}

/* Progress bar */
.copiloto-quota-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.copiloto-quota-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563EB, #60A5FA);
    border-radius: 2px;
    width: 100%;
    transition: width 1s linear;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

.copiloto-quota-note {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
}

/* Daily card body + footer */
.copiloto-quota-body {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    margin-bottom: 12px;
    padding-left: 42px;
}

.copiloto-quota-body strong {
    color: rgba(255, 255, 255, 0.7);
}

.copiloto-quota-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 42px;
}

.copiloto-quota-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.copiloto-quota-dot-daily {
    background: #FBBF24;
    animation: copiloto-blink 3s ease-in-out infinite;
}

@keyframes copiloto-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.copiloto-quota-status {
    font-size: 10px;
    color: rgba(251, 191, 36, 0.6);
    font-weight: 500;
}

/* Reconnected toast */
.copiloto-reconnected-toast {
    align-self: center;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 11px;
    color: #86EFAC;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: copiloto-fadeIn 0.3s ease-out;
}

.copiloto-reconnected-dot {
    width: 6px;
    height: 6px;
    background: #22C55E;
    border-radius: 50%;
}
