/* Local rules - use only when no shared class fits.
 * Colors come from sc-extension-theme.css variables - they auto-invert in dark mode. */

/* Status pill */
.asr-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-input);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: var(--shadow);
}
.asr-status-label   { font-weight: 600; color: var(--text-primary); }
.asr-status-meta    { color: var(--text-muted); }
.asr-status-sep     { display: inline-block; width: 4px; height: 4px;
                      border-radius: 50%; background: var(--text-muted); }
.asr-status-dot--ok   { color: var(--accent-success); font-size: 14px; }
.asr-status-dot--down { color: var(--accent-danger);  font-size: 14px; }

/* Header brand */
.asr-brand {
    display: flex;
    align-items: center;
    height: 64px;
    padding-left: 16px;
    gap: 12px;
}
.asr-brand-logo { height: 36px; width: 36px; flex: 0 0 36px; }
.asr-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.asr-brand-product {
    font-size: 19px;
    font-weight: 700;
    color: var(--accent-success);
    letter-spacing: 0.2px;
}
.asr-brand-owner {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.3px;
}


/* Sidebar */
.asr-menu-icon {
    display: inline-block;
    width: 24px;
    text-align: center;
    margin-right: 12px;
    color: var(--text-muted);
    font-size: 18px;
    vertical-align: middle;
    transition: color 0.15s ease;
}
.asr-menu-label {
    vertical-align: middle;
    font-size: 14px;
    color: var(--text-primary);
    transition: color 0.15s ease;
}
/* Sidebar selected + hover. Bright green left-edge accent bar (via
 * ::before to bypass any container overflow), bright green icon, bold
 * label. !important on color is required because shared theme has
 * `.webix_selected span { color: inherit !important }`. */
.asr-sidebar-list .webix_list_item { position: relative; }
.asr-sidebar-list .webix_list_item::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
    background: transparent;
    transition: background 0.15s ease;
}
.asr-sidebar-list .webix_list_item:hover::before,
.asr-sidebar-list .webix_list_item.webix_selected::before {
    background: var(--sc-primary);
}
.asr-sidebar-list .webix_list_item:hover .asr-menu-icon,
.asr-sidebar-list .webix_list_item.webix_selected .asr-menu-icon {
    color: var(--sc-primary) !important;
}
.asr-sidebar-list .webix_list_item:hover .asr-menu-label,
.asr-sidebar-list .webix_list_item.webix_selected .asr-menu-label {
    color: var(--accent-success) !important;
    font-weight: 600;
}

/* Typography */
.asr-h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin: 8px 0 12px 0;
    color: var(--text-primary);
}
.asr-h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    margin: 4px 0 8px 0;
    color: var(--text-primary);
}
.asr-h3 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    margin: 16px 0 6px 0;
    color: var(--text-primary);
}
.asr-lead {
    font-size: 16px;
    line-height: 1.55;
    margin: 0 0 16px 0;
    color: var(--text-primary);
    max-width: 820px;
}
.asr-body {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 12px 0;
    color: var(--text-primary);
    max-width: 820px;
}
.asr-bullets {
    margin: 8px 0 16px 18px;
    padding: 0;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-primary);
}

/* Home metric cards */
.asr-metric-card {
    padding: 16px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    margin-right: 12px;
}
.asr-metric-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.asr-metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent-success);
    line-height: 1.1;
    margin-bottom: 6px;
}
.asr-metric-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}
.asr-metric-hint {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}

/* Home CTAs - equal-weight clickable cards */
.asr-cta-prompt {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}
.asr-cta-card {
    cursor: pointer;
    border-radius: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.asr-cta-card .asr-cta-card-inner {
    height: 100%;
    box-sizing: border-box;
    padding: 16px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.asr-cta-card:hover .asr-cta-card-inner {
    border-color: var(--accent-success);
    background: var(--bg-input);
    box-shadow: var(--shadow);
}
.asr-cta-card:hover { transform: translateY(-2px); }
.asr-cta-card:active { transform: translateY(0); }

.asr-cta-line1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}
.asr-cta-line1 .sci {
    color: var(--accent-success);
    font-size: 18px;
    margin-right: 6px;
    vertical-align: -2px;
}
.asr-cta-line2 {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.35;
}

/* Pulse on the recommended CTA. Stops on first hover (handled in JS). */
@keyframes asr-cta-pulse {
    0%, 70%, 100% { box-shadow: 0 0 0 0 rgba(111, 212, 47, 0); }
    35%           { box-shadow: 0 0 0 8px rgba(111, 212, 47, 0.35); }
}
.asr-cta-card--pulse { animation: asr-cta-pulse 3.5s ease-out infinite; }
.asr-cta-card--pulse:hover { animation: none; }
@media (prefers-reduced-motion: reduce) {
    .asr-cta-card--pulse { animation: none; }
    .asr-cta-card { transition: none; }
}

/* Tech Stack permanent sections */
.asr-stack-section {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    overflow: hidden;
}
.asr-stack-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}
.asr-stack-icon {
    color: var(--accent-success);
    font-size: 18px;
    margin-right: 10px;
}
.asr-stack-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.asr-stack-list {
    margin: 0;
    padding: 12px 18px 14px 36px;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-primary);
}
.asr-stack-list li { margin: 2px 0; }

