:root {
    /* Light Theme Variables */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-overlay: rgba(255, 255, 255, 0.95);
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Border Colors */
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    --border-accent: #6366f1;
    
    /* Shadow Colors */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* Gradient Colors */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    /* Legacy variables for compatibility */
    --molten-orange: var(--primary-color);
    --molten-red: var(--error-color);
    --molten-yellow: var(--warning-color);
    --foundry-black: var(--text-primary);
    --foundry-gray: var(--text-secondary);
    --foundry-light-gray: var(--text-muted);
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --primary-color: #818cf8;
    --primary-hover: #a5b4fc;
    --secondary-color: #a78bfa;
    --accent-color: #22d3ee;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --info-color: #60a5fa;
    
    /* Background Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-overlay: rgba(15, 23, 42, 0.95);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;
    
    /* Border Colors */
    --border-primary: #334155;
    --border-secondary: #475569;
    --border-accent: #818cf8;
    
    /* Shadow Colors */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(129, 140, 248, 0.4);
    
    /* Gradient Colors */
    --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    --gradient-secondary: linear-gradient(135deg, #22d3ee 0%, #60a5fa 100%);
    --gradient-accent: linear-gradient(135deg, #fbbf24 0%, #f87171 100%);
}

body {
    background: var(--bg-primary);
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    transition: all 0.3s ease;
    line-height: 1.6;
}

.main-container {
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    margin: 2rem auto;
    max-width: 1400px;
    padding: 3rem;
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.main-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 24px 24px 0 0;
}

.header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
}

.header-controls {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 1000;
}

.theme-toggle {
    background: var(--bg-card);
    border: 2px solid var(--border-primary);
    border-radius: 50px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1001;
    min-width: 100px;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    transform: translateY(-2px);
    background: var(--primary-color);
    color: var(--text-inverse);
}

.theme-toggle:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.theme-toggle i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.logo-container {
    margin-bottom: 2rem;
    position: relative;
}

.main-logo {
    max-height: 100px;
    width: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.main-logo:hover {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
    transform: scale(1.05) rotate(2deg);
}

/* Dark theme logo visibility */
[data-theme="dark"] .main-logo {
    filter: 
        invert(1) 
        hue-rotate(180deg) 
        brightness(1.2) 
        contrast(1.1)
        drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    opacity: 0.9;
}

[data-theme="dark"] .main-logo:hover {
    filter: 
        invert(1) 
        hue-rotate(180deg) 
        brightness(1.4) 
        contrast(1.2)
        drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
    transform: scale(1.05) rotate(2deg);
    opacity: 1;
}

/* Alternative logo styling for better visibility */
[data-theme="dark"] .logo-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

.header h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0;
}

.input-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    border: 2px solid var(--border-primary);
    transition: all 0.3s ease;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.input-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-secondary);
    border-radius: 20px 20px 0 0;
}

.input-section:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    transform: translateY(-2px);
}

.input-method {
    display: none;
}

.input-method.active {
    display: block;
}

.method-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.method-tab {
    background: rgba(60, 60, 60, 0.8);
    border: 2px solid rgba(255, 107, 53, 0.3);
    border-radius: 10px;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: var(--foundry-light-gray);
}

.method-tab:hover {
    border-color: var(--molten-orange);
    transform: translateY(-2px);
    background: rgba(60, 60, 60, 0.9);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.2);
}

.method-tab.active {
    background: linear-gradient(135deg, var(--molten-orange), var(--molten-red));
    color: white;
    border-color: var(--molten-orange);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    background: var(--gradient-primary);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(-1px);
}

.analysis-section {
    display: none;
    background: rgba(45, 45, 45, 0.8);
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 107, 53, 0.2);
    color: var(--foundry-light-gray);
}

.analysis-section.active {
    display: block;
}

