/* CSS Variables */
:root {
    /* Modern Dark Palette (Slate/Zinc based) */
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-light: #818cf8; /* Indigo 400 */
    --secondary: #94a3b8; /* Slate 400 */
    
    --success: #22c55e; /* Green 500 */
    --warning: #f59e0b; /* Amber 500 */
    --error: #ef4444; /* Red 500 */
    
    /* Deep Dark Backgrounds */
    --background: #020617; /* Slate 950 */
    --surface: #0f172a;    /* Slate 900 */
    --surface-light: #1e293b; /* Slate 800 */
    --surface-lighter: #334155; /* Slate 700 */
    
    /* High Contrast Text */
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #cbd5e1; /* Slate 300 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    /* Subtle Borders */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    /* Gradients */
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-2: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    --gradient-3: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    --gradient-4: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    --gradient-5: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
    
    /* Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px; /* Base size */
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

/* App Container */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
}

.btn-ghost:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Panels */
.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.panel-header p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.panel-content {
    padding: 2rem;
}

.panel-content.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4rem 2rem;
}

/* Connection Panel */
.connection-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: none;
}

.connection-panel .icon-large {
    width: 100px;
    height: 100px;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.connection-panel .icon-large svg {
    color: white;
}

.connection-panel h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.connection-panel p {
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface-light);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.feature-icon {
    font-size: 1.5rem;
}

/* Property Panel */
.property-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
    overflow: hidden;
}

.property-panel .panel-content {
    flex: 1;
    overflow-y: auto;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
}

