/* GNC Client - Enterprise NLP Pipeline Builder Styles */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    /* S&P Global Brand Colors */
    --color-primary: #d32f2f;        /* S&P Red */
    --color-primary-dark: #b71c1c;   /* Darker S&P Red */
    --color-secondary: #1976d2;      /* S&P Blue */
    --color-accent: #ff6f00;         /* S&P Orange */
    --color-success: #2e7d32;        /* Professional Green */
    --color-warning: #f57c00;        /* Professional Orange */
    --color-error: #d32f2f;          /* S&P Red for errors */

    /* Professional Grays - S&P Style */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    /* Data Visualization Colors */
    --node-source: #1976d2;          /* Blue for data sources */
    --node-processor: #7b1fa2;       /* Purple for processing */
    --node-sink: #388e3c;            /* Green for outputs */
    --node-analytics: #d32f2f;       /* Red for analytics */

    /* Enhanced Spacing for Professional Look */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;

    /* Modern Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Professional Shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px 0 rgb(0 0 0 / 0.06);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);

    /* Enhanced Layout for Larger Canvas */
    --header-height: 64px;
    --sidebar-width: 320px;
    --config-panel-width: 380px;
    --canvas-min-height: calc(100vh - 64px);
}

/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-900);
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Import Neue Haas Grotesk for logo */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@font-face {
    font-family: 'Neue Haas Grotesk';
    src: url('https://fonts.cdnfonts.com/css/neue-haas-grotesk-display-pro') format('woff2');
    font-weight: 400 700;
    font-display: swap;
}

/* ============================================
   Loading Screen
   ============================================ */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: var(--space-md);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   App Layout
   ============================================ */
.gnc-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #ffffff;
}

.app-shell {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* S&P Global Style Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-lg);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 2px solid var(--color-primary);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.app-header::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 50%, var(--color-primary) 100%);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.header-center {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.app-title {
    font-family: 'Neue Haas Grotesk', 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
    letter-spacing: -0.8px;
    text-rendering: optimizeLegibility;
}

.app-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logo {
    font-family: 'Neue Haas Grotesk', 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.6px;
    text-rendering: optimizeLegibility;
}

.logo-icon {
    margin-right: var(--space-xs);
}

/* ============================================
   Enhanced Sidebar - S&P Global Style
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-right: 1px solid var(--gray-300);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 2px solid var(--gray-200);
    background: white;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
    letter-spacing: -0.3px;
}

.node-category {
    padding: var(--space-md);
}

.category-header {
    display: flex;
    align-items: center;
    padding: var(--space-md) var(--space-sm);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-sm);
}

.node-palette-item {
    display: flex;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-xs) 0;
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.node-palette-item:hover {
    background: white;
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.node-palette-item:active {
    cursor: grabbing;
    transform: translateY(0);
}

.node-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    margin-right: var(--space-md);
    font-size: 20px;
    box-shadow: var(--shadow-sm);
}

.node-icon.source {
    background: linear-gradient(135deg, var(--node-source) 0%, color-mix(in srgb, var(--node-source) 80%, white) 100%);
    color: white;
}
.node-icon.processor {
    background: linear-gradient(135deg, var(--node-processor) 0%, color-mix(in srgb, var(--node-processor) 80%, white) 100%);
    color: white;
}
.node-icon.sink {
    background: linear-gradient(135deg, var(--node-sink) 0%, color-mix(in srgb, var(--node-sink) 80%, white) 100%);
    color: white;
}
.node-icon.analytics {
    background: linear-gradient(135deg, var(--node-analytics) 0%, color-mix(in srgb, var(--node-analytics) 80%, white) 100%);
    color: white;
}

.node-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

/* ============================================
   Enhanced Main Content Area
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
}

.app-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.app-sidebar {
    /* Sidebar styles handled above */
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* Allows flex item to shrink */
}

.app-config-panel {
    width: var(--config-panel-width);
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-left: 1px solid var(--gray-300);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}

.tab-bar {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.tab-button {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--gray-300);
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.tab-button:hover:not(.active) {
    background: var(--gray-50);
    border-color: var(--gray-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.tab-icon {
    font-size: 16px;
}

.tab-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8f9fa;
    max-height: calc(100vh - 120px);
}

.pipeline-view {
    width: 100%;
    height: 100%;
    position: relative;
}

.content-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* ============================================
   Enterprise Canvas - S&P Global Style
   ============================================ */
.pipeline-canvas {
    width: 100%;
    height: 100%;
    min-height: var(--canvas-min-height);
    background: linear-gradient(180deg, #fafbfc 0%, #f4f6f8 100%);
    position: relative;
    overflow: auto;
}

.pipeline-canvas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(99, 115, 129, 0.08) 1px, transparent 0);
    background-size: 24px 24px;
    pointer-events: none;
}

/* Context Bar */
.pipeline-context-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 12px 24px;
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.pipeline-context-bar .pipeline-name {
    color: #1e293b;
    font-weight: 600;
    margin-right: 16px;
}

.pipeline-context-bar .status-text {
    color: #64748b;
}

/* Empty State Card */
.pipeline-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 48px 40px;
    max-width: 520px;
    width: 90%;
    text-align: center;
}

.empty-state-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
    opacity: 0.8;
}

.empty-state-node {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.empty-state-node.source {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.empty-state-node.processor {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.empty-state-node.output {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.empty-state-connector {
    width: 32px;
    height: 2px;
    background: linear-gradient(90deg, #cbd5e1 0%, #94a3b8 50%, #cbd5e1 100%);
    border-radius: 1px;
    position: relative;
}

.empty-state-connector::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -2px;
    width: 0;
    height: 0;
    border-left: 6px solid #94a3b8;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 24px;
    font-family: 'Neue Haas Grotesk', 'Inter', sans-serif;
}

.empty-state-checklist {
    list-style: none;
    margin: 0 0 32px 0;
    padding: 0;
}

.empty-state-checklist li {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 0;
    font-size: 16px;
    color: #475569;
}

.empty-state-checklist li::before {
    content: '✓';
    color: #10b981;
    font-weight: 600;
    margin-right: 12px;
    font-size: 14px;
}

.empty-state-cta {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(211, 47, 47, 0.25);
    font-family: 'Neue Haas Grotesk', 'Inter', sans-serif;
}

.empty-state-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -1px rgba(211, 47, 47, 0.35);
}

/* Pipeline Nodes - Enterprise Cards */
.pipeline-node {
    cursor: move;
    transition: all 0.2s ease;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: none;
    position: relative;
    overflow: hidden;
}

.pipeline-node::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--node-accent-color, #94a3b8);
}

.pipeline-node.source::before {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}

.pipeline-node.processor::before {
    background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
}

.pipeline-node.output::before {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.pipeline-node:hover {
    /* No transform - prevents flickering on SVG canvas nodes */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pipeline-node.selected {
    box-shadow: 0 8px 16px rgba(211, 47, 47, 0.25);
    border: 2px solid var(--color-primary);
}

.pipeline-node .node-body {
    padding: 16px 20px;
    border: none;
    background: transparent;
}

.pipeline-node .node-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 4px;
}

.pipeline-node .node-subtitle {
    font-size: 12px;
    color: #64748b;
}

/* Connection Lines - Subtle Dotted */
.connection-line path {
    stroke: #cbd5e1;
    stroke-width: 2;
    stroke-dasharray: 6 4;
    transition: all 0.2s ease;
    fill: none;
}

.connection-line:hover path {
    stroke: #94a3b8;
    stroke-width: 3;
}

.connection-line .arrow-marker {
    fill: #cbd5e1;
    transition: fill 0.2s ease;
}

.connection-line:hover .arrow-marker {
    fill: #94a3b8;
}

/* Port Handles */
.port-handle circle {
    fill: #e2e8f0;
    stroke: #cbd5e1;
    stroke-width: 2;
    transition: all 0.2s ease;
}

.port-handle:hover circle {
    fill: var(--color-primary);
    stroke: var(--color-primary-dark);
    r: 6;
}

/* SVG Canvas Node - Override for better hover behavior */
.pipeline-node {
    cursor: move;
    transition: box-shadow 0.15s ease, filter 0.15s ease;
    /* Prevent hover event bubbling issues */
    pointer-events: bounding-box;
}

.pipeline-node.selected .node-body {
    stroke-width: 3;
    stroke: var(--color-primary);
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.3);
}

.port-handle circle {
    transition: all 0.2s ease;
}

.port-handle:hover circle {
    r: 6;
    fill: var(--color-primary);
}

.connection-line path {
    transition: stroke-width 0.2s ease, stroke 0.2s ease;
    stroke-width: 2;
}

.connection-line:hover path {
    stroke-width: 3;
    stroke: var(--color-primary);
    /* Removed filter to prevent flickering */
}

/* ============================================
   Enhanced Mode Toggle - S&P Global Style
   ============================================ */
.mode-toggle {
    display: flex;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    border-radius: var(--radius-md);
    padding: 4px;
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.mode-btn {
    padding: var(--space-md) var(--space-lg);
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mode-btn:hover:not(.active) {
    color: var(--gray-800);
    background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* ============================================
   Config Panel
   ============================================ */
.config-panel {
    width: var(--config-panel-width);
    background: white;
    border-left: 1px solid var(--gray-200);
    overflow-y: auto;
}

.node-config-panel {
    padding: var(--space-md);
}

.config-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--gray-400);
}

.config-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-md);
}

.config-icon {
    font-size: 24px;
}

.config-title {
    font-size: 16px;
    font-weight: 600;
}

.config-section {
    margin-bottom: var(--space-lg);
}

.config-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: var(--space-sm);
}

