* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Theme Colors - Inspired by InsightStream */
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --primary-light: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #9f7aea 100%);
    --success: #10b981;
    --success-dark: #059669;
    --error: #ef4444;
    --warning: #f59e0b;

    /* Backgrounds */
    --bg-body: #0f1419;
    --bg-main: #151b23;
    --bg-card: #1c2432;
    --bg-elevated: #242d3d;
    --bg-input: #1c2432;
    --bg-hover: #2a3545;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Borders */
    --border: #2d3a4d;
    --border-light: #374151;
    --border-focus: #8b5cf6;

    /* Shadows */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --glow-primary: 0 0 20px rgba(139, 92, 246, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

main {
    background: var(--bg-main);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

.input-section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    gap: 12px;
}

.url-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s;
    background: var(--bg-input);
    color: var(--text-primary);
}

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

.url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.select-input {
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
}

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

.filter-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.checkbox-group {
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.analyze-btn {
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--accent-gradient);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-primary);
    filter: brightness(1.1);
}

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.export-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.export-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.hint {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Results Header */
.results-header {
    margin: 30px 0 20px 0;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.results-header h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Post Cards */
.post-card {
    background: var(--bg-card);
    padding: 20px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
}

.post-card:hover {
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.post-card.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.post-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.post-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.post-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 10px 0;
}

.engagement-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.engagement-viral {
    background: #ffd700;
    color: #8b6914;
}

.engagement-high {
    background: #48bb78;
    color: white;
}

.engagement-medium {
    background: #4299e1;
    color: white;
}

.engagement-low {
    background: #4a5568;
    color: #a0aec0;
}

/* Post Cards Grid Layout */
.post-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 10px 0;
}

.post-card-grid {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 140px;
}

.post-card-grid:hover {
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.post-card-grid.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.15);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.post-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-subreddit {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.post-card-grid input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.post-card-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.post-card-hint {
    color: var(--text-muted);
    font-size: 12px;
}

.post-card-link {
    color: var(--primary-light);
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.post-card-link:hover {
    text-decoration: underline;
    color: var(--primary);
}

/* Responsive grid */
@media (max-width: 768px) {
    .post-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Selected Actions */
.selected-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--primary);
    color: var(--text-primary);
    border-radius: 8px;
    margin: 20px 0;
}

.selected-summary span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-light);
}

.selected-summary .analyze-btn {
    background: var(--accent-gradient);
    color: white;
}

.selected-summary .analyze-btn:hover {
    filter: brightness(1.1);
}

/* Status Section */
.status-section {
    margin: 30px 0;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.status-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.status-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.status-progress {
    background: var(--bg-elevated);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* Results Section */
.results-section {
    margin-top: 30px;
}

.result-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.result-card h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
}

/* Error Section */
.error-section {
    margin: 30px 0;
}

.error-card {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--error);
    margin-bottom: 10px;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.retry-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--error);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.retry-btn:hover {
    background: #dc2626;
    filter: brightness(1.1);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

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

/* Data Summary */
.data-summary h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stats {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 20px;
}

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

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

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Insights Formatting */
#insightsContent h1, #insightsContent h2, #insightsContent h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

#insightsContent h1 { font-size: 1.8rem; }
#insightsContent h2 { font-size: 1.5rem; }
#insightsContent h3 { font-size: 1.3rem; }

#insightsContent p {
    line-height: 1.8;
    margin: 15px 0;
    color: var(--text-secondary);
}

#insightsContent table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: var(--shadow);
}

#insightsContent th {
    background: var(--primary);
    color: white;
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border);
    font-weight: 600;
}

#insightsContent td {
    padding: 12px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

#insightsContent tr:nth-child(even) {
    background: var(--bg-elevated);
}

#insightsContent strong {
    color: var(--primary-light);
    font-weight: 600;
}

#insightsContent code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-light);
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

#insightsContent ul, #insightsContent ol {
    margin: 15px 0 15px 30px;
    line-height: 1.8;
}

#insightsContent li {
    margin: 8px 0;
}

/* Header Actions */
.header-actions {
    margin-top: 15px;
    display: flex;
    justify-content: center;
}

