/*
   i style chat css rocode chat ui premium redesign
   i style this section
*/

/* i force rubik on every element in the document when on chat page */
* {
    font-family: var(--font-body) !important;
}

/* i ambient background orbs behind the chat layout */
#chat-page {
    background:
        radial-gradient(ellipse 80% 50% at 10% 20%, rgba(157, 80, 255, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 50% 50%, rgba(14, 165, 233, 0.03) 0%, transparent 70%);
}

#chat-page .logo-tier-tag {
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--primary-orange);
    text-shadow: 0 0 12px rgba(249, 115, 22, 0.45);
    margin-left: 0.35rem;
    font-size: 0.95em;
    text-transform: lowercase;
}

#chat-page .logo-text.logo-text-studio,
#chat-page .logo-tier-tag.logo-tier-studio {
    color: var(--primary-orange);
    text-shadow: 0 0 15px rgba(249, 115, 22, 0.5);
    animation: none;
}

/*
   i style chat container tighter gaps no padding right crush
   i style this section
*/
.chat-container {
    --rc-nav-rail-width: calc(48px + 1.44rem);
    --rc-dock-clearance: calc(0.25rem + var(--rc-nav-rail-width) + 0.5rem);
    --rc-col-gap: 0.35rem;
    padding: 5rem var(--rc-dock-clearance) var(--rc-panel-inset-bottom) 1.25rem;
    gap: var(--rc-col-gap);
}

/*
   i all panels premium glass card base
   i style this section
*/
.sidebar,
.chat-main,
.studio-panel,
.config-panel {
    background: linear-gradient(135deg,
        rgba(19, 24, 38, 0.82) 0%,
        rgba(13, 17, 30, 0.88) 100%);
    border: 1px solid rgba(148, 163, 184, 0.1);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    border-radius: 20px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.05);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.sidebar:hover,
.chat-main:hover,
.studio-panel:hover,
.config-panel:hover {
    border-color: rgba(157, 80, 255, 0.2);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(157, 80, 255, 0.08),
        inset 0 1px 0 rgba(255,255,255,0.06);
}

/*
   i sidebar
   i style this section
*/
.sidebar {
    padding: 1.25rem 1rem;
    gap: 0;
}

.sidebar-header {
    padding: 0 0.5rem 1rem;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.sidebar-header h2 {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
    flex: 1;
    min-width: 0;
}

.studio-hierarchy-header > span,
.config-panel-header h2 {
    flex: 1;
    min-width: 0;
}

/* i new chat button layout only skeuo from style css */
.new-chat-btn {
    margin: 1rem 0.5rem 1rem;
    padding: 0.75rem 1rem;
    width: calc(100% - 1rem);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* i conversation list items */
.conversation-list {
    padding: 0 0.25rem;
    margin-top: 0.25rem;
}

.conversation-list li {
    padding: 0.7rem 0.875rem;
    border-radius: 10px;
    margin-bottom: 3px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    cursor: var(--rc-cursor-hand);
}

.conversation-list li:active {
    cursor: var(--rc-cursor-grab);
}

.conversation-list li::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 2px;
    background: var(--accent);
    border-radius: 2px;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.conversation-list li:hover {
    background: rgba(157, 80, 255, 0.07);
    border-color: rgba(157, 80, 255, 0.15);
    color: var(--text-primary);
}

.conversation-list li:hover::before { transform: scaleY(1); }

.conversation-list li.active {
    background: rgba(157, 80, 255, 0.12);
    border-color: rgba(157, 80, 255, 0.25);
    color: #c4b5fd;
}

.conversation-list li.active::before { transform: scaleY(1); }

/* i usage meter upgrades */
.usage-meter {
    margin: 0.75rem 0.5rem;
    padding: 0.875rem;
    background: rgba(157, 80, 255, 0.06);
    border: 1px solid rgba(157, 80, 255, 0.15);
    border-radius: 12px;
}

.quota-header {
    margin-bottom: 0.65rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.quota-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.quota-value {
    font-size: 0.88rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    letter-spacing: -0.02em;
    transition: color 0.25s ease, text-shadow 0.25s ease;
}

.quota-value.quota-at-limit {
    color: #f87171;
}

.quota-value.quota-over-limit {
    color: #fca5a5;
    text-shadow: 0 0 14px rgba(248, 113, 113, 0.35);
}

.quota-bar-track {
    height: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    position: relative;
}

.usage-meter.quota-meter-over-limit .quota-bar-track {
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.25), 0 0 16px rgba(248, 113, 113, 0.15);
}

.quota-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #7c3aed, #9d50ff, #c084fc);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 10px rgba(157, 80, 255, 0.45);
    position: relative;
}

.quota-bar-fill.warning {
    background: linear-gradient(90deg, #d97706, #f59e0b, #fbbf24);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.quota-bar-fill.danger {
    background: linear-gradient(90deg, #dc2626, #ef4444, #f87171);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.quota-bar-fill.quota-bar-overlimit {
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.55), inset 0 0 8px rgba(255, 255, 255, 0.12);
    animation: quotaOverPulse 2s ease-in-out infinite;
}

@keyframes quotaOverPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.12); }
}