.progress-container {
    background: rgba(60, 60, 60, 0.6);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.progress-container::-webkit-scrollbar {
    width: 8px;
}

.progress-container::-webkit-scrollbar-track {
    background: rgba(60, 60, 60, 0.8);
    border-radius: 4px;
}

.progress-container::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
    border-radius: 4px;
}

.progress-container::-webkit-scrollbar-thumb:hover {
    background: var(--molten-orange);
}

.verbose-toggle-section {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: 400px;
}

.verbose-toggle-section .card {
    border: 2px solid rgba(255, 107, 53, 0.3);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 10px rgba(255, 107, 53, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(26, 26, 26, 0.95);
    color: var(--foundry-light-gray);
}

.verbose-toggle-section .form-check-input {
    width: 3rem;
    height: 1.5rem;
    margin-right: 0.75rem;
}

.verbose-toggle-section .form-check-input:checked {
    background-color: var(--molten-orange);
    border-color: var(--molten-orange);
    box-shadow: 0 0 5px rgba(255, 107, 53, 0.3);
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(60, 60, 60, 0.8);
    border-radius: 8px;
    border-left: 4px solid rgba(255, 107, 53, 0.3);
    transition: all 0.3s ease;
    color: var(--foundry-light-gray);
}

.progress-item.success {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    color: var(--foundry-light-gray);
}

.progress-item.error {
    border-left-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    color: var(--foundry-light-gray);
}

.progress-item.warning {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
    color: var(--foundry-light-gray);
}

.progress-item.info {
    border-left-color: var(--info-color);
    background: rgba(59, 130, 246, 0.1);
    color: var(--foundry-light-gray);
}

.progress-item.step {
    border-left-color: var(--molten-orange);
    background: rgba(255, 107, 53, 0.1);
    color: var(--foundry-light-gray);
}

.progress-item.llm {
    border-left-color: var(--secondary-color);
    background: rgba(255, 140, 66, 0.1);
    color: var(--foundry-light-gray);
}

.progress-item.section {
    border-left-color: var(--molten-yellow);
    background: rgba(251, 191, 36, 0.1);
    font-weight: 600;
    color: var(--foundry-light-gray);
}

.progress-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.progress-text {
    flex: 1;
    font-size: 0.95rem;
}

.results-container {
    margin-top: 2rem;
}

.result-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 20px 0 0 20px;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: var(--border-accent);
}

.result-card h5 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.competitor-item {
    background: var(--bg-tertiary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.competitor-item.pending {
    background: var(--bg-tertiary);
    border-color: var(--warning-color);
}

.competitor-item.analyzing {
    background: var(--bg-secondary);
    border-color: var(--info-color);
    animation: pulse-border 2s infinite;
}

.competitor-item.completed {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--text-inverse);
    box-shadow: var(--shadow-xl), 0 0 20px rgba(16, 185, 129, 0.4);
}

.competitor-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-secondary);
    border-radius: 16px 16px 0 0;
}

.competitor-item.completed::before {
    background: var(--success-color);
}

.competitor-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: var(--border-accent);
    background: var(--bg-card);
}

.competitor-item.completed:hover {
    background: var(--success-color);
    box-shadow: var(--shadow-xl), 0 0 25px rgba(16, 185, 129, 0.6);
    border-color: var(--success-color);
}

@keyframes pulse-border {
    0% { border-color: var(--info-color); }
    50% { border-color: rgba(59, 130, 246, 0.4); }
    100% { border-color: var(--info-color); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.6; }
}

.competitor-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.competitor-item.completed .competitor-name,
.competitor-item.completed .competitor-url,
.competitor-item.completed .competitor-description {
    color: var(--text-inverse);
}

.competitor-url {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.competitor-item.completed .competitor-url {
    color: rgba(255, 255, 255, 0.8);
}

.competitor-url:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

.competitor-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.75rem;
    line-height: 1.6;
}

.status-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.8rem;
    color: var(--warning-color);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
}