/* File Preview Styles */
.file-preview {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-sm);
}

.file-preview p {
    margin: var(--space-xs) 0;
    font-size: 13px;
    color: var(--gray-700);
}

.file-preview strong {
    color: var(--gray-900);
    font-weight: 600;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.form-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: var(--space-xs);
    margin-bottom: 0;
}

/* Private Key Input (Snowflake) */
.private-key-input {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    white-space: pre;
    background: var(--gray-50);
}

.private-key-input::placeholder {
    color: var(--gray-400);
    white-space: pre-line;
}

/* Toggle Button Group */
.toggle-group {
    display: flex;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: white;
    border: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-btn:not(:last-child) {
    border-right: 1px solid var(--gray-300);
}

.toggle-btn:hover:not(.active) {
    background: var(--gray-50);
}

.toggle-btn.active {
    background: var(--color-primary);
    color: white;
}

/* SQL Editor */
.sql-editor {
    width: 100%;
    min-height: 120px;
    padding: var(--space-md);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    resize: vertical;
}

.sql-editor:focus {
    outline: none;
    border-color: var(--color-primary);
    background: white;
}

/* Data Source Config Section */
.data-source-config {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--gray-200);
}

/* Configuration Summary */
.config-summary {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--gray-700);
}

.config-summary .summary-label {
    font-weight: 600;
    color: var(--gray-500);
}

/* Save Row */
.save-row {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--gray-200);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.form-row {
    display: flex;
    gap: var(--space-sm);
}

.form-row .form-group.flex-1 { flex: 1; }
.form-row .form-group.flex-2 { flex: 2; }
.form-row .form-group { flex: 1; }

/* Test connection result */
.test-result {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
    font-size: 13px;
}

.test-result.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.test-result.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.test-result .icon {
    font-weight: bold;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: var(--space-xs);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* ============================================
   Enhanced Buttons - S&P Global Style
   ============================================ */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: var(--space-md) var(--space-lg);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, #8b0000 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: linear-gradient(135deg, white 0%, var(--gray-50) 100%);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-color: var(--gray-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-error) 0%, #b71c1c 100%);
    color: white;
    border-color: var(--color-error);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #b71c1c 0%, #8b0000 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

.button-row {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

/* ============================================
   Enhanced Header Action Buttons
   ============================================ */
.header-action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    min-height: 40px;
    backdrop-filter: blur(10px);
}

.header-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.header-action-btn:hover::before {
    left: 100%;
}

/* Pipeline Builder Button - Primary Action */
.header-action-btn.pipeline-builder {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

.header-action-btn.pipeline-builder:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, #8b0000 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(211, 47, 47, 0.4);
    border-color: var(--color-primary-dark);
}

.header-action-btn.pipeline-builder:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(211, 47, 47, 0.3);
}

/* Analytics Compare Button - Secondary Action */
.header-action-btn.analytics-compare {
    background: linear-gradient(135deg, var(--color-secondary) 0%, #1565c0 100%);
    color: white;
    border-color: var(--color-secondary);
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

.header-action-btn.analytics-compare:hover {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.4);
    border-color: #1565c0;
}

.header-action-btn.analytics-compare:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(25, 118, 210, 0.3);
}

/* Button Icons */
.header-action-btn .btn-icon {
    font-size: 16px;
    transition: transform 0.2s ease;
}

.header-action-btn:hover .btn-icon {
    transform: scale(1.1);
}

/* Button Text */
.header-action-btn .btn-text {
    font-family: 'Neue Haas Grotesk', 'Inter', sans-serif;
    letter-spacing: -0.2px;
    text-rendering: optimizeLegibility;
}

/* Responsive Button Behavior */
@media (max-width: 768px) {
    .header-action-btn .btn-text {
        display: none;
    }
    
    .header-action-btn {
        padding: var(--space-sm);
        min-width: 40px;
        justify-content: center;
    }
}

/* Button Loading State */
.header-action-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.header-action-btn.loading .btn-icon {
    animation: spin 1s linear infinite;
}

/* Button Success State */
.header-action-btn.success {
    background: linear-gradient(135deg, var(--color-success) 0%, #1b5e20 100%);
    border-color: var(--color-success);
}

.header-action-btn.success:hover {
    background: linear-gradient(135deg, #1b5e20 0%, #0d4e14 100%);
}

/* ============================================
   Script Editor
   ============================================ */
.script-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Pipeline Name Editor */
.pipeline-name-container {
    display: flex;
    align-items: center;
}

.pipeline-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.pipeline-name:hover {
    background: var(--gray-100);
}

.pipeline-name .pipeline-label {
    color: var(--gray-500);
    font-size: 12px;
}

.pipeline-name .pipeline-value {
    color: var(--gray-800);
    font-weight: 600;
    font-size: 13px;
}

.pipeline-name .edit-hint {
    opacity: 0;
    transition: opacity 0.15s ease;
    color: var(--gray-400);
}

.pipeline-name:hover .edit-hint {
    opacity: 1;
}

.pipeline-name-input {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    color: var(--gray-800);
    font-size: 13px;
    font-weight: 500;
    width: 200px;
    outline: none;
}

.pipeline-name-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

.format-select {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.dirty-indicator {
    font-size: 12px;
    color: var(--color-warning);
}

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.line-numbers {
    width: 48px;
    padding: var(--space-md) var(--space-sm);
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--gray-400);
    user-select: none;
    overflow: hidden;
}

.code-area {
    flex: 1;
    padding: var(--space-md);
    border: none;
    resize: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: white;
}

.code-area:focus {
    outline: none;
}

.code-area.has-errors {
    background: color-mix(in srgb, var(--color-error) 5%, white);
}

.error-panel {
    background: color-mix(in srgb, var(--color-error) 10%, white);
    border-top: 1px solid var(--color-error);
    padding: var(--space-md);
    max-height: 200px;
    overflow-y: auto;
}

.error-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    color: var(--color-error);
    margin-bottom: var(--space-sm);
}

.error-list {
    list-style: none;
}

.error-item {
    padding: var(--space-xs) 0;
    font-size: 13px;
}

.error-line {
    font-weight: 500;
    margin-right: var(--space-xs);
}

/* ============================================
   Privacy Shield
   ============================================ */
.privacy-shield {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
}

.status-on-premise {
    background: color-mix(in srgb, var(--color-success) 15%, white);
    color: var(--color-success);
}

.status-cloud {
    background: color-mix(in srgb, var(--color-primary) 15%, white);
    color: var(--color-primary);
}

.status-unknown {
    background: var(--gray-100);
    color: var(--gray-500);
}

.shield-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    z-index: 100;
    margin-top: var(--space-xs);
}