.quota-sub {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.quota-sub.quota-sub-limit {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.usage-meter.quota-meter-at-limit {
    border-color: rgba(248, 113, 113, 0.22);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, rgba(157, 80, 255, 0.05) 100%);
}

/*
   i style chat main messages input
   i style this section
*/
.chat-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    flex-shrink: 0;
    padding: var(--rc-space-3) var(--rc-panel-inset-x) var(--rc-space-2);
    text-align: center;
    border-bottom: 1px solid rgba(157, 80, 255, 0.12);
}

.chat-header-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

.chat-header:not([hidden]) + .chat-messages {
    padding-top: var(--rc-space-3);
}

.chat-main--empty {
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    padding: var(--rc-panel-inset-top) var(--rc-panel-inset-x) var(--rc-panel-inset-bottom);
}

.chat-main--empty .chat-messages {
    flex-grow: 0;
    flex-shrink: 0;
    overflow: visible;
    padding: 0;
    width: 100%;
    max-width: 42rem;
}

.chat-main--empty .chat-empty-state {
    margin: 0 auto;
}

.chat-main--empty .chat-input-area {
    flex-grow: 0;
    flex-shrink: 0;
    width: 100%;
    max-width: 42rem;
    padding: 0;
}

.chat-main--empty .chat-input-area::before {
    display: none;
}

.chat-main--empty .plugin-link-row {
    margin-bottom: var(--rc-space-2);
}

.chat-main--empty #chat-char-counter {
    text-align: center;
}

/* i message bubbles */
.chat-messages {
    padding: var(--rc-panel-inset-top) var(--rc-panel-inset-x) 0;
    gap: var(--rc-stack-gap);
}

.message-container {
    animation: msgSlideIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* i user messages */
.message-container.user .message {
    background: var(--accent);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    padding: 0.875rem 1.25rem;
    box-shadow: 0 4px 18px rgba(157, 80, 255, 0.3);
    font-size: 0.95rem;
    line-height: 1.65;
    border: none;
}

/* i hover copy/revert actions beside messages so layout does not shift */
.message-container.user,
.message-container.ai {
    position: relative;
}

.message-actions {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: row;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 1;
}

.message-container.user .message-actions {
    right: 100%;
    margin-right: 0.45rem;
    align-items: flex-end;
}

.message-container.ai .message-actions {
    left: 100%;
    margin-left: 0.45rem;
    align-items: flex-start;
}

.message-container.message-actions-visible .message-actions,
.message-container:focus-within .message-actions {
    opacity: 1;
    pointer-events: auto;
}

.message-action-btn {
    border-radius: 8px;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: var(--rc-cursor-hand);
    white-space: nowrap;
}

.message-action-btn:active {
    cursor: var(--rc-cursor-grab);
}

/* i ai messages */
.message-container.ai .message {
    background: linear-gradient(135deg,
        rgba(19, 24, 38, 0.9) 0%,
        rgba(15, 19, 32, 0.95) 100%);
    border: 1px solid rgba(157, 80, 255, 0.18);
    border-radius: 18px 18px 18px 4px;
    padding: 1rem 1.375rem;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255,255,255,0.03) inset;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #e2e8f0;
    position: relative;
}