/* Demo view */
.asr-form-section {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 16px 0 8px 0;
}
.asr-form-helper {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    padding: 14px 0 0 12px;
}
.asr-rec-stage {
    margin: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-input);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.asr-rec-stage--active {
    border-color: var(--accent-danger);
    box-shadow: 0 0 0 4px rgba(211, 51, 51, 0.08);
}
.asr-rec-timer {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    color: var(--text-primary);
    margin-left: 8px;
}
.asr-rec-note {
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.asr-btn-disabled { opacity: 0.5; cursor: not-allowed; }
.asr-drop-zone {
    margin: 12px;
    padding: 24px;
    text-align: center;
    border: 2px dashed var(--sc-secondary);
    border-radius: 8px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.asr-drop-zone:hover, .asr-drop-zone--hover {
    border-color: var(--accent-success);
    background: var(--bg-tertiary);
}
.asr-drop-icon {
    font-size: 36px;
    color: var(--accent-success);
}
.asr-drop-title {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.asr-drop-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.asr-empty {
    padding: 18px;
    color: var(--text-muted);
    font-style: italic;
}

/* Recording - tape-recorder buttons (Record / Stop) */
.asr-rec-btn {
    cursor: pointer;
    padding: 12px 22px;
    margin-right: 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.asr-rec-btn:hover:not(:disabled) {
    border-color: var(--accent-success);
    background: var(--bg-tertiary);
}
.asr-rec-btn:active:not(:disabled) { transform: translateY(1px); }
.asr-rec-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.asr-rec-btn .sci {
    font-size: 22px;
    vertical-align: -4px;
    margin-right: 4px;
}
.asr-rec-btn--record .sci { color: var(--accent-danger); }
.asr-rec-btn--stop   .sci { color: var(--text-primary); }
.asr-rec-stage--active .asr-rec-btn--record .sci {
    animation: asr-rec-blink 1s ease-in-out infinite;
}
.asr-rec-stage--active .asr-rec-timer {
    color: var(--accent-danger); font-weight: 600;
    animation: asr-rec-blink 1s ease-in-out infinite;
}
@keyframes asr-rec-blink { 50% { opacity: 0.4; } }

/* Loading + result rendering */
.asr-loading {
    display: flex; align-items: center; gap: 12px;
    padding: 24px;
    color: var(--text-primary);
}
.asr-spinner {
    width: 18px; height: 18px;
    border: 2.5px solid var(--accent-light);
    border-top-color: var(--accent-success);
    border-radius: 50%;
    animation: asr-spin 0.8s linear infinite;
}
.asr-loading-text { font-size: 14px; }
@keyframes asr-spin { to { transform: rotate(360deg); } }

.asr-transcript-text {
    padding: 18px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}
.asr-result-error {
    padding: 18px;
    border-left: 4px solid var(--accent-danger);
    background: var(--error-bg);
    border-radius: 4px;
    margin: 6px;
}
.asr-result-error-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-danger);
    margin-bottom: 4px;
}
.asr-result-error-title .sci { margin-right: 6px; }
.asr-result-error-fix {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* API reference */
.asr-api-meta {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 4px 24px;
    margin: 12px 0 16px 0;
    font-size: 14px;
    color: var(--text-primary);
}
.asr-openapi-frame {
    width: 100%;
    height: 100%;
    min-height: 720px;
    border: 0;
    background: var(--bg-input);
}

/* Dark-theme contrast for selected scsegmented option. */
[data-theme="dark"] .webix_all_segments .webix_selected {
    background: var(--accent-primary);
    color: var(--accent-button-text);
    border-color: var(--accent-primary);
}

/* Mermaid host */
.asr-mermaid-host {
    width: 100%;
    min-height: 220px;
    padding: 12px;
    overflow: auto;
}

/* Architecture section: pinned header above the scrollable diagrams area.
 * Padding mirrors the inner scrollview body so header text aligns with the
 * diagrams below it. Target the inner template node because Webix manages
 * the outer .webix_view box. */
.asr-arch-header .webix_template {
    padding: 24px 24px 0 24px;
}

/* FSM cheat-sheet (How it works) */
.asr-fsm {
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}
.asr-fsm-row {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 8px; row-gap: 12px;
    font-size: 13px;
}
.asr-fsm-node {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: lowercase;
    transition: background 0.15s, border-color 0.15s;
}
.asr-fsm-node.asr-fsm-start { border-color: var(--sc-secondary); }
.asr-fsm-node.asr-fsm-end   { border-color: var(--accent-success); background: var(--bg-tertiary); }
.asr-fsm[data-state="recording"] .asr-fsm-node.asr-fsm-start,
.asr-fsm[data-state="uploading"] .asr-fsm-node {
    background: var(--bg-tertiary);
    border-color: var(--accent-success);
}
.asr-fsm-arrow {
    color: var(--text-muted);
    font-family: monospace;
    letter-spacing: -1px;
    user-select: none;
}
.asr-fsm-branch {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0 4px;
}
.asr-fsm-edge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border: 1px dashed var(--sc-secondary);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12.5px;
    white-space: nowrap;
}
.asr-fsm-edge.asr-fsm-or {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    justify-content: center;
    padding: 0;
}
.asr-fsm-edge .asr-fsm-mic { color: var(--accent-danger); }
.asr-fsm-edge .asr-fsm-file { color: var(--accent-success); }
.asr-fsm-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
    .asr-rec-stage--active .asr-rec-timer,
    .asr-spinner { animation: none; }
}
