/* 
   one-supplychain - PREMIUM GLASSMORPHISM SYSTEM STYLE
   Author: Antigravity AI
*/

:root {
    /* Yilian Color Palette */
    --tp-primary: #0068B7;       /* 蓝色主题 — 按钮、链接、激活态 */
    --tp-primary-hover: #0180D8; /* 蓝色悬停 */
    --tp-primary-dark: #014A82;  /* 蓝色深色 */
    --tp-primary-light: #E6F4FF; /* 蓝色极淡背景 */

    --bg-dark: #F5F5F5;          /* 页面背景：最外层灰色底 */
    --bg-panel: #FFFFFF;         /* 卡片背景：白色卡片 */
    --bg-panel-hover: #FAFAFA;   /* 次级背景：微弱灰，用于输入框/内嵌区域 */
    --bg-panel-darker: #F0F0F0;  /* 第三级背景：更暗底色，分区隔离 */
    
    --border-color: #D9D9D9;     /* 标准边框 */
    --border-color-light: #F0F0F0;/* 浅色边框 */
    --border-color-active: #0068B7;/* 激活状态边框 */
    
    --text-primary: #262626;     /* 主文字：标题、主要内容 */
    --text-secondary: #595959;   /* 次级文字：标签、描述、辅助 */
    --text-muted: #8C8C8C;       /* 弱化文字 */
    --text-disabled: #BFBFBF;    /* 禁用态文字 */
    
    /* Brand Accent Colors */
    --accent-blue: #0068B7;
    --accent-cyan: #0180D8;
    --accent-green: #52C41A;
    --accent-orange: #f59e0b;
    --accent-red: #FF4D4F;
    --accent-purple: #722ed1;
    
    /* Grouped Gradients */
    --gradient-brand: linear-gradient(135deg, #0068B7 0%, #0180D8 100%);
    --gradient-gold: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    --gradient-success: linear-gradient(135deg, #52C41A 0%, #d1fae5 100%);
    --gradient-danger: linear-gradient(135deg, #FF4D4F 0%, #fee2e2 100%);
    
    /* Fonts */
    --font-ui: 'Open Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Shadows */
    --shadow-main: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-main-hover: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 10px rgba(0, 104, 183, 0.15);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
}

/* Main Container Grid Layout */
.app-container {
    display: grid;
    grid-template-columns: 330px 1fr 380px;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 10;
}

/* Background glow effects */
.glow-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.04) 0%, transparent 40%);
    pointer-events: none;
    z-index: 1;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* SIDEBAR LAYOUTS (LEFT & RIGHT) */
.sidebar {
    background: #FFFFFF;
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    position: relative;
    z-index: 10;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
    padding: 0; /* Let chat handle internal padding */
    background: #FFFFFF;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.03);
}

/* Brand Section (Top Left) */
.brand-section {
    padding-bottom: 5px;
}
.brand-section .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-section .logo i {
    stroke: var(--accent-blue);
}
.brand-section h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 10px;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}
.brand-section .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.3;
}