.privacy-details {
    padding: var(--space-md);
}

.privacy-details h4 {
    font-size: 14px;
    margin-bottom: var(--space-md);
}

.feature-list {
    list-style: none;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 13px;
}

.feature-item.secure .check {
    color: var(--color-success);
}

.feature-item.warning .warn {
    color: var(--color-warning);
}

.compliance-badges {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-md);
}

.compliance-badges .badge {
    padding: 2px var(--space-sm);
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

/* ============================================
   Feedback Button & Modal
   ============================================ */
.feedback-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.feedback-btn .icon {
    width: 14px;
    height: 14px;
}

.feedback-btn-text {
    display: none;
}

@media (min-width: 768px) {
    .feedback-btn-text {
        display: inline;
    }
}

/* Feedback Modal Backdrop */
.feedback-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Feedback Modal */
.feedback-modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 95%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
}

.feedback-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.feedback-close-btn {
    background: none;
    border: none;
    padding: var(--space-xs);
    cursor: pointer;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.feedback-close-btn:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Feedback Form */
.feedback-form {
    padding: var(--space-lg);
}

.feedback-type-selector {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.feedback-type-selector .type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-type-selector .type-btn:hover {
    background: var(--gray-200);
}

.feedback-type-selector .type-btn.active {
    background: color-mix(in srgb, var(--color-primary) 10%, white);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.feedback-error {
    background: color-mix(in srgb, var(--color-error) 10%, white);
    color: var(--color-error);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: var(--space-md);
}

.feedback-form .form-group {
    margin-bottom: var(--space-md);
}

.feedback-form .form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-xs);
}

.feedback-form .form-label .required {
    color: var(--color-error);
}

.feedback-form .form-label .optional {
    color: var(--gray-400);
    font-weight: normal;
    font-size: 12px;
}

.feedback-form .form-input,
.feedback-form .form-textarea,
.feedback-form .form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feedback-form .form-input:focus,
.feedback-form .form-textarea:focus,
.feedback-form .form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.feedback-form .form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.feedback-form .form-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: var(--space-xs);
}

.feedback-form .char-count {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-200);
}

.form-actions .btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-actions .btn-secondary {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.form-actions .btn-secondary:hover {
    background: var(--gray-200);
}

.form-actions .btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #2563eb 100%);
    border: none;
    color: white;
}

.form-actions .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.form-actions .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-actions .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.feedback-footer {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    text-align: center;
    font-size: 12px;
    color: var(--gray-500);
}

.feedback-footer strong {
    color: var(--gray-700);
}

/* Feedback Success State */
.feedback-success {
    padding: var(--space-xl);
    text-align: center;
}

.feedback-success .success-icon {
    color: var(--color-success);
    margin-bottom: var(--space-md);
}

.feedback-success h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-sm);
}

.feedback-success p {
    color: var(--gray-600);
    margin-bottom: var(--space-sm);
}

.feedback-success .ticket-id {
    background: var(--gray-100);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-family: monospace;
    display: inline-block;
    margin-bottom: var(--space-lg);
}

.feedback-success .ticket-id strong {
    color: var(--color-primary);
}

/* ============================================
   License Badge
   ============================================ */
.license-badge {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    position: relative;
}

.license-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 400px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    z-index: 100;
    margin-top: var(--space-xs);
}

.license-details {
    padding: var(--space-md);
}

.tier-comparison {
    display: flex;
    gap: var(--space-md);
    margin: var(--space-md) 0;
}

.tier-card {
    flex: 1;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.tier-card.current {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.tier-header {
    padding: var(--space-sm);
    color: white;
    font-weight: 600;
    text-align: center;
    font-size: 13px;
}

.tier-features {
    list-style: none;
    padding: var(--space-sm);
}

.tier-feature {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) 0;
    font-size: 12px;
    color: var(--gray-500);
}

.tier-feature.included {
    color: var(--gray-800);
}

.tier-feature .feature-check {
    width: 16px;
    color: var(--color-success);
}

.tier-feature:not(.included) .feature-check {
    color: var(--gray-300);
}

/* ============================================
   Compare Tab
   ============================================ */
.compare-tab {
    padding: var(--space-lg);
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    overflow-y: auto;
}

.compare-header h2 {
    font-size: 20px;
    margin-bottom: var(--space-sm);
}

.compare-description {
    color: var(--gray-500);
    margin-bottom: var(--space-lg);
}

.compare-section {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    margin-bottom: var(--space-lg);
}

.compare-section h3 {
    font-size: 14px;
    margin-bottom: var(--space-md);
}

.sample-input textarea {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    resize: vertical;
    margin-bottom: var(--space-sm);
}

.sample-list {
    margin-top: var(--space-md);
}

.sample-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
}

.sample-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.sample-preview {
    flex: 1;
    font-size: 13px;
    color: var(--gray-600);
}

.btn-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    font-size: 18px;
    cursor: pointer;
}

.btn-remove:hover {
    color: var(--color-error);
}

.plugin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.plugin-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
}

.plugin-card:hover {
    border-color: var(--gray-300);
}

.plugin-card.selected {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 5%, white);
}

.plugin-checkbox {
    font-size: 18px;
    color: var(--gray-400);
}

.plugin-card.selected .plugin-checkbox {
    color: var(--color-primary);
}

.plugin-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.plugin-desc {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
}

.compare-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.compare-hint {
    font-size: 13px;
    color: var(--gray-500);
}

.compare-results {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.results-summary {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.summary-card {
    flex: 1;
    padding: var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.summary-card h4 {
    font-size: 14px;
    margin-bottom: var(--space-sm);
}

.summary-stats {
    display: flex;
    gap: var(--space-lg);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: var(--space-sm);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.results-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    background: var(--gray-50);
}

.result-cell .cell-content {
    font-size: 13px;
}

.confidence-bar {
    display: inline-block;
    height: 4px;
    background: var(--color-primary);
    border-radius: 2px;
}

.export-options {
    margin-top: var(--space-lg);
    display: flex;
    gap: var(--space-sm);
}

/* Sentiment Breakdown */
.sentiment-breakdown {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--gray-200);
}

.sentiment-count {
    font-size: 13px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.sentiment-count.positive {
    color: var(--color-success);
    background: color-mix(in srgb, var(--color-success) 15%, white);
}

.sentiment-count.neutral {
    color: var(--gray-600);
    background: var(--gray-100);
}

.sentiment-count.negative {
    color: var(--color-error);
    background: color-mix(in srgb, var(--color-error) 15%, white);
}

/* Results Detail Table */
.results-detail {
    margin-top: var(--space-lg);
}

.results-detail h4 {
    font-size: 14px;
    margin-bottom: var(--space-sm);
}

.text-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.result-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sentiment-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.sentiment-badge.sentiment-positive {
    color: var(--color-success);
    background: color-mix(in srgb, var(--color-success) 15%, white);
}

.sentiment-badge.sentiment-neutral {
    color: var(--gray-600);
    background: var(--gray-100);
}

.sentiment-badge.sentiment-negative {
    color: var(--color-error);
    background: color-mix(in srgb, var(--color-error) 15%, white);
}

.confidence-value {
    font-size: 11px;
    color: var(--gray-500);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: var(--space-sm);
}

.alert-success {
    background: color-mix(in srgb, var(--color-success) 15%, white);
    color: var(--color-success);
}

.alert-error {
    background: color-mix(in srgb, var(--color-error) 15%, white);
    color: var(--color-error);
}

/* ============================================
   Schema Browser
   ============================================ */
.schema-browser {
    margin-top: var(--space-lg);
}

.schema-browser h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: var(--space-sm);
}

.table-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
}

.table-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.table-item:hover {
    background: var(--gray-50);
}

.table-item.selected {
    background: color-mix(in srgb, var(--color-primary) 10%, white);
}

.table-name {
    flex: 1;
    font-size: 13px;
}

.column-count {
    font-size: 11px;
    color: var(--gray-400);
}

.column-details {
    margin-top: var(--space-md);
}

.column-details h5 {
    font-size: 13px;
    margin-bottom: var(--space-sm);
}

.column-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}

