/* CPT Coding Assistant Styles v3.8.0 */
:root { --brand: #2563eb; --brand-d: #1e40af; --ink: #111827; --muted: #6b7280; --ring: rgba(37,99,235,.18); --surface: #fff; --border: #e5e7eb; --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1; --success: #10b981; --warning: #f59e0b; --danger: #dc2626; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: #fafafa; }
.container { max-width: 1400px; margin: 32px auto; padding: 0 16px; }
h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 1.9rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
textarea, input { width: 100%; font: inherit; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
textarea:focus, input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.7rem 1.1rem; border-radius: 10px; border: 2px solid var(--brand); background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; transition: all 0.12s; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: 0.65; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-outline:hover { background: #f3f4f6; }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--slate-100); }

/* Primary action button - more prominent */
.btn-primary { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-d) 100%); border-color: var(--brand-d); font-size: 1rem; padding: 0.8rem 1.4rem; }
.btn-primary:hover { filter: brightness(1.1); }

/* Secondary action button - green for MDM */
.btn-secondary { background: linear-gradient(135deg, #059669 0%, #047857 100%); border-color: #047857; color: #fff; }
.btn-secondary:hover { filter: brightness(1.1); }

/* Full CDI button - orange/amber for "deep analysis" */
.btn-cdi { background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%); border-color: #c2410c; color: #fff; }
.btn-cdi:hover { filter: brightness(1.1); }

/* Paste & Analyze button - prominent purple/violet */
.btn-paste { background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); border-color: #5b21b6; color: #fff; font-size: 1rem; padding: 0.8rem 1.4rem; }
.btn-paste:hover { filter: brightness(1.1); }

.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn .spinner { width: 1.1em; height: 1.1em; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.75s linear infinite; }

/* Button with description */
.btn-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.btn-stack .btn-desc { font-size: 0.75rem; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* Copy button */
.copy-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: var(--slate-100); border: 1.5px solid var(--border); border-radius: 6px; font-size: 0.75rem; color: var(--muted); cursor: pointer; transition: all 0.15s; }
.copy-btn:hover { background: var(--slate-200); color: var(--ink); }
.copy-btn.copied { background: #dcfce7; color: #166534; border-color: #86efac; }
.copy-btn svg { width: 14px; height: 14px; }

.card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 16px 18px; margin: 14px 0; }
.result-box { background: #fff; border: 2px solid #111827; border-radius: 16px; padding: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.12); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Tab content - hidden by default, shown when active */
.tab-content { display: none; }
.tab-content.active { display: block; }

.cpt-pill { display: inline-block; font-size: 2rem; font-weight: 800; padding: 8px 20px; background: linear-gradient(135deg, #eef2ff 0%, #dbeafe 100%); border: 2px solid var(--brand); border-radius: 12px; color: var(--brand-d); }
.confidence-bar { display: flex; gap: 8px; margin: 16px 0; }
.confidence-item { flex: 1; text-align: center; }
.confidence-item .label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.confidence-item .bar { height: 6px; background: var(--slate-200); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.confidence-item .bar-fill { height: 100%; background: var(--brand); border-radius: 3px; }
.confidence-item .bar-fill.critical { background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%); }
.confidence-item .value { font-size: 0.85rem; font-weight: 600; }
.mdm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
@media (max-width: 600px) { .mdm-grid { grid-template-columns: 1fr; } }
.mdm-card { background: #fff; border: 1.5px solid var(--border); border-radius: 10px; padding: 14px; }
.mdm-card .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mdm-card .label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.mdm-card .level { font-size: 0.85rem; font-weight: 700; padding: 3px 10px; border-radius: 6px; }
.level-low { background: #dcfce7; color: #166534; }
.level-moderate { background: #fef3c7; color: #92400e; }
.level-high { background: #fee2e2; color: #991b1b; }
.mdm-card .detail { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.mdm-card .concern { font-size: 0.75rem; color: var(--warning); margin-top: 6px; }
.evidence-section { margin-top: 16px; }
.evidence-header { font-size: 0.95rem; font-weight: 600; margin-bottom: 10px; }
.evidence-item { background: #fffbeb; border-left: 3px solid var(--warning); padding: 10px 12px; margin: 8px 0; border-radius: 0 8px 8px 0; font-size: 0.85rem; }
.evidence-item.problems { border-left-color: #ec4899; background: #fdf2f8; }
.evidence-item.data { border-left-color: #3b82f6; background: #eff6ff; }
.evidence-item.risk { border-left-color: #f97316; background: #fff7ed; }
.evidence-item .cat { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.timing-bar { display: flex; gap: 16px; padding: 12px 16px; background: var(--slate-50); border-radius: 8px; font-size: 0.8rem; color: var(--muted); margin-top: 16px; flex-wrap: wrap; align-items: center; }
.chat-panel { display: flex; flex-direction: column; background: var(--slate-50); border: 1.5px solid var(--border); border-radius: 12px; height: 500px; overflow: hidden; }
.chat-header { padding: 14px 18px; background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; }
.chat-context { padding: 12px 18px; background: #eff6ff; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-message { max-width: 85%; padding: 12px 16px; border-radius: 12px; font-size: 0.9rem; line-height: 1.5; }
.chat-message.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-message.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-input-area { padding: 12px 16px; background: #fff; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.chat-input-area input { flex: 1; border-radius: 20px; }
.empty-chat { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--muted); text-align: center; padding: 20px; }
.suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }
.suggestion-chip { padding: 8px 14px; background: #fff; border: 1.5px solid var(--border); border-radius: 20px; font-size: 0.85rem; cursor: pointer; transition: all 0.15s; }
.suggestion-chip:hover { border-color: var(--brand); color: var(--brand); }
.disclaimer { margin-top: 20px; background: #fef9c3; border: 2px solid #eab308; border-radius: 12px; padding: 16px; font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 0.8rem; color: #854d0e; line-height: 1.5; }
.progress-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: none; align-items: center; justify-content: center; z-index: 9999; }
.progress-overlay.active { display: flex; }
.progress-card { background: white; border: 2px solid #000; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); padding: 32px; max-width: 420px; width: 90%; text-align: center; }
.progress-spinner { margin: 0 auto 20px; width: 50px; height: 50px; border: 4px solid #f3f3f3; border-top: 4px solid var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.progress-bar { width: 100%; height: 8px; background: var(--slate-200); border-radius: 4px; overflow: hidden; margin: 16px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand) 0%, #3b82f6 100%); border-radius: 4px; transition: width 0.5s ease-in-out; width: 0%; }

/* Progress steps */
.progress-steps { display: flex; justify-content: center; gap: 24px; margin-top: 16px; }
.progress-step { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.progress-step.active { color: var(--brand); font-weight: 600; }
.progress-step.done { color: var(--success); }
.progress-step .step-icon { width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; }
.progress-step.active .step-icon { background: var(--brand); color: #fff; border-color: var(--brand); }
.progress-step.done .step-icon { background: var(--success); color: #fff; border-color: var(--success); }

.status-row { display: flex; gap: 16px; margin-bottom: 16px; }
.status-indicator { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.status-dot.offline { background: var(--danger); }

/* Note input section */
.note-section { margin-bottom: 20px; }
.note-section label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* Toast notification for copy */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 0.9rem; z-index: 10000; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }

@media (max-width: 600px) { .container { margin: 16px auto; padding: 0 12px; } h1 { font-size: 1.5rem; } .result-box { padding: 16px; } .btn-row { flex-direction: column; } .btn-row .btn { width: 100%; } .btn-stack { width: 100%; } .btn-stack .btn { width: 100%; } }