.message-container.ai .message::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: linear-gradient(180deg, var(--accent), transparent);
    border-radius: 4px 0 0 4px;
    opacity: 0.7;
}

/* i ai avatar dot */
.message-container.ai {
    padding-left: 0;
}

/* i app-generated completion marker */
.message-container.done {
    padding-left: 0;
    justify-content: flex-start;
}

.message-container.done .message {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    box-shadow: none;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: #f97316;
    line-height: 1.4;
}

/* i message sender label */
.message-sender {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
    padding-left: 0.25rem;
}

.message-container.user .message-sender {
    text-align: right;
    padding-right: 0.25rem;
    padding-left: 0;
}

/* i style chat input area */
.chat-input-area {
    padding: 0 var(--rc-panel-inset-x) var(--rc-panel-inset-bottom);
    border-top: none;
    position: relative;
}

.chat-input-area::before {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(157, 80, 255, 0.2), transparent);
    margin-bottom: var(--rc-input-divider-gap);
}

.plugin-link-row {
    display: flex;
    justify-content: center;
    margin-bottom: var(--rc-space-2);
}

.plugin-link-row[hidden] {
    display: none !important;
}

.plugin-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--rc-space-1);
    padding: var(--rc-space-2) var(--rc-space-3);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

#chat-form {
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    overflow: visible;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
}

#chat-form:focus-within {
    border-color: rgba(157, 80, 255, 0.5);
    box-shadow:
        0 0 0 3px rgba(157, 80, 255, 0.1),
        0 8px 30px rgba(0, 0, 0, 0.3);
}

#chat-input,
.mention-editor {
    flex-grow: 1;
    padding: 0.625rem 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    outline: none;
    overflow-y: hidden;
    transition: none;
    box-shadow: none;
    min-height: 1.6em;
    white-space: pre-wrap;
    word-break: break-word;
}

.mention-editor:empty::before,
.mention-editor.is-empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.mention-editor-disabled {
    opacity: 0.65;
    pointer-events: none;
}

#chat-input:focus,
.mention-editor:focus {
    border-color: transparent;
    box-shadow: none;
}

#chat-input::placeholder,
.mention-editor::placeholder { color: var(--text-muted); }

.chat-form-body {
    flex: 1;
    min-width: 0;
}

.chat-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 2.5rem;
}

.chat-input-wrap #chat-input {
    width: 100%;
    box-sizing: border-box;
}

#chat-form.is-recording #chat-input,
#chat-form.is-recording .mention-editor {
    color: transparent;
    caret-color: transparent;
}

#chat-form.is-recording #chat-input::placeholder,
#chat-form.is-recording .mention-editor:empty::before,
#chat-form.is-recording .mention-editor.is-empty::before {
    color: transparent;
}

#chat-form.is-recording .context-mention-chip {
    opacity: 0.15;
}

.voice-recording-bar {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    align-items: center;
    gap: 0.65rem;
    padding: 0.625rem 0;
    box-sizing: border-box;
    border-radius: 10px;
    background: rgba(11, 15, 25, 0.94);
    pointer-events: none;
}

#chat-form.is-recording .voice-recording-bar {
    display: flex;
}

.voice-recording-bar[hidden] {
    display: none !important;
}

.voice-waveform {
    display: block;
    flex: 1;
    min-width: 0;
    height: 100%;
    min-height: 2rem;
    border-radius: 8px;
    background: rgba(157, 80, 255, 0.06);
    border: 1px solid rgba(157, 80, 255, 0.18);
}

.chat-form-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-bottom: 2px;
    overflow: visible;
}

.voice-recording-timer {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: rgba(196, 181, 253, 0.95);
    min-width: 4.75rem;
    text-align: right;
    white-space: nowrap;
}

.voice-cancel-btn[hidden],
.voice-confirm-btn[hidden],
.send-btn[hidden],
.mic-btn[hidden] {
    display: none !important;
}