.column-table th,
.column-table td {
    padding: var(--space-xs) var(--space-sm);
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.column-table .type {
    font-family: 'JetBrains Mono', monospace;
    color: var(--color-primary);
}

/* ============================================
   Minimap
   ============================================ */
.minimap {
    position: absolute;
    bottom: var(--space-md);
    right: var(--space-md);
}

/* ============================================
   Utilities
   ============================================ */
.text-muted {
    color: var(--gray-500);
}

.hidden {
    display: none !important;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .config-panel {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .sidebar,
    .config-panel {
        display: none;
    }
}

/* ============================================
   Enhanced Button Active States & Tab Bar
   ============================================ */

/* Active State for Tab Buttons */
.header-action-btn.active {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-width: 3px;
}

.header-action-btn.pipeline-builder.active {
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4);
    border-color: var(--color-primary-dark);
}

.header-action-btn.analytics-compare.active {
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
    border-color: #1565c0;
}

/* Enhanced Tab Bar Layout Override */
.tab-bar {
    display: flex;
    gap: var(--space-lg) !important;
    padding: var(--space-lg) var(--space-xl) !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    box-shadow: var(--shadow-sm) !important;
    position: relative;
}

.tab-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    opacity: 0.3;
}

/* ============================================
   Modal Components
   ============================================ */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Container */
.modal-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.2s ease;
    max-height: 90vh;
    overflow: hidden;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-small {
    width: 400px;
    max-width: 95vw;
}

.modal-medium {
    width: 600px;
    max-width: 95vw;
}

.modal-large {
    width: 900px;
    max-width: 95vw;
}

.modal-fullscreen {
    width: 95vw;
    height: 90vh;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.modal-close-btn:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

/* Modal Content */
.modal-content {
    flex: 1;
    overflow: auto;
    padding: var(--space-lg);
}

/* Expandable Field */
.expandable-field {
    position: relative;
}

.expandable-field-header {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

.expand-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    opacity: 0.7;
}

.expandable-field:hover .expand-btn {
    opacity: 1;
}

.expand-btn:hover {
    background: var(--color-primary);
    color: white;
}

/* Expandable Modal Content */
.expandable-modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.expandable-textarea {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: var(--space-md);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    resize: none;
    background: var(--gray-900);
    color: #e0e0e0;
}

.expandable-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

/* Result Modal */
.result-modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    gap: var(--space-md);
    color: var(--gray-600);
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading Tips Content */
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    text-align: center;
    max-width: 400px;
    margin-top: var(--space-md);
}

.loading-status {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading-tip {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
    min-height: 40px;
    display: flex;
    align-items: center;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-note {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    background: var(--blue-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--blue-100);
}

.loading-note svg {
    color: var(--blue-500);
    flex-shrink: 0;
}

.loading-note span {
    font-size: 12px;
    color: var(--blue-700);
}

.result-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--gray-500);
}

/* Result Header */
.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--gray-200);
}

.result-stats {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.result-stats .stat {
    font-size: 13px;
    color: var(--gray-600);
}

.result-stats .stat strong {
    color: var(--gray-900);
    font-weight: 600;
}

.result-stats .ones-badge {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

/* View Mode Toggle */
.view-mode-toggle {
    display: flex;
    gap: 2px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 2px;
}

.view-mode-toggle .toggle-btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 2px);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.view-mode-toggle .toggle-btn:hover {
    color: var(--gray-900);
}

.view-mode-toggle .toggle-btn.active {
    background: white;
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* Result Header Actions */
.result-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Export Dropdown */
.export-dropdown-container {
    position: relative;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.export-btn:hover {
    background: var(--color-primary-dark);
}

.export-btn svg {
    flex-shrink: 0;
}

.export-btn .dropdown-arrow {
    margin-left: 2px;
    transition: transform 0.15s ease;
}

.export-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.export-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--gray-700);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s ease;
}

.export-menu-item:hover {
    background: var(--gray-50);
}

.export-menu-item svg {
    color: var(--gray-400);
    flex-shrink: 0;
}

.export-menu-item:hover svg {
    color: var(--color-primary);
}

.export-hint {
    margin-left: auto;
    font-size: 11px;
    color: var(--gray-400);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.pagination-btn {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 13px;
    color: var(--gray-600);
}

/* Result View */
.result-view {
    flex: 1;
    overflow: auto;
}

/* Result Table */
.result-table-container {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.result-table th,
.result-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
}

.result-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    position: sticky;
    top: 0;
    z-index: 10;
}

.result-table th.ones-col {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
}

.result-table tr:hover {
    background: var(--gray-50);
}

.result-table .ones-cell {
    font-weight: 500;
}

.result-table .ones-cell.sentiment-positive {
    color: var(--color-success);
    background: rgba(46, 125, 50, 0.1);
}

.result-table .ones-cell.sentiment-negative {
    color: var(--color-error);
    background: rgba(211, 47, 47, 0.1);
}

.result-table .ones-cell.sentiment-neutral {
    color: var(--gray-600);
}

.result-table .ones-cell.valence-positive {
    color: var(--color-success);
}

.result-table .ones-cell.valence-negative {
    color: var(--color-error);
}

/* HTML View */
.result-html-view {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.html-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.html-view-header .info-text {
    font-size: 13px;
    color: var(--gray-600);
}

.legend {
    display: flex;
    gap: var(--space-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 12px;
    color: var(--gray-600);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.html-content-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

/* Clean, professional card design - Qlik-inspired */
.html-content-item {
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #ffffff;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease;
    position: relative;
}

.html-content-item:hover {
    background: #fafafa;
    border-color: var(--gray-300);
}

/* No colored rails - sentiment indicated only by badge */
.html-content-item.sentiment-positive,
.html-content-item.sentiment-negative,
.html-content-item.sentiment-neutral {
    /* Clean uniform look */
}

/* Clean header - Qlik style */
.item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.item-index {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-400);
    letter-spacing: 0.3px;
}

/* Label indicator (sentiment or domain) */
.item-label {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sentiment-positive .item-label {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.sentiment-negative .item-label {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.sentiment-neutral .item-label {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* Domain classification label */
.domain-label .item-label {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.html-content-item.domain-label {
    border-left-color: #3b82f6;
}

.item-content {
    font-size: 13px;
    line-height: 1.65;
    color: var(--gray-700);
}

/* Subtle sentiment highlighting in HTML content */
.item-content .sentiment-positive {
    background-color: rgba(34, 197, 94, 0.15);
    padding: 0 2px;
    border-radius: 2px;
}

.item-content .sentiment-negative {
    background-color: rgba(239, 68, 68, 0.15);
    padding: 0 2px;
    border-radius: 2px;
}

/* JSON View */
.result-json-view {
    height: 100%;
    overflow: auto;
}

.json-content {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: var(--space-md);
    background: var(--gray-900);
    color: #e0e0e0;
    border-radius: var(--radius-md);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Result Error Display */
.result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xxl);
    text-align: center;
}

.result-error .error-icon {
    font-size: 48px;
    color: var(--color-error);
    margin-bottom: var(--space-md);
}

.result-error h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-sm);
}

.result-error .error-message {
    font-size: 14px;
    color: var(--color-error);
    background: rgba(211, 47, 47, 0.1);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    max-width: 600px;
    word-wrap: break-word;
}

/* ============================================
   Aggregate Result View - Root Cause Analysis
   ============================================ */

.aggregate-result-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: var(--space-md);
}

/* Aggregate Tabs */
.aggregate-tabs {
    display: flex;
    gap: var(--space-xs);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 4px;
    flex-shrink: 0;
}

.aggregate-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 2px);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.aggregate-tab:hover {
    color: var(--gray-900);
    background: rgba(255, 255, 255, 0.5);
}

.aggregate-tab.active {
    background: white;
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* Aggregate Content */
.aggregate-content {
    flex: 1;
    overflow: auto;
}

/* Overview Panel */
.overview-panel {
    padding: var(--space-lg);
}

.panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-lg);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gray-300);
    transition: background 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-600);
}