.recent-searches-dropdown {
    padding: 8px 16px;
    font-size: 0.9rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
}

.recent-searches-dropdown:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.recent-searches-dropdown option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Research Context Section */
.research-context-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px dashed var(--border);
}

.context-label,
.template-label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 1rem;
}

.optional-tag {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: normal;
    font-style: italic;
}

.required-tag {
    font-size: 0.9rem;
    color: var(--error);
    font-weight: bold;
}

.research-input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s;
    background: var(--bg-input);
    color: var(--text-primary);
}

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

.research-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

/* Role & Goal Section */
.role-goal-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--warning);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.role-input-group,
.goal-input-group {
    display: flex;
    flex-direction: column;
}

.role-input-group input,
.goal-input-group input {
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s;
    background: var(--bg-input);
    color: var(--text-primary);
}

.role-input-group input:focus,
.goal-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

/* Search Method Section */
.search-method-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--success);
}

.method-label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 1rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-option:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.radio-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.radio-option input[type="radio"]:checked + .radio-label {
    font-weight: 600;
    color: var(--primary-light);
}

.radio-label {
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
}

.url-textarea {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s;
    background: var(--bg-input);
    color: var(--text-primary);
}

.url-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

/* ============================================
   ADVANCED OPTIONS (Subtle filters at bottom)
   ============================================ */

.advanced-options {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.advanced-options-row {
    display: flex;
    gap: 24px;
    align-items: center;
}

.advanced-options .option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.advanced-options .option-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.subtle-select {
    padding: 6px 28px 6px 10px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    min-width: 100px;
}

.subtle-select:hover {
    border-color: var(--primary);
}

.subtle-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.conditional-input {
    margin-top: 12px;
}

.subtle-text-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
}

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

.subtle-text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.subtle-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    resize: vertical;
    font-family: inherit;
}

.subtle-textarea::placeholder {
    color: var(--text-muted);
}

.subtle-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

/* Legacy - keep for backwards compatibility */
.search-filters-row {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    padding: 15px 20px;
    background: var(--bg-main);
    border-radius: 8px;
    border: 1px dashed var(--border);
}

.search-filters-row .filter-group {
    flex: 1;
}

.search-filters-row .filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* ============================================
   RESEARCH GOAL SECTION - PERSONA CARDS
   ============================================ */

.research-goal-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    border: 1px solid var(--border);
}

.research-goal-section .section-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

.persona-outcome-container {
    display: flex;
    gap: 24px;
}

.persona-selection {
    flex: 0 0 auto;
    min-width: 280px;
}

.outcome-selection {
    flex: 1;
    padding-left: 24px;
    border-left: 1px solid var(--border);
}

.selection-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Persona Cards */
.persona-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.persona-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.persona-card:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.persona-card.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.15);
}

.persona-icon {
    font-size: 0.75rem;
    font-weight: 700;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 8px;
    color: var(--primary-light);
    letter-spacing: 0.5px;
}

.persona-card.selected .persona-icon {
    background: rgba(139, 92, 246, 0.2);
}

.persona-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.persona-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.persona-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Outcome Options */
.outcome-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.outcome-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.outcome-option:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.outcome-option.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.15);
}

.outcome-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.outcome-option span {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Free Form Input for Custom Goals */
.free-form-input-container {
    margin-top: 12px;
}

.free-form-goal-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
}

.free-form-goal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.free-form-goal-input::placeholder {
    color: var(--text-muted);
}

/* Custom Role/Goal Inputs */
.custom-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.custom-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.custom-input-group input {
    padding: 12px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    background: var(--bg-input);
    color: var(--text-primary);
}

.custom-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