.competitor-item.analyzing .status-indicator {
    color: var(--info-color);
    animation: spin 2s linear infinite;
}

.competitor-item.completed .status-indicator {
    color: var(--success-color);
    animation: pop-in 0.5s ease-out forwards;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pop-in {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

.agent-icons {
    display: flex;
    gap: 8px;
}

.agent-icon {
    opacity: 0.3;
    color: var(--foundry-gray);
    transition: all 0.2s ease;
}

.agent-icon.analyzing {
    animation: blink 1s infinite;
    opacity: 0.8;
    color: var(--molten-orange);
}

.agent-icon.completed {
    opacity: 1;
    color: var(--success-color);
    text-shadow: 0 0 5px rgba(16, 185, 129, 0.3);
}

.competitor-rank {
    position: absolute;
    top: -12px;
    left: -12px;
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    color: var(--text-inverse);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    z-index: 10;
    border: 3px solid var(--bg-card);
    transition: all 0.3s ease;
}

.competitor-rank:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.competitor-item {
    position: relative;
}

.data-field {
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(60, 60, 60, 0.6);
    border-radius: 8px;
    border-left: 4px solid var(--molten-orange);
    color: var(--foundry-light-gray);
}

.data-field label {
    font-weight: 600;
    color: var(--molten-orange);
    margin-bottom: 0.5rem;
    display: block;
    text-shadow: 0 0 5px rgba(255, 107, 53, 0.3);
}

.data-field .field-value {
    color: var(--foundry-light-gray);
    line-height: 1.5;
}

.data-field .field-value.empty {
    color: var(--foundry-gray);
    font-style: italic;
}

.data-field .field-value.list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.data-field .field-value.list .badge {
    background: linear-gradient(135deg, var(--molten-orange), var(--molten-red));
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.data-field .field-value.boolean {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.data-field .field-value.boolean .status {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.data-field .field-value.boolean .status.true {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.data-field .field-value.boolean .status.false {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Markdown content styling */
.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    color: var(--molten-orange);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-shadow: 0 0 5px rgba(255, 107, 53, 0.3);
}

.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.3rem; }
.markdown-content h3 { font-size: 1.1rem; }

.markdown-content p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.markdown-content ul, .markdown-content ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content strong {
    font-weight: 600;
    color: var(--molten-orange);
    text-shadow: 0 0 3px rgba(255, 107, 53, 0.3);
}

.markdown-content em {
    font-style: italic;
    color: var(--foundry-gray);
}

.markdown-content code {
    background: rgba(60, 60, 60, 0.8);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--foundry-light-gray);
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.markdown-content blockquote {
    border-left: 4px solid var(--molten-orange);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--foundry-gray);
    background: rgba(60, 60, 60, 0.3);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
}

/* Strategist CTA */
.strategist-cta {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 1050;
}
.strategist-btn {
    position: relative;
    border: 2px solid rgba(255, 107, 53, 0.8);
    border-radius: 999px;
    padding: 1.25rem 2.4rem;
    font-size: 1.1rem;
    color: #fff;
    background: linear-gradient(90deg, var(--molten-orange), var(--molten-red));
    box-shadow: 0 20px 48px rgba(255, 107, 53, 0.55), 0 0 24px rgba(255, 107, 53, 0.45);
    font-weight: 800;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.strategist-btn .pulse-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 35%, rgba(255,255,255,0) 70%);
    background-size: 250% 100%;
    animation: strategist-shine 1.6s linear infinite;
    pointer-events: none;
}
.strategist-btn .btn-label { position: relative; z-index: 1; }
.strategist-btn::after,
.strategist-btn::before {
    content: none !important;
    display: none !important;
    animation: none !important;
    border: 0 !important;
}
@keyframes strategist-shine {
    0% { background-position: 200% 0; opacity: 0.7; }
    50% { background-position: 100% 0; opacity: 1; }
    100% { background-position: 0% 0; opacity: 0.7; }
}
@keyframes strategist-ring {
    0% { transform: scale(0.9); opacity: 0.9; }
    60% { transform: scale(1.25); opacity: 0.35; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Strategist Chat UI */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-card);
    border-radius: 20px;
}
.chat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    border-radius: 20px 20px 0 0;
    color: var(--text-primary);
}
.chat-header .avatar {
    width: 26px; 
    height: 26px; 
    border-radius: 50%; 
    background: var(--gradient-primary);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
    font-size: 0.8rem;
}
.chat-header .fw-bold {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 700;
}
.chat-header .text-muted {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.chat-header .btn-close {
    font-size: 1.2rem;
    opacity: 1;
    filter: invert(1) grayscale(1) brightness(2);
    transition: all 0.3s ease;
}

.chat-header .btn-close:hover {
    filter: invert(1) grayscale(0) brightness(1) drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
}
.chat-input {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    border-radius: 0 0 20px 20px;
}
.chat-line { 
    margin-bottom: 1rem; 
    display: flex; 
}
.chat-line.user { 
    justify-content: flex-end; 
}
.chat-line.assistant { 
    justify-content: flex-start; 
}
.bubble {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}
.assistant .bubble { 
    background: var(--bg-tertiary); 
    border: 1px solid var(--border-primary); 
    color: var(--text-primary); 
}
.user .bubble { 
    background: var(--gradient-primary); 
    color: var(--text-inverse); 
    border: 1px solid var(--primary-color); 
}
.bubble .meta { 
    font-size: 0.8rem; 
    color: var(--primary-color); 
    margin-bottom: 0.5rem; 
    font-weight: 600;
    opacity: 0.8;
}
.bubble .content { 
    font-size: 0.95rem; 
    line-height: 1.6; 
    color: var(--text-primary);
}
.user .bubble .meta {
    color: var(--text-inverse);
    opacity: 0.9;
}
.user .bubble .content {
    color: var(--text-inverse);
}

/* Markdown inside bubbles */
.bubble .content h1, .bubble .content h2, .bubble .content h3,
.bubble .content h4, .bubble .content h5, .bubble .content h6 {
    color: var(--primary-color);
    margin: 0.5rem 0;
    font-weight: 700;
}
.user .bubble .content h1, .user .bubble .content h2, .user .bubble .content h3,
.user .bubble .content h4, .user .bubble .content h5, .user .bubble .content h6 {
    color: var(--text-inverse);
}
.bubble .content pre, .bubble .content code {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 0.375rem 0.5rem;
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
}
.bubble .content pre { 
    padding: 1rem; 
    overflow-x: auto; 
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
}
.bubble .content ul { 
    padding-left: 1.5rem; 
    margin: 0.5rem 0;
}
.bubble .content li {
    margin: 0.25rem 0;
    color: var(--text-primary);
}
.user .bubble .content li {
    color: var(--text-inverse);
}

/* Make assistant responses full width */
.assistant .bubble {
    width: 100%;
    max-width: 100%;
}

/* Suggested questions styling */
.suggested-questions-container {
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    background: var(--bg-tertiary);
    overflow: hidden;
    transition: all 0.3s ease;
}

.suggested-questions {
    padding: 1rem 1.25rem;
    transition: all 0.3s ease;
    max-height: 300px;
    overflow-y: auto;
}

.suggested-questions.collapsed {
    max-height: 0;
    padding: 0 1.25rem;
    overflow: hidden;
}

.suggested-questions-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0;
}

#toggle-suggestions {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

#toggle-suggestions:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

#suggestions-icon {
    transition: transform 0.3s ease;
}

.suggested-questions.collapsed + .suggested-questions-container #suggestions-icon {
    transform: rotate(-90deg);
}