.stat-card.sentiment-positive::before {
    background: linear-gradient(90deg, var(--color-success) 0%, #4caf50 100%);
}

.stat-card.sentiment-positive {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.02) 0%, white 100%);
}

.stat-card.sentiment-positive .stat-value {
    color: var(--color-success);
}

.stat-card.sentiment-negative::before {
    background: linear-gradient(90deg, var(--color-error) 0%, #f44336 100%);
}

.stat-card.sentiment-negative {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.02) 0%, white 100%);
}

.stat-card.sentiment-negative .stat-value {
    color: var(--color-error);
}

.stat-card.sentiment-neutral::before {
    background: linear-gradient(90deg, var(--gray-500) 0%, var(--gray-400) 100%);
}

.stat-card.sentiment-neutral {
    background: linear-gradient(135deg, rgba(117, 117, 117, 0.02) 0%, white 100%);
}

.stat-card.sentiment-neutral .stat-value {
    color: var(--gray-600);
}

/* Overall Sentiment Card */
.overall-sentiment-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.sentiment-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-700);
}

.sentiment-badge {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sentiment-badge.sentiment-positive {
    background: linear-gradient(135deg, var(--color-success) 0%, #1b5e20 100%);
    color: white;
}

.sentiment-badge.sentiment-negative {
    background: linear-gradient(135deg, var(--color-error) 0%, #b71c1c 100%);
    color: white;
}

.sentiment-badge.sentiment-neutral {
    background: linear-gradient(135deg, var(--gray-500) 0%, var(--gray-700) 100%);
    color: white;
}

/* Sentiment Distribution Bar */
.sentiment-bar-container {
    margin-bottom: var(--space-lg);
}

.sentiment-bar {
    display: flex;
    height: 24px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sentiment-bar-segment {
    transition: width 0.3s ease;
}

.sentiment-bar-segment.positive {
    background: linear-gradient(180deg, #4caf50 0%, #2e7d32 100%);
}

.sentiment-bar-segment.neutral {
    background: linear-gradient(180deg, #9e9e9e 0%, #757575 100%);
}

.sentiment-bar-segment.negative {
    background: linear-gradient(180deg, #f44336 0%, #d32f2f 100%);
}

/* Quick Summary */
.quick-summary {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.quick-summary h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-sm);
}

.quick-summary p {
    font-size: 14px;
    color: var(--gray-700);
    margin: 0;
}

/* No Data State */
.no-data,
.no-causes,
.no-words {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xxl);
    color: var(--gray-500);
    font-size: 14px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

/* Causes Panel */
.causes-panel {
    padding: var(--space-lg);
}

.causes-panel.negative .panel-title {
    color: var(--color-error);
}

.causes-panel.positive .panel-title {
    color: var(--color-success);
}

/* Causes List */
.causes-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Cause Card */
.cause-card {
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.cause-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    transition: background 0.2s ease;
}

.cause-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.cause-card.negative::before {
    background: linear-gradient(180deg, var(--color-error) 0%, #f44336 100%);
}

.cause-card.positive::before {
    background: linear-gradient(180deg, var(--color-success) 0%, #4caf50 100%);
}

.cause-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.cause-name {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.cause-count {
    font-size: 13px;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.cause-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.cause-words {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--gray-100);
}

.words-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-right: var(--space-xs);
}

.word-tag {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.word-tag.negative {
    background: rgba(211, 47, 47, 0.1);
    color: var(--color-error);
}

.word-tag.positive {
    background: rgba(46, 125, 50, 0.1);
    color: var(--color-success);
}

/* Words Panel */
.words-panel {
    padding: var(--space-lg);
}

.words-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.words-column {
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    position: relative;
}

.words-column::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.words-column.negative::before {
    background: linear-gradient(90deg, var(--color-error) 0%, #f44336 100%);
}

.words-column.positive::before {
    background: linear-gradient(90deg, var(--color-success) 0%, #4caf50 100%);
}

.words-column:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.column-title {
    font-size: 14px;
    font-weight: 600;
    padding: var(--space-md);
    margin: 0;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.column-title.negative {
    color: var(--color-error);
}

.column-title.positive {
    color: var(--color-success);
}

/* Word Impact List */
.word-impact-list {
    max-height: 400px;
    overflow-y: auto;
}

.word-impact-table {
    width: 100%;
    border-collapse: collapse;
}

.word-impact-table th,
.word-impact-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

.word-impact-table th {
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-50);
    position: sticky;
    top: 0;
}

.word-impact-table .word-cell {
    font-weight: 500;
    color: var(--gray-900);
}

.word-impact-table .count-cell {
    color: var(--gray-600);
}

.word-impact-table .valence-cell {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.word-impact-table .valence-cell.valence-negative {
    color: var(--color-error);
}

.word-impact-table .valence-cell.valence-positive {
    color: var(--color-success);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .words-columns {
        grid-template-columns: 1fr;
    }

    .aggregate-tabs {
        flex-wrap: wrap;
    }

    .aggregate-tab {
        flex: 1 1 auto;
        min-width: 80px;
    }
}

/* ==========================================================================
   INSIGHT PANEL - Modern Card Design with Expandable Sentences
   ========================================================================== */

/* Insight Panel Container */
.insight-panel {
    padding: var(--space-md);
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
}

.insight-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--gray-100);
}

.insight-panel-indicator {
    width: 4px;
    height: 32px;
    border-radius: 4px;
}

.insight-panel-title {
    flex: 1;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.insight-panel-count {
    font-size: 13px;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

/* No Data State */
.insight-no-data {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    color: var(--gray-500);
}

/* Causes Grid */
.insight-causes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: var(--space-md);
}

/* Cause Card */
.insight-cause-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-100);
}

/* Rail removed for cleaner enterprise look */

.insight-cause-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
    border-color: var(--gray-200);
}

.insight-cause-card.expanded {
    grid-column: 1 / -1;
    border-width: 2px;
}

/* Clean card design - no colored rails */
.insight-cause-card.negative,
.insight-cause-card.positive {
    border-left: 1px solid var(--gray-100);
}

/* Card Header */
.insight-card-header {
    margin-bottom: var(--space-md);
}

.insight-card-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.insight-card-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
}

.insight-expand-indicator {
    font-size: 12px;
    color: var(--gray-400);
    transition: transform 0.2s ease;
    width: 20px;
    text-align: center;
}

/* Card Stats */
.insight-card-stats {
    display: flex;
    gap: var(--space-lg);
}

.insight-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.insight-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.insight-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

/* Word Chips */
.insight-card-words {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-100);
}

.insight-word-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    transition: transform 0.15s ease;
}

.insight-word-chip:hover {
    transform: scale(1.05);
}

.insight-word-chip.negative {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

.insight-word-chip.positive {
    background: rgba(39, 174, 96, 0.1);
    color: #1e8449;
}

.insight-word-count {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 5px;
    border-radius: 10px;
}

/* Click Hint */
.insight-click-hint {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    font-size: 12px;
    color: var(--gray-400);
    font-style: italic;
    text-align: right;
    transition: color 0.2s ease;
}

.insight-cause-card:hover .insight-click-hint {
    color: var(--gray-600);
}

/* Sentences Section */
.insight-sentences-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 2px solid var(--gray-100);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.insight-sentences-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.insight-sentences-count {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: normal;
}

.insight-sentences-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
}

/* Individual Sentence */
.insight-sentence {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border-left: 3px solid var(--gray-300);
    transition: all 0.2s ease;
}

.insight-sentence:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.insight-sentence.positive {
    border-left-color: #27ae60;
    background: rgba(39, 174, 96, 0.05);
}

.insight-sentence.negative {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.05);
}

.insight-sentence-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--gray-800);
    margin-bottom: var(--space-sm);
}

.insight-sentence-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 11px;
    color: var(--gray-500);
}

.insight-sentence-score {
    font-family: 'JetBrains Mono', monospace;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.insight-sentence.positive .insight-sentence-score {
    background: rgba(39, 174, 96, 0.15);
    color: #1e8449;
}

.insight-sentence.negative .insight-sentence-score {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.insight-sentence-keywords {
    font-style: italic;
    color: var(--gray-600);
}

/* Responsive */
@media (max-width: 768px) {
    .insight-causes-grid {
        grid-template-columns: 1fr;
    }

    .insight-cause-card.expanded {
        grid-column: 1;
    }
}

/* ============================================
   Preview Section Styles
   ============================================ */

.preview-results {
    margin-top: var(--space-md);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-stats {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.preview-stats .stat {
    font-size: 12px;
    color: var(--gray-600);
    padding: 2px 8px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

.preview-stats .ones-badge {
    background: var(--primary-100);
    color: var(--primary-700);
}

.preview-stats .expand-btn {
    margin-left: auto;
}

.preview-table-container {
    max-height: 300px;
    overflow: auto;
}

.preview-table-container.fullscreen {
    max-height: none;
    height: 100%;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.preview-table th,
.preview-table td {
    padding: var(--space-xs) var(--space-sm);
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    position: sticky;
    top: 0;
    z-index: 1;
}

.preview-table th.ones-col {
    background: var(--primary-50);
    color: var(--primary-700);
}

.preview-table td.ones-cell {
    background: var(--primary-50);
    color: var(--primary-900);
}

.preview-table tbody tr:hover {
    background: var(--gray-50);
}

.preview-more-hint {
    padding: var(--space-sm) var(--space-md);
    font-size: 12px;
    color: var(--gray-600);
    text-align: center;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    margin: 0;
}

.preview-more-hint a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
}

.preview-more-hint a:hover {
    text-decoration: underline;
}

/* Preview modal header with stats */
.modal-header .preview-stats {
    padding: 0;
    background: transparent;
    border: none;
    flex: 1;
    justify-content: center;
}

/* Save button styles */
.toolbar-button.save {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
}

.toolbar-button.save:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.toolbar-button.save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Status message in toolbar */
.status-message {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    margin-left: 8px;
    animation: fadeIn 0.3s ease;
}

.status-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Sidebar Palette Styles
   ============================================ */
.palette-section {
    margin-bottom: var(--space-sm);
}

.section-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-header:hover {
    background: var(--gray-100);
}

.section-indicator {
    width: 4px;
    height: 16px;
    border-radius: 2px;
    margin-right: var(--space-sm);
}

.section-title {
    flex: 1;
    text-align: left;
}

.section-arrow {
    transition: transform 0.2s ease;
}

.section-arrow.expanded {
    transform: rotate(90deg);
}

.section-content {
    padding: var(--space-xs) 0;
}

.palette-item {
    display: flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    margin: 2px var(--space-sm);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.palette-item:hover {
    background: white;
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.palette-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.palette-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 12px;  /* Extra space between icon and label */
    color: #000000;  /* Black icons */
}

.palette-item-icon svg {
    color: #000000;  /* Ensure SVG icons are black */
    fill: currentColor;
}

.palette-item-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

.sidebar-title {
    padding: var(--space-md) var(--space-lg);
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-200);
}

/* ============================================
   AdHoc Analysis Tab
   ============================================ */
.adhoc-tab {
    padding: var(--space-lg);
    max-width: 900px;
    margin: 0 auto;
    height: 100%;
    overflow-y: auto;
}

.adhoc-header {
    margin-bottom: var(--space-xl);
}

.adhoc-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-sm);
}

.adhoc-description {
    color: var(--gray-500);
    font-size: 14px;
    line-height: 1.6;
}

.adhoc-input-section {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.adhoc-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.adhoc-form .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.adhoc-form .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.adhoc-textarea {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.adhoc-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.adhoc-textarea::placeholder {
    color: var(--gray-400);
}

.char-count {
    font-size: 12px;
    color: var(--gray-400);
    text-align: right;
    transition: color 0.2s ease;
}

.char-count.near-limit {
    color: var(--color-warning);
    font-weight: 500;
}

.char-count.at-limit {
    color: var(--color-error);
    font-weight: 600;
}

.adhoc-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.adhoc-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.adhoc-select option.category-header {
    font-weight: 700;
    color: var(--gray-500);
    background: var(--gray-50);
}

.function-info {
    margin-top: var(--space-xs);
}

.function-details {
    display: flex;
    gap: var(--space-md);
    font-size: 12px;
}

.function-category {
    padding: 2px 8px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: var(--radius-sm);
}

.function-return {
    color: var(--gray-500);
}

.adhoc-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.adhoc-error {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: color-mix(in srgb, var(--color-error) 10%, white);
    border: 1px solid color-mix(in srgb, var(--color-error) 30%, white);
    border-radius: var(--radius-md);
}

.adhoc-error .error-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-error);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.adhoc-error .error-text {
    color: var(--color-error);
    font-size: 14px;
}

.loading-text {
    color: var(--gray-500);
    font-size: 14px;
    font-style: italic;
}

/* AdHoc Result Display */
.adhoc-result {
    margin-top: var(--space-xl);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.adhoc-result h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

/* Export result title row */
.result-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--gray-200);
}

/* Export buttons */
.export-buttons {
    display: flex;
    gap: var(--space-xs);
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.export-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    border-color: var(--gray-300);
}

.export-btn .icon {
    width: 14px;
    height: 14px;
}

.export-btn span {
    line-height: 1;
}

.export-btn-primary {
    background: var(--primary-50);
    color: var(--primary-600);
    border-color: var(--primary-200);
}

.export-btn-primary:hover {
    background: var(--primary-100);
    color: var(--primary-700);
    border-color: var(--primary-300);
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-function {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 10%, white);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.result-time {
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.result-input,
.result-output {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.result-input label,
.result-output label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
}

.input-text {
    font-size: 14px;
    color: var(--gray-700);
    background: var(--gray-50);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    margin: 0;
}

.html-result {
    font-size: 14px;
    line-height: 1.8;
    padding: var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.json-result {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    padding: var(--space-md);
    background: var(--gray-900);
    color: #e0e0e0;
    border-radius: var(--radius-md);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* JSON Result View - Structured visualization */
.json-result-view {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.json-result-view .json-object,
.json-result-view .json-array {
    padding: var(--space-md);
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.json-result-view .json-property {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--gray-200);
    gap: var(--space-md);
    min-width: 0;
    width: 100%;
}

.json-result-view .json-property:last-child {
    border-bottom: none;
}

.json-result-view .json-property:nth-child(odd) {
    background: white;
}

.json-result-view .json-property:nth-child(even) {
    background: var(--gray-50);
}

.json-result-view .json-key {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 13px;
    min-width: 100px;
    max-width: 200px;
    flex-shrink: 0;
    word-break: break-word;
}

.json-result-view .json-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--gray-700);
    word-break: break-word;
    text-align: right;
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.json-result-view .json-array-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--gray-200);
}

.json-result-view .json-array-item:last-child {
    border-bottom: none;
}

.json-result-view .json-index {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--gray-400);
    min-width: 40px;
}

.json-result-view .json-primitive {
    padding: var(--space-md);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--gray-700);
}

.json-result-view .json-null {
    padding: var(--space-md);
    font-style: italic;
    color: var(--gray-500);
    text-align: center;
}

/* Expandable JSON properties */
.json-result-view .json-property.expandable {
    flex-direction: column;
    align-items: stretch;
}

.json-result-view .json-property-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: var(--space-xs) 0;
    transition: background 0.15s ease;
}

.json-result-view .json-property-header:hover {
    background: color-mix(in srgb, var(--color-primary) 5%, transparent);
}

.json-result-view .json-expand-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.json-result-view .json-expanded-content {
    margin-top: var(--space-sm);
    margin-left: var(--space-md);
    padding-left: var(--space-md);
    border-left: 2px solid var(--gray-200);
    max-height: 400px;
    overflow-y: auto;
}

.json-result-view .json-expanded-content .json-array-item {
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
}

.json-result-view .json-expanded-content .json-array-item:nth-child(odd) {
    background: var(--gray-50);
}

.json-result-view .json-nested-property {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid var(--gray-100);
    gap: var(--space-md);
}

.json-result-view .json-nested-property:last-child {
    border-bottom: none;
}

.json-result-view .json-nested-key {
    font-weight: 500;
    color: var(--gray-600);
    font-size: 12px;
    min-width: 100px;
    flex-shrink: 0;
}

/* Array container for top-level arrays */
.json-result-view .json-array-container {
    padding: var(--space-sm);
}

.json-result-view .json-array-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    cursor: pointer;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.json-result-view .json-array-header:hover {
    background: var(--gray-200);
}

.json-result-view .json-array-label {
    font-weight: 600;
    color: var(--gray-700);
}

/* JSON Object Cards Grid */
.json-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
    max-height: 500px;
    overflow-y: auto;
    padding: var(--space-xs);
    width: 100%;
    min-width: 0;
}

.json-object-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    min-width: 0;
}

.json-object-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.json-object-card .card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-bottom: 1px solid var(--gray-200);
}