/* Start Research Button */
.start-research-btn {
    width: 100%;
    padding: 18px 32px;
    font-size: 1.1rem;
    margin-top: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.start-research-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Responsive for Persona Section */
@media (max-width: 900px) {
    .persona-outcome-container {
        flex-direction: column;
    }

    .outcome-selection {
        padding-left: 0;
        padding-top: 20px;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .persona-selection {
        min-width: auto;
    }

    .outcome-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .search-filters-row {
        flex-direction: column;
        gap: 15px;
    }
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    margin-top: 30px;
    font-size: 0.85rem;
}

footer a {
    color: var(--primary-light);
    text-decoration: underline;
}

/* ============================================
   STRUCTURED ANALYSIS UI COMPONENTS
   ============================================ */

/* Analysis Header */
.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.analysis-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.analysis-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.analysis-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 8px;
}

.analysis-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.analysis-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Button styles for actions */
.btn-export {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.btn-export.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 28px 0 16px 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-header:first-of-type {
    margin-top: 0;
}

/* Analysis Sections */
.analysis-section {
    margin-bottom: 28px;
}

.analysis-header-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    margin-top: -8px;
}

/* ============================================
   QUOTES GRID
   ============================================ */

.quotes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.quote-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.quote-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Quote type colors */
.quote-card.quote-insight {
    border-left-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, var(--bg-card) 100%);
}

.quote-card.quote-warning {
    border-left-color: #f6ad55;
    background: linear-gradient(135deg, rgba(246, 173, 85, 0.15) 0%, var(--bg-card) 100%);
}

.quote-card.quote-tip {
    border-left-color: #48bb78;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.15) 0%, var(--bg-card) 100%);
}

.quote-card.quote-complaint {
    border-left-color: #f56565;
    background: linear-gradient(135deg, rgba(245, 101, 101, 0.15) 0%, var(--bg-card) 100%);
}

.quote-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.quote-icon {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 2rem;
    opacity: 0.15;
    color: var(--primary);
}

.quote-insight .quote-type-badge {
    background: rgba(102, 126, 234, 0.15);
    color: #5a67d8;
}

.quote-warning .quote-type-badge {
    background: rgba(246, 173, 85, 0.2);
    color: #c05621;
}

.quote-tip .quote-type-badge {
    background: rgba(72, 187, 120, 0.2);
    color: #276749;
}

.quote-complaint .quote-type-badge {
    background: rgba(245, 101, 101, 0.2);
    color: #c53030;
}

.quote-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: 12px;
}

.quote-source {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   SUMMARY CARD (Executive Summary)
   ============================================ */

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.summary-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-card p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 0;
}

/* ============================================
   GOAL ANSWERS SECTION
   ============================================ */

