/* ── Deep Research Agent ─────────────────────────────────────────────────── */

.nd-research-panel {
    display: none;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.nd-code-layout.nd-research-active .nd-code-explorer,
.nd-code-layout.nd-research-active .nd-code-viewer,
.nd-code-layout.nd-research-active .nd-code-chat-panel,
.nd-code-layout.nd-research-active .nd-ios-preview,
.nd-code-layout.nd-research-active .nd-web-preview,
.nd-code-layout.nd-research-active .nd-translate-input-panel,
.nd-code-layout.nd-research-active .nd-document-preview,
.nd-code-layout.nd-research-active .nd-slides-preview,
.nd-code-layout.nd-research-active .nd-spreadsheet-preview {
    display: none !important;
}

.nd-code-layout.nd-research-active .nd-research-panel {
    display: flex;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.nd-rs-sidebar {
    width: 420px;
    min-width: 360px;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.015);
    overflow: hidden;
    flex-shrink: 0;
}

.nd-rs-report-wrap {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.nd-rs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 13px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.nd-rs-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.01em;
}

.nd-rs-badge svg {
    color: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.nd-rs-back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: transparent;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.nd-rs-back-btn:hover {
    color: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.13);
}

/* ── Collapsible progression ─────────────────────────────────────────────── */

.nd-rs-progress-wrap {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nd-rs-progress-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 13px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.12s;
}

.nd-rs-progress-toggle:hover {
    background: rgba(255, 255, 255, 0.03);
}

.nd-rs-progress-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Animated status dot */
.nd-rs-progress-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    transition: background 0.2s;
}

.nd-rs-progress-dot--running {
    background: rgba(255, 255, 255, 0.7);
    animation: nd-rs-pulse 1.4s ease-in-out infinite;
}

.nd-rs-progress-dot--done {
    background: rgba(134, 239, 172, 0.6);
}

.nd-rs-progress-dot--error {
    background: rgba(248, 113, 113, 0.7);
}

@keyframes nd-rs-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.nd-rs-progress-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nd-rs-progress-chevron {
    color: rgba(255, 255, 255, 0.25);
    transition: transform 0.18s ease;
}

.nd-rs-progress-toggle[aria-expanded="true"] .nd-rs-progress-chevron {
    transform: rotate(180deg);
}

.nd-rs-progress-body {
    overflow: hidden;
}

/* ── Steps ───────────────────────────────────────────────────────────────── */

.nd-rs-steps {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0 6px;
}

.nd-rs-step {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 4px 13px;
}

.nd-rs-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.nd-rs-step--pending .nd-rs-step-icon { color: rgba(255, 255, 255, 0.15); }
.nd-rs-step--running .nd-rs-step-icon { color: rgba(255, 255, 255, 0.65); }
.nd-rs-step--done    .nd-rs-step-icon { color: rgba(255, 255, 255, 0.3); }
.nd-rs-step--error   .nd-rs-step-icon { color: rgba(248, 113, 113, 0.75); }

.nd-rs-step-label {
    font-size: 11px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.38);
    word-break: break-word;
}

.nd-rs-step--running .nd-rs-step-label { color: rgba(255, 255, 255, 0.75); }
.nd-rs-step--done    .nd-rs-step-label { color: rgba(255, 255, 255, 0.25); }
.nd-rs-step--error   .nd-rs-step-label { color: rgba(248, 113, 113, 0.7); }

@keyframes nd-rs-spin {
    to { transform: rotate(360deg); }
}

.nd-rs-spin {
    animation: nd-rs-spin 0.9s linear infinite;
}

/* ── Sources ─────────────────────────────────────────────────────────────── */

.nd-rs-sources {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 13px 10px;
    flex-shrink: 0;
}

.nd-rs-sources-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 6px;
}

.nd-rs-sources-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 140px;
    overflow-y: auto;
}

.nd-rs-source-item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nd-rs-source-link {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    transition: color 0.15s;
}

.nd-rs-source-link:hover {
    color: rgba(255, 255, 255, 0.65);
}

/* ── Chat slot (chatbox embedded in sidebar) ─────────────────────────────── */

.nd-rs-chat-slot {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nd-rs-chat-slot .nd-chat-embedded {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 12px;
}

/* ── Report header ───────────────────────────────────────────────────────── */

.nd-rs-report-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.nd-rs-report-title {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nd-rs-copy-btn,
.nd-rs-export-btn,
.nd-rs-drive-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: rgba(255, 255, 255, 0.38);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}

.nd-rs-copy-btn:hover,
.nd-rs-export-btn:hover,
.nd-rs-drive-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
}

/* Drive logo colors always visible (not affected by text color) */
.nd-rs-drive-btn svg path { transition: opacity 0.15s; }
.nd-rs-drive-btn:not(:hover) svg path { opacity: 0.7; }

.nd-rs-drive-btn--loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Report empty state ──────────────────────────────────────────────────── */

.nd-rs-report-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.07);
}

/* ── Report content ──────────────────────────────────────────────────────── */

.nd-rs-report {
    flex: 1;
    overflow-y: auto;
    padding: 32px 56px 56px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13.5px;
    line-height: 1.72;
}

/* Markdown rendering */
.nd-rs-report h1,
.nd-rs-report h2,
.nd-rs-report h3,
.nd-rs-report h4 {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin: 1.8em 0 0.6em;
    line-height: 1.3;
}

.nd-rs-report h1 {
    font-size: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    padding-bottom: 10px;
    margin-top: 0;
}

.nd-rs-report h2 { font-size: 17px; }
.nd-rs-report h3 { font-size: 14.5px; }
.nd-rs-report h4 { font-size: 13px; color: rgba(255, 255, 255, 0.6); }

.nd-rs-report p { margin: 0.75em 0; }

.nd-rs-report strong { color: rgba(255, 255, 255, 0.95); font-weight: 600; }
.nd-rs-report em     { color: rgba(255, 255, 255, 0.72); }

.nd-rs-report a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.2);
}
.nd-rs-report a:hover {
    color: rgba(255, 255, 255, 0.8);
}

.nd-rs-report ul,
.nd-rs-report ol {
    padding-left: 22px;
    margin: 0.6em 0;
}

.nd-rs-report li { margin: 0.35em 0; }

.nd-rs-report blockquote {
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    padding-left: 16px;
    margin: 1em 0;
    color: rgba(255, 255, 255, 0.48);
    font-style: italic;
}

.nd-rs-report code {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
}

.nd-rs-report pre {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 1em 0;
}

.nd-rs-report pre code {
    background: none;
    padding: 0;
    font-size: 12px;
}

.nd-rs-report table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    margin: 1.2em 0;
}

.nd-rs-report th {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    padding: 7px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.nd-rs-report td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.65);
}

.nd-rs-report tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.nd-rs-report hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 2em 0;
}

/* ── Google Drive toast ──────────────────────────────────────────────────── */

.nd-rs-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(30, 30, 34, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
    font-size: 12.5px;
    z-index: 9999;
    animation: nd-rs-toast-in 0.2s ease;
    backdrop-filter: blur(12px);
    max-width: 320px;
}

.nd-rs-toast--error { border-color: rgba(248, 113, 113, 0.3); color: rgba(248, 113, 113, 0.85); }

@keyframes nd-rs-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