.json-object-card .card-index {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-400);
    background: white;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.json-object-card .card-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
    text-transform: capitalize;
}

.json-object-card .card-body {
    padding: var(--space-sm);
}

.json-object-card .card-property {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    gap: var(--space-sm);
    min-width: 0;
}

.json-object-card .card-property:nth-child(odd) {
    background: var(--gray-50);
}

.json-object-card .card-key {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
    flex-shrink: 0;
    max-width: 50%;
}

.json-object-card .card-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    word-break: break-word;
    min-width: 0;
    flex: 1;
}

/* Card value color coding */
.json-object-card .card-value.positive-value {
    color: var(--color-success);
}

.json-object-card .card-value.negative-value {
    color: var(--color-error);
}

.json-object-card .card-value.high-value {
    color: var(--color-error);
    font-weight: 700;
}

.json-object-card .card-value.medium-value {
    color: var(--color-warning);
}

.json-object-card .card-value.low-value {
    color: var(--gray-500);
}

.json-object-card .card-value.high-count {
    color: var(--color-primary);
    font-weight: 700;
}

.json-object-card .card-value.medium-count {
    color: var(--color-info);
}

/* Hidden helper class */
.hidden {
    display: none !important;
}

/* Expandable card styling */
.json-object-card.expandable-card {
    cursor: pointer;
}