.suggested-question {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.5rem;
}

.suggested-question:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Mobile responsive design for suggested questions */
@media (max-width: 768px) {
    .suggested-questions {
        padding: 0.75rem 1rem;
        max-height: 200px;
    }
    
    .suggested-question {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
        margin-bottom: 0.375rem;
    }
    
    .suggested-questions-title {
        font-size: 0.85rem;
    }
    
    #toggle-suggestions {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .suggested-questions {
        padding: 0.5rem 0.75rem;
        max-height: 150px;
    }
    
    .suggested-question {
        font-size: 0.75rem;
        padding: 0.25rem 0.375rem;
        margin-bottom: 0.25rem;
    }
    
    /* Stack questions vertically on very small screens */
    .suggested-questions .d-flex {
        flex-direction: column;
    }
    
    .suggested-question {
        width: 100%;
        text-align: left;
    }
}

/* Markdown table styling inside assistant bubbles */
.bubble .content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1.25rem 0;
    background: var(--bg-tertiary);
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}
.bubble .content thead {
    background: var(--primary-color);
}
.bubble .content th,
.bubble .content td {
    border: 1px solid var(--border-primary);
    padding: 0.75rem 1rem;
    vertical-align: top;
    color: var(--text-primary);
}
.bubble .content th {
    font-weight: 700;
    color: var(--text-inverse);
    font-size: 0.9rem;
}
.bubble .content tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}
.bubble .content table thead th:first-child {
    border-top-left-radius: 12px;
}
.bubble .content table thead th:last-child {
    border-top-right-radius: 12px;
}
.bubble .content table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}
.bubble .content table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}
.user .bubble .content table {
    background: rgba(255, 255, 255, 0.1);
}
.user .bubble .content th {
    color: var(--text-inverse);
}
.user .bubble .content td {
    color: var(--text-inverse);
}