.mic-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: var(--rc-cursor-hand);
    padding: 0;
    --rc-btn-radius: 22%;
    --rc-btn-mid: #48484a;
    --rc-btn-shadow: #2c2c2e;
    --rc-btn-text: #f2f2f7;
    transition: transform 0.22s ease;
}

.voice-cancel-btn,
.voice-confirm-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: var(--rc-cursor-hand);
    padding: 0;
    --rc-btn-radius: 22%;
}

.mic-btn.is-recording {
    --rc-btn-mid: #ef4444;
    --rc-btn-shadow: #b91c1c;
    --rc-btn-text: #ffffff;
    animation: voice-mic-pulse 1.4s ease-in-out infinite;
}

.voice-confirm-btn {
    --rc-btn-mid: #22c55e;
    --rc-btn-shadow: #15803d;
    --rc-btn-text: #ffffff;
}

.voice-cancel-btn {
    --rc-btn-mid: #636366;
    --rc-btn-shadow: #3a3a3c;
    --rc-btn-text: #ffffff;
}

.mic-btn svg,
.mic-btn .lucide,
.voice-cancel-btn svg,
.voice-cancel-btn .lucide,
.voice-confirm-btn svg,
.voice-confirm-btn .lucide {
    pointer-events: none;
}

.mic-btn:active,
.voice-cancel-btn:active,
.voice-confirm-btn:active {
    cursor: var(--rc-cursor-grab);
}

.send-btn-wrap {
    position: relative;
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
}

.send-btn-hint {
    position: absolute;
    right: 34px;
    top: 50%;
    z-index: 0;
    transform: translateY(-50%) translateX(calc(100% - 6px));
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    transition:
        transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1),
        opacity 0.22s ease,
        max-width 0.28s ease,
        padding 0.28s ease;
}

.send-btn-wrap.plugin-disconnected {
    cursor: not-allowed;
}

.send-btn-wrap.plugin-disconnected .send-btn {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.send-btn-wrap.plugin-disconnected:hover .send-btn-hint {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    max-width: 12rem;
    padding: 0.38rem 0.7rem;
}

@media (prefers-reduced-motion: reduce) {
    .send-btn-hint {
        transition: opacity 0.15s ease;
    }

    .send-btn-wrap.plugin-disconnected:hover .send-btn-hint {
        transform: translateY(-50%);
    }
}

.send-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: var(--rc-cursor-hand);
    margin-bottom: 0;
    padding: 0;
}

.send-btn:active {
    cursor: var(--rc-cursor-grab);
}

#chat-form.is-recording .mic-btn {
    display: none !important;
}

#chat-form.is-recording .voice-cancel-btn,
#chat-form.is-recording .voice-confirm-btn {
    display: inline-flex;
    animation: voice-confirm-in 0.22s ease;
}

@keyframes voice-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

@keyframes voice-confirm-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#chat-char-counter,
.chat-char-counter {
    text-align: right;
    font-size: 0.7rem !important;
    color: var(--text-muted) !important;
    padding: var(--rc-space-1) 0 0 !important;
    letter-spacing: 0.04em;
}

/*
   i empty state hero level visual
   i style this section
*/
.chat-empty-state {
    gap: var(--rc-stack-gap);
    padding: 0;
    position: relative;
}

.chat-empty-state::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(157, 80, 255, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -60%);
    pointer-events: none;
    animation: emptyPulse 7s ease-in-out infinite;
}

@keyframes emptyPulse {
    0%, 100% { transform: translate(-50%, -60%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; }
}

.chat-empty-state h1,
.chat-empty-state .empty-title {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.02em;
}

.suggestion-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    font-weight: 400;
}