.json-object-card.expandable-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.json-object-card .card-expand-hint {
    font-size: 10px;
    color: var(--color-primary);
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.json-object-card.expandable-card:hover .card-expand-hint {
    opacity: 1;
}

/* Card Detail Modal */
.card-detail-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card-detail-modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.card-detail-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-detail-modal .modal-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-detail-modal .modal-index {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-400);
    background: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.card-detail-modal .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    text-transform: capitalize;
}

.card-detail-modal .modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    padding: var(--space-xs);
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, color 0.2s ease;
}

.card-detail-modal .modal-close-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.card-detail-modal .modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

/* Modal property styles */
.card-detail-modal .modal-property {
    margin-bottom: var(--space-md);
}

.card-detail-modal .modal-property.simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.card-detail-modal .modal-property.expanded {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.card-detail-modal .modal-property-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.card-detail-modal .modal-key {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 13px;
}

.card-detail-modal .modal-count {
    font-size: 11px;
    color: var(--gray-400);
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
}

.card-detail-modal .modal-value {
    font-weight: 600;
    color: var(--gray-800);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
}

/* Modal array content */
.card-detail-modal .modal-array-content,
.card-detail-modal .modal-object-content {
    padding: var(--space-sm);
    max-height: 300px;
    overflow-y: auto;
    background: white;
}

/* String array items (example sentences) */
.card-detail-modal .modal-array-string-item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    background: var(--gray-50);
    border-left: 3px solid var(--color-primary);
}

.card-detail-modal .modal-array-string-item .item-index {
    font-weight: 700;
    color: var(--gray-400);
    flex-shrink: 0;
    min-width: 24px;
}

.card-detail-modal .modal-array-string-item .item-text {
    font-style: italic;
    color: var(--gray-700);
    line-height: 1.5;
}

/* Object array items (top words, etc.) */
.card-detail-modal .modal-array-object-item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    background: var(--gray-50);
}

.card-detail-modal .modal-array-object-item .item-index {
    font-weight: 700;
    color: var(--gray-400);
    flex-shrink: 0;
    min-width: 24px;
}

.card-detail-modal .modal-array-object-item .item-props {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.card-detail-modal .modal-array-object-item .item-prop {
    display: inline-flex;
    gap: 4px;
    background: white;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    font-size: 12px;
}

.card-detail-modal .modal-array-object-item .item-key {
    color: var(--gray-500);
}

.card-detail-modal .modal-array-object-item .item-val {
    font-weight: 600;
    color: var(--gray-800);
    font-family: 'JetBrains Mono', monospace;
}

/* Primitive array items */
.card-detail-modal .modal-array-primitive-item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
}

.card-detail-modal .modal-array-primitive-item .item-index {
    font-weight: 700;
    color: var(--gray-400);
    flex-shrink: 0;
    min-width: 24px;
}

.card-detail-modal .modal-array-primitive-item .item-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--gray-700);
}

/* Nested properties in modal */
.card-detail-modal .modal-nested-prop {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-md);
    border-bottom: 1px solid var(--gray-100);
}

.card-detail-modal .modal-nested-prop:last-child {
    border-bottom: none;
}

.card-detail-modal .modal-nested-key {
    color: var(--gray-500);
    font-size: 12px;
}