.goal-answers {
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.goal-answers h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.goal-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.goal-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.goal-bullet {
    width: 24px;
    height: 24px;
    min-width: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.goal-item p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ============================================
   KEY INSIGHTS GRID
   ============================================ */

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.insight-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.insight-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.sentiment-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.sentiment-badge.positive {
    background: rgba(72, 187, 120, 0.2);
    color: #68d391;
}

.sentiment-badge.negative {
    background: rgba(245, 101, 101, 0.2);
    color: #fc8181;
}

.sentiment-badge.neutral {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

.insight-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   CONFIDENCE CARD
   ============================================ */

.confidence-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.confidence-level {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
}

.confidence-level.high {
    color: #68d391;
}

.confidence-level.medium {
    color: #f6ad55;
}

.confidence-level.low {
    color: #fc8181;
}

.confidence-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.confidence-level.high .confidence-indicator {
    background: #48bb78;
}

.confidence-level.medium .confidence-indicator {
    background: #f6ad55;
}

.confidence-level.low .confidence-indicator {
    background: #f56565;
}

.confidence-reason {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

/* ============================================
   SOURCE POSTS SECTION
   ============================================ */

.source-posts-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border);
}

.source-posts-section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-post-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.source-post-item:hover {
    border-color: var(--primary);
}

.source-post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.source-post-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.source-post-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.source-post-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.source-post-actions button {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

/* ============================================
   FALLBACK MARKDOWN STYLING
   ============================================ */

.markdown-fallback {
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
}

.markdown-fallback h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin: 24px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.markdown-fallback h2:first-child {
    margin-top: 0;
}

.markdown-fallback p {
    line-height: 1.7;
    margin: 12px 0;
}

.markdown-fallback ul {
    margin: 12px 0 12px 24px;
}

.markdown-fallback li {
    margin: 8px 0;
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 24px;
    }

    .tab-navigation {
        flex-direction: column;
    }

    .input-group {
        flex-direction: column;
    }

    .analyze-btn {
        width: 100%;
    }

    .filter-row {
        flex-direction: column;
    }

    .stats {
        flex-direction: column;
    }

    .selected-summary {
        flex-direction: column;
        gap: 15px;
    }

    /* Structured Analysis Responsive */
    .analysis-header {
        flex-direction: column;
    }

    .analysis-actions {
        width: 100%;
    }

    .analysis-actions button {
        flex: 1;
    }

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

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

    .confidence-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .confidence-reason {
        border-left: none;
        padding-left: 0;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }

    .summary-card {
        padding: 20px;
    }

    .summary-card p {
        font-size: 1rem;
    }
}

/* ============================================
   COLLAPSIBLE SECTIONS
   ============================================ */

.collapsible-section {
    transition: all 0.3s ease;
}

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

.collapsible-section.collapsed .collapsed-summary {
    display: flex;
}

.collapsed-summary {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.collapsed-summary:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.collapsed-summary-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.collapsed-summary-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.collapsed-summary-text {
    flex: 1;
    min-width: 0;
}

.collapsed-summary-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collapsed-summary-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collapsed-summary-expand {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-light);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
    flex-shrink: 0;
}

.collapsed-summary-expand:hover {
    background: rgba(139, 92, 246, 0.2);
}

.expand-arrow {
    transition: transform 0.2s ease;
}

.collapsible-section:not(.collapsed) .expand-arrow {
    transform: rotate(180deg);
}

/* ============================================
   QUANTITATIVE INSIGHTS SECTION (Experimental)
   ============================================ */

.quantitative-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.quantitative-section .section-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 12px;
}

/* Topics Grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.topic-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}

.topic-card:hover {
    border-color: var(--primary);
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.topic-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.topic-count {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.topic-sentiment {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.topic-sentiment.positive { background: rgba(72, 187, 120, 0.2); color: #68d391; }
.topic-sentiment.negative { background: rgba(245, 101, 101, 0.2); color: #fc8181; }
.topic-sentiment.mixed { background: rgba(246, 173, 85, 0.2); color: #f6ad55; }
.topic-sentiment.neutral { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }

.topic-example {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
}

/* Sentiment Breakdown */
.sentiment-breakdown {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-elevated);
    border-radius: 12px;
}

.sentiment-bar-container {
    flex: 1;
}

.sentiment-bar-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.sentiment-bar {
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    background: var(--bg-card);
}

.sentiment-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    transition: width 0.5s ease;
}