.empty-connect-hint {
    max-width: 34rem;
    margin: 0 auto;
    padding: var(--rc-space-2) var(--rc-space-3);
    border-radius: 12px;
    border: 1px solid rgba(157, 80, 255, 0.2);
    background: rgba(157, 80, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
}

.suggestion-pills {
    gap: var(--rc-space-2);
}

.suggestion-pill {
    padding: var(--rc-space-2) var(--rc-space-3);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: var(--rc-cursor-hand);
    backdrop-filter: blur(8px);
    letter-spacing: 0.01em;
}

/*
   i style config panel premium sidebar
   i style this section
*/
.config-panel {
    padding: 1.15rem 1rem;
    gap: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.config-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.config-panel-header h2 {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
}

.config-group {
    margin-bottom: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(148, 163, 184, 0.07);
    border-radius: 12px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.config-group:hover {
    border-color: rgba(157, 80, 255, 0.15);
    background: rgba(157, 80, 255, 0.04);
}

.config-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* i style config panel upgrade cta orange skeuo */
.config-panel .upgrade-btn {
    --rc-btn-mid: #ff9500;
    --rc-btn-shadow: #c2410c;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.02em;
}

/* i model picker button layout only */
.model-picker-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.82rem;
    font-weight: 500;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/*
   i brave shields warning banner
   i style this section
*/
#brave-shields-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    padding: 1.5rem 2rem;
    background: #dc2626;
    color: #fff;
    text-align: center;
    font-size: clamp(1.1rem, 2.5vw, 1.75rem);
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 32px rgba(220, 38, 38, 0.55);
    border-bottom: 4px solid #991b1b;
}

html.brave-shields-detected body#chat-page {
    padding-top: 5.5rem;
}

/*
   i mobile desktop only gate
   i style this section
*/
#mobile-desktop-only-overlay {
    display: none;
}

@media (max-width: 768px) {
    #mobile-desktop-only-overlay {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 10000;
        align-items: center;
        justify-content: center;
        padding: 1.5rem;
        background: rgba(0, 0, 0, 0.92);
        backdrop-filter: blur(12px) saturate(1.4);
        -webkit-backdrop-filter: blur(12px) saturate(1.4);
    }

    body#chat-page {
        overflow: hidden;
    }
}

.mobile-desktop-only-sheet {
    background: #111;
    border: 1px solid #333;
    padding: 2rem 1.5rem;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 50px rgba(139, 92, 246, 0.2);
}

.mobile-desktop-only-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.mobile-desktop-only-sheet h2 {
    color: #fff;
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
    padding: 0;
}

.mobile-desktop-only-sheet p {
    color: #aaa;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.mobile-desktop-only-sheet .btn {
    width: 100%;
    display: block;
    text-align: center;
    padding: 12px;
    font-size: 1rem;
    text-decoration: none;
    box-sizing: border-box;
}

/*
   i modals elevated premium glass
   i style this section
*/
#model-picker-overlay,
#plugin-modal-overlay,
#limit-modal-overlay,
#pro-limit-modal-overlay {
    backdrop-filter: blur(16px) saturate(1.35) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.35) !important;
}

.rc-limit-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    background: rgba(11, 15, 25, 0.42);
    backdrop-filter: blur(16px) saturate(1.35);
    -webkit-backdrop-filter: blur(16px) saturate(1.35);
    padding: 1.25rem;
}

.rc-limit-modal-overlay.is-open {
    display: flex;
    animation: rcLimitOverlayIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rcLimitOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.limit-modal-card {
    background: linear-gradient(135deg, rgba(19, 24, 38, 0.97) 0%, rgba(11, 15, 25, 0.99) 100%);
    border: 1px solid rgba(157, 80, 255, 0.28);
    border-radius: 24px;
    padding: 2rem 1.75rem 1.5rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 40px 80px rgba(0, 0, 0, 0.55),
        0 0 60px rgba(157, 80, 255, 0.14);
    animation: rcLimitCardIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rcLimitCardIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.limit-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 18px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.2);
}

.limit-modal-icon-pro {
    background: rgba(157, 80, 255, 0.12);
    border-color: rgba(157, 80, 255, 0.35);
    color: #c4b5fd;
    box-shadow: 0 0 24px rgba(157, 80, 255, 0.2);
}