/* Ensure wide content scrolls instead of breaking layout */
.bubble .content {
    overflow-x: auto;
}

/* Additional button styles */
.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--primary-color);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--border-accent);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Modern Loading Experience */
.loading-experience {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 3rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border: 1px solid var(--border-primary);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loading-animation {
    position: relative;
    width: 200px;
    height: 200px;
}

.ai-brain {
    position: relative;
    width: 100%;
    height: 100%;
    animation: brainPulse 2s ease-in-out infinite;
}

.brain-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: coreRotate 3s linear infinite;
}

.neural-network {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.neuron {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: neuronPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 10px var(--accent-color);
}

.neuron:nth-child(1) { top: 20%; left: 20%; animation-delay: 0s; }
.neuron:nth-child(2) { top: 20%; right: 20%; animation-delay: 0.2s; }
.neuron:nth-child(3) { top: 50%; left: 10%; animation-delay: 0.4s; }
.neuron:nth-child(4) { top: 50%; right: 10%; animation-delay: 0.6s; }
.neuron:nth-child(5) { bottom: 20%; left: 20%; animation-delay: 0.8s; }
.neuron:nth-child(6) { bottom: 20%; right: 20%; animation-delay: 1s; }

.data-streams {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.stream {
    position: absolute;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--primary-color), transparent);
    animation: streamFlow 2s linear infinite;
}

.stream:nth-child(1) { left: 30%; animation-delay: 0s; }
.stream:nth-child(2) { left: 50%; animation-delay: 0.7s; }
.stream:nth-child(3) { left: 70%; animation-delay: 1.4s; }

.loading-content {
    max-width: 600px;
    width: 100%;
}

.loading-title {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    transition: all 0.5s ease;
    opacity: 0.5;
    transform: translateX(-20px);
}