/* Panel Box Common Styling (Industrial SaaS Card) */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-main);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.panel:hover {
    background: var(--bg-panel-hover);
    border-color: var(--border-color-active);
    box-shadow: var(--shadow-main-hover);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-header h3 i {
    width: 14px;
    height: 14px;
    color: var(--accent-blue);
}

/* Badges */
.badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.badge-success {
    background: rgba(0, 255, 135, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 135, 0.2);
}
.badge-info {
    background: rgba(0, 198, 255, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(0, 198, 255, 0.2);
}
.badge-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Selector Panel */
.selector-panel label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.select-wrapper {
    position: relative;
    width: 100%;
}
#part-selector {
    width: 100%;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    appearance: none;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all 0.2s;
}
#part-selector:focus {
    border-color: var(--border-color-active);
    box-shadow: 0 0 0 2px rgba(0, 104, 183, 0.15);
}
.chevron-select {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* Model Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.summary-item {
    background: var(--bg-panel-hover);
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.summary-item .label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}
.summary-item .value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Surface Classification distribution list */
.class-distribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.class-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: var(--bg-panel-hover);
    border-radius: 6px;
    border: 1px solid var(--border-color-light);
}
.class-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}
.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.class-item .count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Surface colors mapping */
.col-plane { background-color: #f1c40f; }
.col-cylinder { background-color: #2ecc71; }
.col-cone { background-color: #1abc9c; }
.col-torus { background-color: #e67e22; }
.col-bspline { background-color: #3498db; }
.col-sphere { background-color: #9b59b6; }
.col-unknown { background-color: #95a5a6; }

/* DFM Diagnostic Warnings */
.dfm-warnings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dfm-warning-card {
    background: #FFF1F0;
    border: 1px solid #FFCCC7;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--accent-red);
    display: flex;
    gap: 8px;
}
.dfm-warning-card i {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--accent-red);
    margin-top: 1px;
}
.dfm-status-ok {
    background: #F6FFED;
    border-color: #D9F7BE;
    color: var(--accent-green);
}
.dfm-status-ok i {
    color: var(--accent-green);
}

/* Empty State Styling */
.empty-state {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.empty-state i {
    width: 18px;
    height: 18px;
}

/* Active face selected details table */
.active-face-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.active-face-card {
    background: var(--bg-panel-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.active-face-title {
    font-weight: 700;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 4px;
    margin-bottom: 4px;
}
.active-face-row {
    display: flex;
    justify-content: space-between;
}
.active-face-row .lbl {
    color: var(--text-muted);
}
.active-face-row .val {
    font-weight: 600;
    color: var(--text-primary);
}

/* CENTER VIEWPORT (THREEJS CANVAS & HEADING) */
.main-viewport {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #f0f2f5;
    z-index: 5;
}

.viewport-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none; /* Let clicks pass to 3D canvas */
    z-index: 20;
}
.viewport-header * {
    pointer-events: auto; /* Re-enable controls interaction */
}

.header-title h1 {
    font-size: 1.15rem;
    font-weight: 800;
    margin-top: 4px;
    letter-spacing: 0.5px;
    text-shadow: none;
    color: var(--text-primary);
}

/* Legends inside Viewport top-right */
.color-legends {
    display: flex;
    gap: 12px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 8px;
    box-shadow: var(--shadow-main);
    transform: translateY(5px);
    opacity: 0;
    transition: opacity 0.3s;
}
.color-legends.visible {
    opacity: 1;
}
.legend-item {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-color {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}
.legend-plane { background: #f1c40f; }
.legend-cylinder { background: #2ecc71; }
.legend-cone { background: #1abc9c; }
.legend-torus { background: #e67e22; }
.legend-bspline { background: #3498db; }

/* 3D Canvas Container */
#canvas-container {
    flex-grow: 1;
    position: relative;
    outline: none;
}
#canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Spinner overlay for loading state */
.canvas-loading {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 100;
    transition: opacity 0.4s ease-out;
}
.canvas-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 104, 183, 0.1);
    border-top-color: var(--tp-primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.canvas-loading p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Bottom Floating Viewport Toolbar */
.viewport-toolbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 20;
}
.tool-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.tool-btn i {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}
.tool-btn:hover {
    color: var(--tp-primary);
    background: rgba(0, 104, 183, 0.05);
}
.tool-btn:hover i {
    transform: scale(1.1);
}
.tool-btn.active {
    color: #FFFFFF;
    background: var(--tp-primary);
    box-shadow: 0 2px 8px rgba(0, 104, 183, 0.2);
}
.tool-btn.active i {
    stroke: #FFFFFF;
}
.tool-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

/* RIGHT SIDEBAR: AI COPILOT CHAT SYSTEM */
.right-sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #FFFFFF;
}

/* Copilot Header */
.copilot-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.agent-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    background: rgba(0, 104, 183, 0.08);
    border: 1px solid rgba(0, 104, 183, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bot-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-blue);
}
.status-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    bottom: -2px;
    right: -2px;
    border: 2px solid #FFFFFF;
}
.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}
.agent-info h3 {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
}
.agent-info p {
    font-size: 0.68rem;
    color: var(--text-muted);
}
.model-badge {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--accent-orange);
    border: 1px solid rgba(243, 156, 18, 0.25);
    background: rgba(243, 156, 18, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Chat History feed */
.chat-feed {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #FAFAFA;
}

.msg-bubble {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 88%;
    animation: slideIn 0.25s ease-out;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-bubble.user {
    align-self: flex-end;
}
.msg-bubble.ai {
    align-self: flex-start;
}

/* Meta info above bubble */
.msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.msg-meta i {
    width: 12px;
    height: 12px;
}
.user .msg-meta {
    justify-content: flex-end;
}

/* Content Body */
.msg-content {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.83rem;
    line-height: 1.55;
    word-break: break-word;
}

.user .msg-content {
    background: var(--tp-primary-light);
    border: 1px solid rgba(0, 104, 183, 0.15);
    color: var(--tp-primary-dark);
    border-top-right-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 104, 183, 0.05);
}

.ai .msg-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-top-left-radius: 2px;
    box-shadow: var(--shadow-main);
}
.ai .msg-content ul, .ai .msg-content ol {
    margin-left: 18px;
    margin-top: 5px;
    margin-bottom: 5px;
}
.ai .msg-content li {
    margin-bottom: 4px;
}

/* DEEPSEEK DEEP THINKING COLLAPSIBLE ACCORDION STYLE */
.thinking-container {
    background: var(--bg-panel-darker);
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}
.thinking-details {
    width: 100%;
}
.thinking-summary {
    list-style: none;
    outline: none;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    transition: background 0.2s;
}
.thinking-summary:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-secondary);
}
.thinking-summary::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-orange);
    display: inline-block;
    box-shadow: 0 0 6px var(--accent-orange);
}
.thinking-details[open] .thinking-summary::before {
    background: var(--tp-primary);
    box-shadow: 0 0 6px var(--tp-primary);
}
.thinking-summary::-webkit-details-marker {
    display: none;
}
.thinking-content {
    padding: 10px 14px;
    border-top: 1px solid var(--border-color-light);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 180px;
    overflow-y: auto;
    border-left: 2px solid var(--tp-primary);
}

/* Chat Input and Quick Buttons area */
.chat-input-area {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Quick prompts horizontal scroll */
.quick-tags {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none; /* Hide scrollbars on Firefox */
}
.quick-tags::-webkit-scrollbar {
    display: none; /* Hide scrollbars on Chrome/Safari */
}

.tag-btn {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 16px;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.tag-btn:hover {
    color: var(--tp-primary);
    background: var(--tp-primary-light);
    border-color: var(--tp-primary);
    transform: translateY(-1px);
}

/* Form inputs styling */
.chat-form {
    position: relative;
    display: flex;
    background: var(--bg-panel-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-form:focus-within {
    border-color: var(--border-color-active);
    box-shadow: 0 0 0 2px rgba(0, 104, 183, 0.12);
}
#chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 10px;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    resize: none;
    outline: none;
    line-height: 1.4;
}
#chat-input::placeholder {
    color: var(--text-disabled);
}
.btn-voice-large {
    width: 100%;
    height: 48px;
    background: var(--gradient-brand);
    border: none;
    border-radius: 12px;
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 104, 183, 0.15);
    transition: all 0.2s ease;
    user-select: none;
    touch-action: none;
}
.btn-voice-large:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 104, 183, 0.25);
}
.btn-voice-large:active {
    transform: translateY(1px);
}
.btn-voice-large.recording {
    background: linear-gradient(135deg, var(--accent-red) 0%, #ff7875 100%);
    box-shadow: 0 4px 15px rgba(255, 77, 79, 0.4);
    animation: pulseMicBtn 1s infinite alternate;
}
@keyframes pulseMicBtn {
    0% { transform: scale(1); }
    100% { transform: scale(1.04); box-shadow: 0 0 12px rgba(255, 77, 79, 0.3); }
}
.btn-voice-large i {
    width: 18px;
    height: 18px;
}

/* Pulsing dot animation for typing/loading state */
.typing-bubble {
    background: var(--bg-panel-hover);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 12px;
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    border-top-left-radius: 2px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: wave 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Floating AAG Graph Panel Styles */
.aag-graph-panel {
    position: absolute;
    top: 100px;
    left: 20px;
    width: 290px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.3s, transform 0.3s;
}

.aag-graph-panel.hidden {
    display: none !important;
}

.aag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 8px;
}

.aag-header h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.aag-header h4 i {
    width: 14px;
    height: 14px;
    color: var(--accent-blue);
}

.close-aag-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-aag-btn:hover {
    background: var(--bg-panel-darker);
    color: var(--text-primary);
}

.close-aag-btn i {
    width: 14px;
    height: 14px;
}

.aag-canvas-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#aag-canvas {
    width: 100%;
    height: 150px;
    background: #fafafa;
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
}

.aag-legend-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    padding-top: 4px;
}

.legend-bar-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.aag-legend-bar .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.aag-legend-bar .line {
    width: 12px;
    height: 2px;
    border-radius: 1px;
    display: inline-block;
}

.line-convex {
    background-color: var(--accent-green);
}

.line-concave {
    background-color: var(--accent-red);
}

.legend-bar-divider {
    width: 1px;
    height: 10px;
    background-color: var(--border-color);
    margin: 0 4px;
}

/* Voice Recording Overlay */
.voice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.voice-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.voice-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.voice-icon-pulsing {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 104, 183, 0.1);
    color: var(--tp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 0 rgba(0, 104, 183, 0.4);
    animation: pulseMic 1.5s infinite;
}

.voice-icon-pulsing i {
    width: 28px;
    height: 28px;
}

@keyframes pulseMic {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 104, 183, 0.4);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 15px rgba(0, 104, 183, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 104, 183, 0);
    }
}

.voice-waves {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 40px;
}

.wave-bar {
    width: 6px;
    height: 10px;
    background-color: var(--tp-primary);
    border-radius: 3px;
    transition: height 0.08s ease; /* Smooth audio wave scaling */
}

.voice-status {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.voice-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}