.limit-modal-title {
    margin: 0 0 0.5rem;
    padding: 0 2.25rem;
    font-size: 1.45rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.limit-modal-desc {
    margin: 0 0 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.92rem;
}

.limit-modal-features {
    background: rgba(157, 80, 255, 0.06);
    border: 1px solid rgba(157, 80, 255, 0.16);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    margin-bottom: 1.25rem;
    text-align: left;
}

.limit-modal-feature {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.45;
}

.limit-modal-feature + .limit-modal-feature {
    margin-top: 0.55rem;
}

.limit-modal-check {
    color: #22c55e;
    font-weight: 700;
    flex-shrink: 0;
}

.limit-modal-cta {
    width: 100%;
    display: block;
    text-align: center;
    padding: 12px 16px;
    font-size: 1rem;
    text-decoration: none;
    box-sizing: border-box;
}

.limit-modal-cta-secondary {
    margin-top: 0.65rem;
}

.limit-modal-price-note {
    margin: 0.65rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.limit-modal-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    margin-top: 1rem;
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
}

.limit-modal-dismiss:hover {
    color: var(--text-secondary);
}

.quota-limit-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.14) 0%, rgba(157, 80, 255, 0.1) 100%);
    border: 1px solid rgba(239, 68, 68, 0.35);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.12);
}

.quota-limit-banner[hidden] {
    display: none !important;
}

.quota-limit-banner-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
}

.quota-limit-banner-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.quota-limit-banner-copy strong {
    color: #fecaca;
    font-size: 0.88rem;
}

a.btn.quota-limit-banner-upgrade {
    flex-shrink: 0;
    --rc-btn-mid: #ff8a2a;
    --rc-btn-shadow: #c2410c;
    --rc-btn-radius: 10px;
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}

#chat-form.quota-blocked .chat-form-body,
#chat-form.quota-blocked .chat-form-actions {
    opacity: 0.65;
    pointer-events: none;
}

.chat-input-area.quota-blocked #chat-char-counter {
    opacity: 0.5;
}

.model-picker-modal {
    background: linear-gradient(135deg, rgba(19, 24, 38, 0.97) 0%, rgba(11, 15, 25, 0.99) 100%);
    border: 1px solid rgba(157, 80, 255, 0.25);
    border-radius: 24px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset, 0 40px 80px rgba(0,0,0,0.7), 0 0 60px rgba(157, 80, 255, 0.1);
}

.model-picker-title {
    background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/*
   i typing indicator
   i style this section
*/
.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 0.875rem 1.25rem;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    animation: typingBounce 2.4s ease-in-out infinite;
    opacity: 0.8;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/*
   i scrollbars ultra thin purple
   i style this section
*/
.chat-messages::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar,
.config-panel::-webkit-scrollbar {
    width: 3px;
}

.chat-messages::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track,
.config-panel::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.conversation-list::-webkit-scrollbar-thumb,
.config-panel::-webkit-scrollbar-thumb {
    background: rgba(157, 80, 255, 0.35);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.conversation-list::-webkit-scrollbar-thumb:hover,
.config-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 80, 255, 0.6);
}

/*
   i plugin status indicator
   i style this section
*/
#plugin-status-indicator {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    gap: 6px;
}

/* i walkthrough must not trap users box stays tappable backdrop dismisses */
#walkthrough-overlay {
    cursor: var(--rc-cursor-hand);
}

#walkthrough-overlay:active {
    cursor: var(--rc-cursor-grab);
}

#walkthrough-box {
    cursor: default;
    pointer-events: auto;
}

#walkthrough-overlay.walkthrough-centered #walkthrough-box {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
}

#walkthrough-overlay.walkthrough-centered #walkthrough-arrow {
    display: none;
}

/*
   i plugin modal
   i style this section
*/
.plugin-modal {
    background: linear-gradient(135deg, rgba(19, 24, 38, 0.97) 0%, rgba(11, 15, 25, 0.99) 100%);
    border: 1px solid rgba(157, 80, 255, 0.2);
    border-radius: 24px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.7), 0 0 40px rgba(157, 80, 255, 0.08);
}