/* Config Sections */
.config-section {
    background: var(--surface-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.config-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.config-section-title svg {
    color: var(--primary);
}

.config-section-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.textarea-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Data Toggle Switches */
.data-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-item:hover {
    background: var(--border);
}

.toggle-item input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-item input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-item input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.toggle-label strong {
    font-size: 0.875rem;
    font-weight: 500;
}

.toggle-label small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Provider Tabs */
.provider-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.provider-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.provider-tab:hover {
    background: var(--surface-light);
    border-color: var(--text-muted);
}

.provider-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.provider-tab svg {
    flex-shrink: 0;
}

/* Input with toggle visibility */
.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-toggle .text-input {
    padding-right: 2.5rem;
}

.toggle-visibility {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toggle-visibility:hover {
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.select-input,
.text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.select-input:focus,
.text-input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Loading Panel */
.loading-panel {
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
}

.loader-ring:nth-child(1) {
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

.loader-ring:nth-child(2) {
    border-right-color: var(--primary-light);
    animation: spin 1.5s linear infinite reverse;
}

.loader-ring:nth-child(3) {
    border-bottom-color: var(--primary-dark);
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
    text-align: left;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.progress-step.active {
    color: var(--text-primary);
}

.progress-step.completed {
    color: var(--success);
}

.step-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface-light);
    position: relative;
}

.progress-step.active .step-indicator {
    background: var(--primary);
    animation: pulse 1.5s ease-in-out infinite;
}

.progress-step.completed .step-indicator::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: white;
}

.progress-step.completed .step-indicator {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Results Panel - New Layout */
.results-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
}

.results-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    flex: 1;
    overflow: hidden;
}

/* Persona Sidebar */
.persona-sidebar {
    background: var(--surface-light);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-title svg {
    color: var(--primary);
}

.sidebar-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.persona-count {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
}

.persona-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.persona-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 0.25rem;
}

.persona-list-item:hover {
    background: var(--surface);
}

.persona-list-item.active {
    background: var(--primary);
    color: white;
}

.persona-list-item.active .persona-list-archetype {
    color: rgba(255, 255, 255, 0.8);
}

.persona-list-item.active .persona-list-percent {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.persona-list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.persona-list-avatar-emoji {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--gradient-1);
    flex-shrink: 0;
}

.persona-list-info {
    flex: 1;
    min-width: 0;
}

.persona-list-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persona-list-archetype {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persona-list-percent {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.sidebar-actions {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

/* Persona Detail Panel */
.persona-detail-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.detail-header {
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: var(--surface-light);
}

.detail-header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.detail-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.date-range {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.date-range::before {
    content: '📅';
    font-size: 0.875rem;
}

.analytics-summary-compact {
    display: flex;
    gap: 1.25rem;
}

.stat-mini {
    text-align: center;
    padding: 0 0.75rem;
    border-right: 1px solid var(--border);
}

.stat-mini:last-child {
    border-right: none;
    padding-right: 0;
}

.stat-mini .stat-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-mini .stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.persona-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 1rem;
}

.empty-state svg {
    opacity: 0.5;
}

/* Inline Persona Detail (replaces modal for main view) */
.inline-persona-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.inline-persona-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-light);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.inline-persona-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--persona-gradient, var(--gradient-1));
}

.inline-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.inline-avatar-emoji {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.inline-persona-info h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.inline-persona-info .archetype {
    color: var(--primary-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.inline-persona-info .percentage {
    display: inline-block;
    background: var(--surface);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.detail-card {
    background: var(--surface-light);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.detail-card h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.detail-grid-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.detail-grid-item .label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-grid-item .value {
    font-weight: 500;
    font-size: 0.9375rem;
}

.inline-quote {
    font-style: italic;
    color: var(--text-secondary);
    padding-left: 1rem;
    border-left: 3px solid var(--primary);
    margin-top: 1rem;
}

.inline-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.inline-list li {
    padding: 0.375rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.9375rem;
}

.inline-list.goals li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
}

.inline-list.pain-points li::before {
    content: '✗';
    position: absolute;
    left: 0;
    color: var(--error);
}

.inline-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Legacy analytics summary (keep for compatibility) */
.analytics-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: var(--surface-light);
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Persona Grid */
.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

/* Persona Card */
.persona-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.persona-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.persona-header {
    padding: 1.5rem;
    position: relative;
}

.persona-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.persona-card:nth-child(5n+1) .persona-header::before { background: var(--gradient-1); }
.persona-card:nth-child(5n+2) .persona-header::before { background: var(--gradient-2); }
.persona-card:nth-child(5n+3) .persona-header::before { background: var(--gradient-3); }
.persona-card:nth-child(5n+4) .persona-header::before { background: var(--gradient-4); }
.persona-card:nth-child(5n+5) .persona-header::before { background: var(--gradient-5); }

.persona-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.persona-avatar-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.persona-card:nth-child(5n+1) .persona-avatar { background: var(--gradient-1); }
.persona-card:nth-child(5n+2) .persona-avatar { background: var(--gradient-2); }
.persona-card:nth-child(5n+3) .persona-avatar { background: var(--gradient-3); }
.persona-card:nth-child(5n+4) .persona-avatar { background: var(--gradient-4); }
.persona-card:nth-child(5n+5) .persona-avatar { background: var(--gradient-5); }

.persona-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.persona-archetype {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.persona-percentage {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--surface-light);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-light);
}

.persona-body {
    padding: 0 1.5rem 1.5rem;
}

.persona-bio {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.persona-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trait-tag {
    background: var(--surface-light);
    color: var(--text-secondary);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.persona-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--surface-light);
    border-top: 1px solid var(--border);
}

.persona-stat {
    text-align: center;
}

.persona-stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.persona-stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 1000px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
    z-index: 1;
}

.modal-content.modal-large {
    max-width: 1200px;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--surface-light);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* Modal Body */
.modal-persona-header {
    padding: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.modal-persona-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.modal-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    flex-shrink: 0;
}

.modal-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.modal-persona-info h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.modal-persona-info .archetype {
    color: var(--primary-light);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.modal-persona-info .percentage {
    display: inline-block;
    background: var(--surface-light);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Modal body with grid layout */
.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.modal-section {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.modal-section:nth-child(even) {
    border-right: none;
}

.modal-section:last-child,
.modal-section:nth-last-child(2):nth-child(odd) {
    border-bottom: none;
}

.modal-section.full-width {
    grid-column: 1 / -1;
    border-right: none;
}

.modal-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-bio {
    line-height: 1.7;
    color: var(--text-primary);
}

.modal-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-weight: 500;
    color: var(--text-primary);
}

.modal-goals li,
.modal-pain-points li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.modal-goals li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
}

.modal-pain-points li::before {
    content: '✗';
    position: absolute;
    left: 0;
    color: var(--error);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Data Modal Body */
.data-modal-body {
    padding: 1.5rem 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

.data-section {
    margin-bottom: 1.5rem;
}

.data-section:last-child {
    margin-bottom: 0;
}

.data-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface-light);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
}

.data-section-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.data-section-header .badge {
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.data-section-header .toggle-icon {
    transition: transform 0.2s;
}

.data-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.data-section-content {
    background: var(--surface-light);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.data-section.collapsed .data-section-content {
    display: none;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.data-table th,
.data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--surface);
}

.data-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.data-summary-item {
    background: var(--surface);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.data-summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

.data-summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Persona Data Attribution */
.persona-data-attribution {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.persona-data-attribution h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.data-source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.data-source-tag {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--surface-light);
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.data-source-tag .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.data-source-tag.demographics .dot { background: #6366f1; }
.data-source-tag.devices .dot { background: #ec4899; }
.data-source-tag.geo .dot { background: #14b8a6; }
.data-source-tag.behavior .dot { background: #f59e0b; }
.data-source-tag.traffic .dot { background: #3b82f6; }
.data-source-tag.pages .dot { background: #8b5cf6; }
.data-source-tag.landingPages .dot { background: #22c55e; }
.data-source-tag.exitPages .dot { background: #ef4444; }
.data-source-tag.engagement .dot { background: #06b6d4; }

/* Why This Persona Section */
.why-persona-section {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: var(--radius);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.why-persona-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-light);
}

.why-persona-section h3 svg {
    color: var(--primary);
}

.why-persona-text {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.9375rem;
}

/* User Journey Section */
.user-journey-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
}

.user-journey-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.user-journey-section h4 svg {
    color: var(--primary);
}

.journey-pages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.journey-page {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.journey-step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.journey-page-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.journey-path {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.8125rem;
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.15);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    word-break: break-all;
}

.journey-reason {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

/* Floating Chat Button */
.chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.2s;
    z-index: 100;
    font-weight: 500;
    font-size: 0.875rem;
}

.chat-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.chat-fab svg {
    flex-shrink: 0;
}

/* Chat Panel (Slide-out) */
.chat-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.chat-panel-overlay:not(.hidden) {
    opacity: 1;
}

.chat-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100%;
    height: 100vh;
    background: var(--surface);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

.chat-panel.open {
    transform: translateX(0);
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.chat-panel-persona {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-panel-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    overflow: hidden;
}

.chat-panel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-panel-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-panel-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.chat-panel-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.chat-panel-close:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.chat-panel-suggestions {
    padding: 0.75rem 1rem;
    background: var(--surface-light);
    border-bottom: 1px solid var(--border);
}

.chat-panel-suggestions p {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.suggestion-chip {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.suggestion-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.chat-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--background);
}

.chat-panel-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface-light);
    border-top: 1px solid var(--border);
}

.chat-panel-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.chat-panel-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-panel-input input::placeholder {
    color: var(--text-muted);
}

.chat-panel-input .btn {
    padding: 0.75rem 1rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
}

.chat-message.user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
    background: var(--surface-light);
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar.user-avatar {
    background: var(--primary);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
}

.chat-bubble {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.chat-message.user .chat-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
    background: var(--surface-light);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--surface-light);
    border-top: 1px solid var(--border);
}

.chat-input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    padding: 0.625rem 1rem;
    flex-shrink: 0;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .persona-grid {
        grid-template-columns: 1fr;
    }

    .modal-persona-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal-details-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}