.step.active {
    opacity: 1;
    transform: translateX(0);
    background: var(--bg-card);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.step.completed {
    opacity: 0.8;
    background: var(--success-color);
    color: var(--text-inverse);
    border-color: var(--success-color);
}

.step-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.step.active .step-icon {
    background: var(--primary-color);
    color: var(--text-inverse);
    animation: iconPulse 1s ease-in-out infinite;
}

.step.completed .step-icon {
    background: var(--text-inverse);
    color: var(--success-color);
}

.step-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.step.completed .step-text {
    color: var(--text-inverse);
}

.loading-progress {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    animation: progressFill 4s ease-in-out infinite;
    box-shadow: var(--shadow-sm);
}

.progress-text {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
}

/* Animations */
@keyframes brainPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes coreRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes neuronPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.7;
    }
    50% { 
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes streamFlow {
    0% { transform: translateY(-100%); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(100%); opacity: 0; }
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes progressFill {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Responsive design for loading experience */
@media (max-width: 768px) {
    .loading-experience {
        padding: 2rem 1.5rem;
    }
    
    .loading-animation {
        width: 150px;
        height: 150px;
    }
    
    .brain-core {
        width: 60px;
        height: 60px;
    }
    
    .loading-title {
        font-size: 1.5rem;
    }
    
    .step {
        padding: 0.75rem;
    }
    
    .step-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .loading-experience {
        padding: 1.5rem 1rem;
    }
    
    .loading-animation {
        width: 120px;
        height: 120px;
    }
    
    .brain-core {
        width: 50px;
        height: 50px;
    }
    
    .loading-title {
        font-size: 1.25rem;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

/* Text muted styling */
.text-muted {
    color: var(--foundry-gray) !important;
}

/* Small text styling */
.small {
    color: var(--foundry-gray);
}

/* Badge styling */
.badge {
    background: linear-gradient(135deg, var(--molten-orange), var(--molten-red));
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.badge.bg-warning {
    background: linear-gradient(135deg, var(--molten-yellow), #f59e0b) !important;
    color: var(--foundry-black) !important;
}

/* Form controls styling */
.form-control {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.form-control:focus {
    background: var(--bg-card);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.form-control:hover {
    border-color: var(--border-secondary);
    box-shadow: var(--shadow-md);
}

/* Modal styling */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
}

.modal-header {
    border-bottom: 1px solid var(--border-primary);
    border-radius: 20px 20px 0 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-footer {
    border-top: 1px solid var(--border-primary);
    border-radius: 0 0 20px 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.modal-body {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Competitor Modal Specific Styling */
.competitor-modal .modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.competitor-modal .modal-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.competitor-modal .modal-body {
    background: var(--bg-card);
    color: var(--text-primary);
}

.competitor-modal .modal-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    color: var(--text-primary);
}

/* Adjustments for nav-tabs to be more visible in modal */
.competitor-modal .nav-tabs {
    border-bottom: 2px solid var(--border-primary);
    margin-bottom: 1.5rem;
}

.competitor-modal .nav-link {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    margin-right: 5px;
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
}

.competitor-modal .nav-link:hover {
    color: var(--primary-color);
    background: var(--bg-card);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.competitor-modal .nav-link.active {
    color: var(--primary-color);
    background: var(--bg-card);
    border-color: var(--primary-color);
    border-bottom-color: var(--bg-card); /* To make it seamlessly connect to content */
    font-weight: 600;
}

.competitor-modal .tab-content {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

/* Analysis Phase Styling */
.analysis-phase {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-primary);
}

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

.phase-content {
    color: var(--text-primary);
}

/* Data Field Styling in Modals */
.data-field {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    color: var(--text-primary);
}

.data-field label {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    display: block;
    font-size: 0.95rem;
}

.data-field .field-value {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.data-field .field-value.empty {
    color: var(--text-muted);
    font-style: italic;
}

.data-field .field-value.list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.data-field .field-value.list .badge {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.data-field .field-value.boolean {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.data-field .field-value.boolean .status {
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.data-field .field-value.boolean .status.true {
    background: var(--success-color);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.data-field .field-value.boolean .status.false {
    background: var(--error-color);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

/* Progress items styling */
.progress-item {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.progress-item.success {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.progress-item.error {
    border-left-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.progress-item.warning {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.progress-item.info {
    border-left-color: var(--info-color);
    background: rgba(59, 130, 246, 0.1);
}

.progress-item.step {
    border-left-color: var(--molten-orange);
    background: rgba(255, 107, 53, 0.1);
}

.progress-item.llm {
    border-left-color: var(--secondary-color);
    background: rgba(255, 140, 66, 0.1);
}

.progress-item.section {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header-controls {
        position: static;
        justify-content: center;
        margin-bottom: 1rem;
        z-index: 1000;
    }
    
    .theme-toggle {
        min-width: 80px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .input-section {
        padding: 1.5rem;
    }
    
    .result-card {
        padding: 1.5rem;
    }
    
    .competitor-item {
        padding: 1rem;
    }
    
    .competitor-rank {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        top: -10px;
        left: -10px;
    }
}

@media (max-width: 480px) {
    .main-container {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .theme-toggle {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .btn-primary {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Styling for links within the competitor modal */
.competitor-modal a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.competitor-modal a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.competitor-modal .data-field .field-value a {
    color: var(--primary-color);
    font-weight: 500;
}

.competitor-modal .data-field .field-value a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Adjustments for badges with links */
.competitor-modal .data-field .field-value.list .badge a {
    color: var(--text-inverse);
    text-decoration: none;
}

.competitor-modal .data-field .field-value.list .badge a:hover {
    text-decoration: underline;
    color: var(--text-inverse);
}

/* Suggested Questions Sidebar Styling */
.suggested-questions-sidebar {
    width: 300px; /* Default width for the sidebar */
    background: var(--bg-tertiary);
    border-left: 1px solid var(--border-primary);
    transition: width 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
}

.suggested-questions-sidebar.collapsed {
    width: 0;
    /* keep sidebar in place so the edge tab remains visible */
    overflow: visible;
    border-left: none;
}

.suggested-questions-sidebar.collapsed .sidebar-header,
.suggested-questions-sidebar.collapsed .sidebar-content {
    display: none;
}

.suggested-questions-sidebar .sidebar-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.suggested-questions-sidebar .sidebar-content {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.suggested-questions-sidebar .suggested-question {
    width: 100%;
    text-align: left;
}

.chat-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
}

/* Adjust modal-dialog for full height in flex container */
.modal-dialog.modal-fullscreen .modal-content {
    display: flex;
    flex-direction: column;
}

.modal-dialog.modal-fullscreen .modal-body {
    flex-grow: 1;
    display: flex;
}

/* Responsive adjustments for sidebar */
@media (max-width: 992px) {
    .suggested-questions-sidebar {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: 250px; /* Smaller width for tablets */
        border-left: 1px solid var(--border-primary);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        transform: translateX(100%);
        background: var(--bg-tertiary);
    }

    .suggested-questions-sidebar.active {
        transform: translateX(0%);
        visibility: visible;
    }
    
    .chat-main-content {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .suggested-questions-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-primary);
        bottom: 0;
        left: 0;
        top: auto;
        height: 50%;
        transform: translateY(100%);
        flex-direction: column;
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
    }

    .suggested-questions-sidebar.active {
        transform: translateY(0%);
    }

    .chat-main-content {
        flex-grow: 1;
        overflow: hidden;
    }
}

@media (max-width: 576px) {
    .suggested-questions-sidebar {
        width: 100%;
        height: 60%;
    }
}

.toggle-sidebar-btn {
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
}

/* Sidebar edge tab */
.sidebar-tab {
    position: absolute;
    top: 50%;
    left: -16px; /* sits outside edge */
    transform: translateY(-50%);
    background: var(--primary-color);
    color: var(--text-inverse);
    border: none;
    border-radius: 6px 0 0 6px;
    width: 16px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 5;
}

.suggested-questions-sidebar.collapsed .sidebar-tab {
    left: -16px;
}