.step-card {
    background: rgba(157, 80, 255, 0.06);
    border: 1px solid rgba(157, 80, 255, 0.15);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.step-card:hover {
    background: rgba(157, 80, 255, 0.1);
    border-color: rgba(157, 80, 255, 0.3);
    transform: translateY(-2px);
}

.step-number {
    background: var(--accent);
    box-shadow: 0 4px 12px rgba(157, 80, 255, 0.3);
}

/*
   i walkthrough box
   i style this section
*/
#walkthrough-box {
    background: linear-gradient(135deg, rgba(19, 24, 38, 0.97) 0%, rgba(11, 15, 25, 0.99) 100%);
    border: 1px solid rgba(157, 80, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(157, 80, 255, 0.1);
}

/* i switch styles live in style css */
.message.ai pre,
.message.ai code {
    background: rgba(11, 15, 25, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
}

.message.ai pre {
    padding: 0.875rem 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

/*
   i responsive
   i style this section
*/
@media (max-width: 900px) {
    #chat-page {
        --rc-panel-inset-x: var(--rc-space-3);
        --rc-panel-inset-top: var(--rc-space-3);
        --rc-panel-inset-bottom: var(--rc-space-3);
        --rc-col-gap: var(--rc-space-2);
    }

    .chat-container {
        padding: 4.5rem 1rem var(--rc-panel-inset-bottom);
        gap: var(--rc-col-gap);
    }

    .sidebar, .config-panel { border-radius: 16px; }
    .chat-main { border-radius: 16px; }
}

/*
   i style ios style camera zoom zoom into a button before a modal opens
   i style this section
*/
body#chat-page {
    --rc-zoom-duration: 1.6s;
    --rc-zoom-tail: 1.08s;
    --rc-zoom-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* i style gpu layer transform opacity only no filter animation */
#chat-ui {
    position: relative;
    transform: translate3d(0, 0, 0);
    transform-origin: var(--rc-zoom-x, 50%) var(--rc-zoom-y, 50%);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    contain: layout style;
    isolation: isolate;
}

#chat-ui.rc-zoom-active {
    will-change: transform;
    transition: transform var(--rc-zoom-duration) var(--rc-zoom-ease);
}

#chat-ui::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
}

#chat-ui.rc-zoom-active::after {
    transition: opacity var(--rc-zoom-duration) var(--rc-zoom-ease);
}

/* i backdrop blur inside a scaling subtree repaints every frame flatten during zoom */
#chat-ui.rc-zoom-active .sidebar,
#chat-ui.rc-zoom-active .chat-main,
#chat-ui.rc-zoom-active .studio-panel,
#chat-ui.rc-zoom-active .config-panel,
#chat-ui.rc-zoom-active #chat-form,
#chat-ui.rc-zoom-active .suggestion-pill,
#chat-ui.rc-zoom-active .plugin-link-btn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* i skip overlay blur while the stage is still moving solid bg matches the settled look */
body.rc-zoom-in-motion #model-picker-overlay.rc-modal-enter,
body.rc-zoom-in-motion #plugin-modal-overlay.rc-modal-enter,
body.rc-zoom-out-motion #model-picker-overlay,
body.rc-zoom-out-motion #plugin-modal-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#chat-ui.rc-zoomed {
    transform: scale3d(var(--rc-zoom-scale, 8), var(--rc-zoom-scale, 8), 1);
    pointer-events: none;
}

#chat-ui.rc-zoomed::after {
    opacity: 1;
}

/* i hidden until the zoom choreography starts prevents open close flashes */
#model-picker-overlay,
#plugin-modal-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

#model-picker-overlay.rc-modal-enter,
#model-picker-overlay.rc-modal-leave,
#plugin-modal-overlay.rc-modal-enter,
#plugin-modal-overlay.rc-modal-leave {
    visibility: visible;
    will-change: opacity, transform;
}

#model-picker-overlay.rc-modal-enter,
#plugin-modal-overlay.rc-modal-enter {
    pointer-events: auto;
}

#model-picker-overlay.rc-modal-leave,
#plugin-modal-overlay.rc-modal-leave {
    pointer-events: none;
}

/* i modal appears at zoom animates in over the final with no extra delay */
#model-picker-overlay.rc-modal-enter,
#plugin-modal-overlay.rc-modal-enter {
    animation: rcOverlayIn var(--rc-zoom-tail) var(--rc-zoom-ease) 0s both;
}