.card-detail-modal .modal-nested-value {
    font-weight: 600;
    color: var(--gray-800);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

/* Value color classes in modal */
.card-detail-modal .modal-value.positive-value,
.card-detail-modal .modal-nested-value.positive-value {
    color: var(--color-success);
}

.card-detail-modal .modal-value.negative-value,
.card-detail-modal .modal-nested-value.negative-value {
    color: var(--color-error);
}

/* No matches hint */
.no-matches-hint {
    padding: var(--space-md);
    color: var(--gray-500);
    font-style: italic;
    text-align: center;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

/* Taxonomy hint styling */
.taxonomy-hint {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: color-mix(in srgb, var(--color-info) 10%, white);
    border: 1px solid color-mix(in srgb, var(--color-info) 30%, white);
    border-radius: var(--radius-sm);
}

.taxonomy-hint .hint-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--color-info);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.taxonomy-hint .hint-text {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

.value-result {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    text-align: center;
}

.value-result .primary-value {
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
}

.value-result.sentiment-positive {
    background: color-mix(in srgb, var(--color-success) 15%, white);
    color: var(--color-success);
}

.value-result.sentiment-negative {
    background: color-mix(in srgb, var(--color-error) 15%, white);
    color: var(--color-error);
}

.value-result.sentiment-neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

.value-result.valence-positive {
    background: color-mix(in srgb, var(--color-success) 15%, white);
    color: var(--color-success);
}

.value-result.valence-negative {
    background: color-mix(in srgb, var(--color-error) 15%, white);
    color: var(--color-error);
}

.value-result.valence-neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

.all-results {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-200);
}

.all-results label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    display: block;
    margin-bottom: var(--space-sm);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-sm);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.result-key {
    color: var(--gray-600);
    font-weight: 500;
}

.result-val {
    color: var(--gray-900);
    font-weight: 600;
}

/* Sentence Breakdown Styles */
.sentence-breakdown {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-200);
}

.sentence-breakdown > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    display: block;
    margin-bottom: var(--space-md);
}

.sentence-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.sentence-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.sentence-text {
    flex: 1;
    display: flex;
    gap: var(--space-sm);
    min-width: 0;
}

.sentence-index {
    font-weight: 700;
    color: var(--gray-400);
    flex-shrink: 0;
    width: 24px;
}

.sentence-content {
    color: var(--gray-700);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.sentence-result {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    min-width: 80px;
    text-align: center;
}

.sentence-result.sentiment-positive {
    background: color-mix(in srgb, var(--color-success) 15%, white);
    color: var(--color-success);
}

.sentence-result.sentiment-negative {
    background: color-mix(in srgb, var(--color-error) 15%, white);
    color: var(--color-error);
}

.sentence-result.sentiment-neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

.sentence-result.valence-positive {
    background: color-mix(in srgb, var(--color-success) 15%, white);
    color: var(--color-success);
}

.sentence-result.valence-negative {
    background: color-mix(in srgb, var(--color-error) 15%, white);
    color: var(--color-error);
}

.sentence-result.valence-neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* HTML result in sentence breakdown (for HIGHLIGHT function) */
.sentence-result.html-result {
    flex-shrink: 1;
    flex-grow: 1;
    min-width: 0;
    max-width: none;
    text-transform: none;
    text-align: left;
    font-size: 13px;
    font-weight: normal;
    padding: var(--space-sm) var(--space-md);
    background: white;
    border: 1px solid var(--gray-200);
    line-height: 1.6;
    white-space: normal;
    word-wrap: break-word;
}

/* When sentence-item contains html-result, stack vertically */
.sentence-item:has(.html-result) {
    flex-direction: column;
    align-items: stretch;
}

.sentence-item:has(.html-result) .sentence-text {
    width: 100%;
    padding-bottom: var(--space-sm);
    border-bottom: 1px dashed var(--gray-200);
    margin-bottom: var(--space-sm);
}

.sentence-item:has(.html-result) .sentence-result.html-result {
    width: 100%;
}

/* Stacked sentence items (for JSON results, HIGHLIGHT, etc.) */
.sentence-item.stacked {
    flex-direction: column;
    align-items: stretch;
}

.sentence-item.stacked .sentence-text {
    width: 100%;
    padding-bottom: var(--space-sm);
    border-bottom: 1px dashed var(--gray-200);
    margin-bottom: var(--space-sm);
}

/* JSON result in sentence breakdown */
.sentence-result.json-result {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    text-transform: none;
    text-align: left;
    font-weight: normal;
    min-width: 0;
}

.sentence-result.json-result .json-prop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    min-width: 0;
}

.sentence-result.json-result .json-prop-key {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
    flex-shrink: 0;
    max-width: 45%;
}

.sentence-result.json-result .json-prop-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    word-break: break-word;
    min-width: 0;
}

/* Color coding for JSON values in sentence breakdown */
.sentence-result.json-result .json-prop-val.positive {
    color: var(--color-success);
}

.sentence-result.json-result .json-prop-val.negative {
    color: var(--color-error);
}

.sentence-result.json-result .json-prop-val.neutral {
    color: var(--gray-500);
}

.sentence-result.json-result .json-prop-val.high {
    color: var(--color-success);
    font-weight: 700;
}

.sentence-result.json-result .json-prop-val.medium {
    color: var(--color-warning);
}

.sentence-result.json-result .json-prop-val.low {
    color: var(--gray-400);
}

/* AdHoc Analysis Tab Button */
.header-action-btn.adhoc-analysis {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    border-color: #1565c0;
    color: white;
}

.header-action-btn.adhoc-analysis:hover {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(25, 118, 210, 0.35);
}

.header-action-btn.adhoc-analysis.active {
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
    border-color: #1565c0;
}

/* ============================================================================
   License Gate - Protected Content Screen
   ============================================================================ */

.license-gate {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    min-height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: var(--space-xl);
    padding-top: var(--space-2xl);
    overflow-y: auto;
    box-sizing: border-box;
}

.license-gate-content {
    max-width: 700px;
    width: 100%;
    text-align: center;
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--gray-200);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.license-gate-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 50%;
    margin-bottom: var(--space-lg);
    color: white;
}

.license-gate-icon .icon {
    width: 40px;
    height: 40px;
}

.license-gate-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-md);
}

.license-gate-desc {
    color: var(--gray-600);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: var(--space-xl);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* License checking state */
.license-checking {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    color: var(--gray-600);
}

/* License form */
.license-form {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.license-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    transition: border-color 0.2s;
}

.license-input-group:focus-within {
    border-color: var(--color-primary);
}

.license-input-group .icon {
    color: var(--gray-400);
    flex-shrink: 0;
}

.license-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    padding: var(--space-xs) 0;
    background: transparent;
    font-family: 'JetBrains Mono', monospace;
}

.license-input::placeholder {
    color: var(--gray-400);
    font-family: inherit;
}

.license-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}

.license-success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #059669;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}

.license-activate-btn {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    font-weight: 600;
}

/* License types info */
.license-types-info {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--gray-200);
}

.license-types-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-lg);
}

.license-type-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
}

.license-type-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-align: left;
}

.license-type-card .card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    font-weight: 600;
    color: white;
}

.license-type-card.trial .card-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.license-type-card.permanent .card-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.license-type-card .card-body {
    padding: var(--space-md);
}

.license-type-card .card-prefix {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin-bottom: var(--space-xs);
}

.license-type-card .card-duration {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--space-sm);
}

.license-type-card .card-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.license-type-card .card-features li {
    font-size: 0.85rem;
    color: var(--gray-600);
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.license-type-card .card-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

/* License contact */
.license-contact {
    margin-top: var(--space-lg);
    color: var(--gray-500);
    font-size: 0.9rem;
}

.license-contact a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.license-contact a:hover {
    text-decoration: underline;
}

/* License status bar (when licensed) */
.license-status-bar {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-left: auto;
    padding: 4px 10px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: #059669;
}

.license-status-bar.expiring {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #d97706;
}

.license-status-bar .icon {
    width: 12px;
    height: 12px;
}

.license-status-bar .status-text {
    font-weight: 500;
}

.license-status-bar .license-type-badge {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    text-transform: uppercase;
}