.sentiment-bar-segment.positive { background: #48bb78; }
.sentiment-bar-segment.negative { background: #f56565; }
.sentiment-bar-segment.neutral { background: #718096; }

.sentiment-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.sentiment-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.sentiment-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sentiment-dot.positive { background: #48bb78; }
.sentiment-dot.negative { background: #f56565; }
.sentiment-dot.neutral { background: #718096; }

/* Common Phrases */
.phrases-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.phrase-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.phrase-tag:hover {
    border-color: var(--primary);
}

.phrase-text {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.phrase-count {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-light);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.phrase-context {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 200px;
}

/* Data Patterns */
.patterns-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.pattern-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.pattern-icon {
    color: var(--primary-light);
    font-size: 1rem;
    flex-shrink: 0;
}

.pattern-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Engagement Insight */
.engagement-insight {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(159, 122, 234, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.engagement-insight-icon {
    font-size: 1.5rem;
    color: var(--primary-light);
}

.engagement-insight-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Subsection Headers */
.quant-subsection {
    margin-bottom: 20px;
}

.quant-subsection-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quant-subsection-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

/* ============================================
   ANALYSIS OUTPUT TABS
   ============================================ */

.analysis-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-card);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.analysis-tab {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.analysis-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

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

.analysis-tab-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.analysis-tab.active .analysis-tab-badge {
    background: rgba(255, 255, 255, 0.2);
}

.analysis-tab:not(.active) .analysis-tab-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.analysis-tab-content {
    display: none;
}

.analysis-tab-content.active {
    display: block;
}

/* ============================================
   RE-ANALYZE & ANALYSIS HISTORY
   ============================================ */

.reanalyze-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
}

.reanalyze-bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reanalyze-bar-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.reanalyze-bar-current {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.reanalyze-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary-light);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reanalyze-btn:hover {
    background: var(--primary);
    color: white;
}

/* Analysis History */
.analysis-history {
    margin-bottom: 24px;
}

.analysis-history-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.history-tab {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-tab:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

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

.history-tab-number {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.history-tab:not(.active) .history-tab-number {
    background: var(--bg-elevated);
}

/* Re-analyze Modal */
.reanalyze-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.reanalyze-modal.show {
    display: flex;
}

.reanalyze-modal-content {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.reanalyze-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.reanalyze-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.reanalyze-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.reanalyze-modal-close:hover {
    background: var(--error);
    color: white;
}

.reanalyze-modal-body {
    margin-bottom: 20px;
}

.reanalyze-modal-section {
    margin-bottom: 20px;
}

.reanalyze-modal-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reanalyze-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.reanalyze-modal-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reanalyze-modal-btn.secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.reanalyze-modal-btn.secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.reanalyze-modal-btn.primary {
    background: var(--primary);
    border: none;
    color: white;
}

.reanalyze-modal-btn.primary:hover {
    background: var(--primary-dark);
}

/* ============================================
   CONTENT GENERATION STYLES
   ============================================ */

/* Generate Section in Analysis */
.generate-section {
    background: linear-gradient(135deg, rgba(128, 90, 213, 0.1) 0%, rgba(102, 126, 234, 0.1) 100%);
    border: 1px dashed var(--primary);
    border-radius: 12px;
    padding: 20px;
}

.generate-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.generate-section-header .section-title {
    margin: 0;
}

.generate-section-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.generate-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.generate-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.generate-btn:hover {
    border-color: var(--primary);
    background: var(--bg-elevated);
    transform: translateY(-2px);
}

.generate-btn-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.generate-btn-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.generate-btn-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Generate Modal */
.generate-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.generate-modal.show {
    display: flex;
}

.generate-modal-content {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.generate-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.generate-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.generate-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.generate-modal-close:hover {
    background: var(--error);
    color: white;
}

.generate-modal-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.generate-modal-body {
    margin-bottom: 20px;
}

.generate-form-group {
    margin-bottom: 20px;
}

.generate-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.generate-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

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

.generate-input-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.generate-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.generate-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generate-radio:hover {
    border-color: var(--primary);
}

.generate-radio input[type="radio"] {
    accent-color: var(--primary);
}

.generate-radio input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 600;
}

.generate-radio span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.generate-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.generate-modal-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generate-modal-btn.secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.generate-modal-btn.secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.generate-modal-btn.primary {
    background: #805ad5;
    border: none;
    color: white;
}

.generate-modal-btn.primary:hover {
    background: #6b46c1;
}

/* Generated Tab Badge */
.analysis-tab-badge.generated-count {
    background: #805ad5;
}

/* Generated Content List */
.generated-content-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.generated-content-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.generated-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.generated-content-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.generated-content-icon {
    font-size: 1.3rem;
}

.generated-content-title h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.generated-content-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.generated-content-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.btn-small.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-small.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-small.btn-danger {
    border-color: var(--error);
    color: var(--error);
}

.btn-small.btn-danger:hover {
    background: var(--error);
    color: white;
}

.generated-content-body {
    padding: 20px;
}

.generated-content-text {
    color: var(--text-primary);
    line-height: 1.7;
    white-space: pre-wrap;
}

.generated-content-text h1,
.generated-content-text h2,
.generated-content-text h3 {
    color: var(--text-primary);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.generated-content-text h1:first-child,
.generated-content-text h2:first-child,
.generated-content-text h3:first-child {
    margin-top: 0;
}

.generated-content-text p {
    margin-bottom: 1em;
}

.generated-content-text ul,
.generated-content-text ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.generated-content-text li {
    margin-bottom: 0.5em;
}

.generated-content-text blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1em;
    margin: 1em 0;
    color: var(--text-secondary);
    font-style: italic;
}
