/* ==================== CSS Variables ==================== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-tertiary: #ececf1;
    --bg-hover: #f0f0f0;

    --text-primary: #0d0d0d;
    --text-secondary: #666666;
    --text-tertiary: #8e8ea0;

    --border-light: #e5e5e5;
    --border-medium: #d1d1d6;

    --accent-primary: #10b981;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #10b981, #06b6d4);

    --error: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0d0d0d;
        --bg-secondary: #1a1a1a;
        --bg-tertiary: #2a2a2a;
        --bg-hover: #333333;

        --text-primary: #ececf1;
        --text-secondary: #c5c5d2;
        --text-tertiary: #8e8ea0;

        --border-light: #2a2a2a;
        --border-medium: #3a3a3a;
    }
}

/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== App Layout ==================== */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text span {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.new-chat-button {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.new-chat-button:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.chat-history-section {
    margin-top: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 8px;
}

.section-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-history-btn {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.clear-history-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-item {
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.project-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 500;
}

.project-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 12px;
    color: var(--success);
}

.user-menu-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.user-menu-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ==================== Main Container ==================== */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== Top Bar ==================== */
.top-bar {
    height: 60px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.breadcrumb {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-button:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ==================== Chat Area ==================== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ==================== Welcome Screen ==================== */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.welcome-content {
    max-width: 900px;
    width: 100%;
    text-align: center;
}

.welcome-logo {
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.welcome-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.capabilities-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 48px;
}

.capability-card {
    padding: 28px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.capability-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.capability-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.capability-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.capability-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.example-prompts {
    margin-top: 40px;
}

.examples-label {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.examples-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.example-prompt-btn {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.example-prompt-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.example-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.example-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ==================== Messages Container ==================== */
.messages-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px;
}

.message {
    margin-bottom: 32px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--accent-gradient);
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
}

.message-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: auto;
}

.message-content {
    padding-left: 44px;
}

.message-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-text strong {
    font-weight: 600;
    color: var(--accent-primary);
}

/* ==================== Typing Indicator ==================== */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 16px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* ==================== Process Indicator ==================== */
.process-indicator {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px;
}

.process-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.process-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
}

.step-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}

.process-step.active .step-circle {
    border-color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.1);
}

.process-step.completed .step-circle {
    border-color: var(--success);
    background: var(--success);
}

.step-number {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.process-step.active .step-number {
    color: var(--accent-primary);
}

.process-step.completed .step-number {
    display: none;
}

.process-step.completed .step-circle::after {
    content: "✓";
    font-size: 24px;
    color: white;
    font-weight: bold;
}

.step-spinner {
    display: none;
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
}

.process-step.active .step-spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.step-info {
    text-align: center;
    min-width: 140px;
}

.step-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.step-status {
    font-size: 12px;
    color: var(--text-tertiary);
}

.process-step.active .step-status {
    color: var(--accent-primary);
}

.process-connector {
    width: 80px;
    height: 2px;
    background: var(--border-light);
    margin: 0 -12px;
    margin-bottom: 48px;
}

/* ==================== Result Cards ==================== */
.cad-result-card,
.bom-result-card,
.code-result-card {
    margin-top: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: cardSlideIn 0.4s ease-out;
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-card-header {
    padding: 20px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-size,
.badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 16px;
}

.badge.price {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.result-card-actions {
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
}

.result-download-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.result-download-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==================== 3D Viewer ==================== */
/* ==================== 3D Viewer ==================== */
.model-3d-viewer {
    width: 100%;
    height: 700px;
    background: linear-gradient(135deg, #f7f7f8 0%, #ececf1 100%);
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.model-3d-viewer canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    cursor: grab;
}

.model-3d-viewer canvas:active {
    cursor: grabbing;
}














.viewer-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
}

.viewer-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.viewer-control-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: scale(1.1);
}

.viewer-control-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.viewer-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    min-width: 180px;
}

.viewer-info-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.viewer-info-item:last-child {
    margin-bottom: 0;
}

.viewer-info-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.viewer-info-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.fullscreen-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.fullscreen-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: scale(1.05);
}

.viewer-loading,
.viewer-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.viewer-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.viewer-loading p {
    font-size: 14px;
    color: var(--text-secondary);
}

.viewer-help {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ==================== BOM Table ==================== */
.bom-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 24px;
    background: var(--bg-primary);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.bom-table-container {
    max-height: 400px;
    overflow-y: auto;
}

.bom-table {
    width: 100%;
    border-collapse: collapse;
}

.bom-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.bom-table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-light);
}

.bom-table td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}

.bom-table tbody tr:hover {
    background: var(--bg-secondary);
}

.component-name {
    font-weight: 500;
    color: var(--text-primary);
}

.component-price {
    font-weight: 600;
    color: var(--success);
}

.country-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 8px;
}

.domain-text {
    font-size: 12px;
    color: var(--text-tertiary);
}

.view-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.view-link:hover {
    text-decoration: underline;
}

/* ==================== Code Viewer ==================== */
.code-info-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.code-preview {
    max-height: 500px;
    overflow: auto;
    background: #1e1e1e;
}

.code-preview pre {
    margin: 0;
    padding: 24px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.7;
    color: #d4d4d4;
}

.code-preview code {
    display: block;
    white-space: pre;
    word-wrap: normal;
}

/* ==================== Input Area ==================== */
.input-area {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    padding: 16px 20px 20px;
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 4px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    transition: var(--transition);
}

.input-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.attach-button {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.attach-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.message-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    max-height: 200px;
    padding: 10px 8px;
    line-height: 1.5;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.input-footer {
    max-width: 800px;
    margin: 8px auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
}

.char-counter {
    font-size: 12px;
    color: var(--text-tertiary);
}

.input-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ==================== Mobile Menu ==================== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    z-index: 110;
    box-shadow: var(--shadow-md);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ==================== Loading Overlay ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

#loadingText {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 100;
    }

    .sidebar.active {
        transform: translateX(0);
    }


    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .top-bar {
        padding-left: 60px;
    }

    .sidebar-toggle {
        display: none;
    }

    .capabilities-grid {
        grid-template-columns: 1fr;
    }

    .examples-container {
        grid-template-columns: 1fr;
    }

    .welcome-title {
        font-size: 28px;
    }

    .model-3d-viewer {
        height: 400px;
    }

    .bom-stats {
        grid-template-columns: 1fr;
    }

    .viewer-help {
        display: none;
    }

    .input-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 24px;
    }

    .capability-card {
        padding: 20px 16px;
    }

    .result-card-actions {
        flex-direction: column;
    }

    .result-download-btn {
        width: 100%;
    }
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== Utility Classes ==================== */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}