#model-picker-overlay.rc-modal-leave,
#plugin-modal-overlay.rc-modal-leave {
    animation: rcOverlayOut var(--rc-zoom-tail) var(--rc-zoom-ease) both;
}

@keyframes rcOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes rcOverlayOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* i modal pops in during the second half shrinks out during the first half */
#model-picker-overlay .model-picker-modal,
#model-picker-overlay .model-byok-panel,
#plugin-modal-overlay .plugin-modal {
    animation: none;
}

.rc-modal-enter .model-picker-modal,
.rc-modal-enter .model-byok-panel,
.rc-modal-enter .plugin-modal {
    animation: rcModalPop var(--rc-zoom-tail) var(--rc-zoom-ease) 0s both;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.rc-modal-leave .model-picker-modal,
.rc-modal-leave .model-byok-panel,
.rc-modal-leave .plugin-modal {
    animation: rcModalShrink var(--rc-zoom-tail) var(--rc-zoom-ease) both;
    will-change: transform, opacity;
}

@keyframes rcModalPop {
    from { opacity: 0; transform: scale3d(0.92, 0.92, 1) translate3d(0, 24px, 0); }
    to   { opacity: 1; transform: scale3d(1, 1, 1) translate3d(0, 0, 0); }
}

@keyframes rcModalShrink {
    from { opacity: 1; transform: scale3d(1, 1, 1) translate3d(0, 0, 0); }
    to   { opacity: 0; transform: scale3d(0.9, 0.9, 1) translate3d(0, 12px, 0); }
}

/* i low power devices skip expensive blur shorten motion */
html.rc-low-perf #model-picker-overlay,
html.rc-low-perf #plugin-modal-overlay,
html.rc-low-perf #limit-modal-overlay,
html.rc-low-perf #pro-limit-modal-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.rc-low-perf body#chat-page {
    --rc-zoom-duration: 1.1s;
    --rc-zoom-tail: 0.75s;
}

html.rc-low-perf .hero-video-wrap,
html.rc-low-perf .plugin-bg-blob {
    animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
    #chat-ui {
        transition: none;
    }
    #chat-ui::after {
        transition: none;
        display: none;
    }
    #chat-ui.rc-zoomed {
        transform: none;
    }
    #chat-ui.rc-send-zoom {
        animation: none !important;
    }
}

/*
   i send message zoom from send button
   i style this section
*/
#chat-ui.rc-send-zoom:not(.rc-zoomed) {
    animation: rcSendZoom var(--rc-zoom-duration, 1.6s) var(--rc-zoom-ease, cubic-bezier(0.22, 1, 0.36, 1)) both;
    transform-origin: var(--rc-ripple-x, 50%) var(--rc-ripple-y, 88%);
    transition: none;
}

@keyframes rcSendZoom {
    0%   { transform: scale3d(1, 1, 1); }
    35%  { transform: scale3d(1.03, 1.03, 1); }
    100% { transform: scale3d(1, 1, 1); }
}

/* i win7-style glow sweep on the latest agent tool batch */
#chat-page .tool-call-bubble.is-latest-tools {
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(139, 92, 246, 0.28),
        0 0 14px rgba(139, 92, 246, 0.12);
}

#chat-page .tool-call-bubble.is-latest-tools::after {
    content: '';
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -60%;
    width: 46%;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.04) 18%,
        rgba(255, 255, 255, 0.26) 42%,
        rgba(196, 181, 253, 0.42) 50%,
        rgba(255, 255, 255, 0.26) 58%,
        rgba(255, 255, 255, 0.04) 82%,
        transparent 100%
    );
    animation: toolGlowSweep 2.4s ease-in-out infinite;
    animation-delay: var(--tool-glow-delay, 0s);
}

#chat-page .tool-call-bubble.is-latest-tools > * {
    position: relative;
    z-index: 1;
}

@keyframes toolGlowSweep {
    0%   { transform: translateX(0); }
    100% { transform: translateX(360%); }
}

@media (prefers-reduced-motion: reduce) {
    #chat-page .tool-call-bubble.is-latest-tools::after {
        animation: none;
        opacity: 0.35;
    }
}
