/* Linqed Academy FAQ - Material UI Inspired Styles */

:root {
    /* Light theme palette */
    --primary: #14b8a6;
    --primary-dark: #0d9488;
    --primary-light: #0ea5e9;
    --secondary: #2563eb;
    --background: #f8fafc; /* licht grijsblauw achtergrond */
    --surface: #ffffff; /* kaarten/panels */
    --surface-variant: #f1f5f9; /* lichte variant */
    --surface-hover: #eef2f7; /* hover state */
    --text-primary: #0f172a; /* slate-900 */
    --text-secondary: #475569; /* slate-600 */
    --text-disabled: #94a3b8; /* slate-400 */
    --border: #e2e8f0; /* slate-200 */
    --border-hover: #cbd5e1; /* slate-300 */
    --error: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.12);
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
}

/* Sticky header container */
/* Alleen de zoekbalk sticky maken (lichte oplossing) */
.search-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

/* Spacer to prevent content jump under fixed search bar */
.search-spacer { height: 64px; }

/* Search input styling */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

/* Search icon inside input */
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input-wrapper input:focus {
    background: var(--surface-hover);
    border-color: var(--primary);
    box-shadow: none; /* geen focus shadow */
}

/* Knowledge item cards */
.knowledge-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

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

.knowledge-item:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

/* Category filter buttons */
.category-filter-btn {
    position: relative;
    overflow: hidden;
    will-change: transform;
}

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

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

.category-filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Responsive layout voor categorieknoppen */
#category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    #category-filters { gap: 0.375rem; }
    .category-filter-btn {
        font-size: 11px;
        padding: 6px 10px;
        border-radius: 999px;
    }
}

/* Chips for categories and meta on cards */
.chips {
    display: flex;
    align-items: center;
    gap: 0.375rem; /* 6px */
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    background: var(--surface-variant);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.chip i { font-size: 12px; }

.chip:hover { 
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.chip--category {
    background: rgba(20, 184, 166, 0.10);
    color: #0d9488;
    border-color: rgba(20, 184, 166, 0.25);
}

.chip--video {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

/* Chat system styling */
#chat-section {
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    z-index: 1200;
}

/* Verberg chat visueel tot init klaar is om flicker te voorkomen */
#chat-section.chat-preload {
    opacity: 0;
    pointer-events: none;
}

/* volledig verbergbaar via inline style (display:none) door JS */
#chat-section[style*="display: none"] {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Expanded chat state */
#chat-section.expanded {
    width: min(768px, calc(100vw - 2rem)) !important;
    max-width: min(768px, calc(100vw - 2rem)) !important;
}

#chat-section.expanded #chat-messages {
    height: min(768px, calc(100vh - 200px)) !important;
}

/* Minimalized chat: hide top border/line and enlarge icon */
#chat-section.minimalized {
    border-top: none !important;
}

/* Expand button altijd zichtbaar houden */

/* AI thinking indicator */
.ai-thinking {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    margin-left: 2.5rem;
    animation: fadeIn 0.3s ease;
}

.ai-thinking .dots {
    display: flex;
    gap: 0.25rem;
}

.ai-thinking .dot {
    width: 0.375rem;
    height: 0.375rem;
    background: var(--primary);
    border-radius: 50%;
    animation: thinkingPulse 1.4s ease-in-out infinite both;
}

.ai-thinking .dot:nth-child(1) { animation-delay: -0.32s; }
.ai-thinking .dot:nth-child(2) { animation-delay: -0.16s; }
.ai-thinking .dot:nth-child(3) { animation-delay: 0s; }

@keyframes thinkingPulse {
    0%, 80%, 100% { 
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Fancy typing bubble with subtle shimmer */
/* Minimal loader: drie stippen die vloeiend pulseren */

/* verwijderde titel/bubble-stijlen */

/* shimmer verwijderd voor minimal variant */

/* Animated gradient border */
/* border animaties verwijderd */

@keyframes shimmerSlide {
    0% { left: -40%; }
    100% { left: 100%; }
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    /* standaard snelheid voor de pulserende dots */
    --dot-speed: 1.6s;
}

.typing-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--primary);
    will-change: opacity;
    animation-name: fadePulse;
    animation-duration: var(--dot-speed);
    animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
    animation-iteration-count: infinite;
    animation-direction: normal;
}

.typing-dots .dot:nth-child(1) { animation-delay: -0s; }
.typing-dots .dot:nth-child(2) { animation-delay: -0.2s; }
.typing-dots .dot:nth-child(3) { animation-delay: -0.4s; }

@keyframes fadePulse {
    0% { opacity: 0.25; }
    50% { opacity: 1; }
    100% { opacity: 0.25; }
}

/* overige animaties verwijderd voor minimal variant */

/* Progress underline */
/* progress-underline verwijderd */

/* spacing voor minimal variant */
.minimal-dots { padding: 6px 8px; }

/* Zorg dat animatie ook bij reduce-motion actief blijft voor de loader */
@media (prefers-reduced-motion: reduce) {
    .ai-thinking .dot {
        animation-duration: var(--dot-speed) !important;
        animation-iteration-count: infinite !important;
        animation-play-state: running !important;
    }
}

/* ShinyText (React Bits inspired) */
.shiny-text {
    color: #b5b5b5a4; /* intensiteit van basistekst */
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0.85) 50%,
        rgba(255, 255, 255, 0) 60%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    display: inline-block;
    animation: shine var(--shine-speed, 3s) linear infinite;
}

@keyframes shine {
    0%   { background-position: 100%; }
    100% { background-position: -100%; }
}

.shiny-text.disabled {
    animation: none;
}

#chat-messages {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    overflow-y: auto;
}

#chat-messages::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Webkit */
}

/* Chat input styling */
#chat-input {
    padding: 10px 0;
    line-height: 1.4;
    display: flex;
    align-items: center;
}

#chat-input:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

/* AI Avatar star styling - base without animation */
.ai-avatar-star {
    font-size: 28px;
    color: #36b39a;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: 50% 50%;
    will-change: transform;
}

/* Animated version for latest message only */
.ai-avatar-star.animated {
    animation: starHeartbeatRotate 12s ease-in-out infinite;
}

/* Combined heartbeat + rotation for Arc browser compatibility */
@keyframes starHeartbeatRotate {
    /* First heartbeat - boem boem */
    0% { transform: rotate(0deg) scale(1); }
    1.25% { transform: rotate(15deg) scale(1.2); }
    2.5% { transform: rotate(30deg) scale(1); }
    3.75% { transform: rotate(45deg) scale(1.2); }
    5% { transform: rotate(60deg) scale(1); }
    
    /* Continue rotating during pause */
    10% { transform: rotate(120deg) scale(1); }
    20% { transform: rotate(240deg) scale(1); }
    30% { transform: rotate(0deg) scale(1); }
    40% { transform: rotate(120deg) scale(1); }
    50% { transform: rotate(240deg) scale(1); }
    60% { transform: rotate(0deg) scale(1); }
    70% { transform: rotate(120deg) scale(1); }
    80% { transform: rotate(240deg) scale(1); }
    
    /* Second heartbeat - boem boem */
    90% { transform: rotate(0deg) scale(1); }
    91.25% { transform: rotate(15deg) scale(1.2); }
    92.5% { transform: rotate(30deg) scale(1); }
    93.75% { transform: rotate(45deg) scale(1.2); }
    95% { transform: rotate(60deg) scale(1); }
    
    /* Complete rotation */
    100% { transform: rotate(360deg) scale(1); }
}

/* AI indicator dot animation - fallback for browsers without SVG animate */
@keyframes aiPulse {
    0%, 100% { 
        opacity: 0.4; 
        transform: scale(1);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1);
    }
}

.ai-indicator {
    animation: aiPulse 2s ease-in-out infinite;
    transform-origin: center;
}

/* Modal styling */
.modal-overlay {
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: min(90vw, 1024px);
}

/* Consistent 16:9 video embed sizing for modals */
.video-embed {
    position: relative;
    width: min(100%, 850px); /* Clamp to ~850px width as requested */
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    margin: 0 auto; /* center inside modal */
}

.video-embed > iframe,
.video-embed > video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Prose styling for article content */
.prose {
    max-width: none;
}

.prose h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.prose h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    margin-top: 1.25rem;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.prose p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

.prose ul, .prose ol {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose code {
    background-color: var(--surface-variant);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.prose pre {
    background-color: var(--surface-variant);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x-auto;
    margin-bottom: 1rem;
}

.prose blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* Responsive design */
@media (max-width: 1024px) {
    .lg\\:px-40 {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (max-width: 768px) {
    .px-4, .sm\\:px-8 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    #chat-section {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
        max-width: none;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .grid.lg\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .modal-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 60vh;
    }
}

/* Focus management */
.modal-overlay:focus {
    outline: none;
}

/* Interactive elements */
button, .knowledge-item, .category-filter-btn {
    -webkit-tap-highlight-color: transparent;
}

/* Article links in chat */
.article-link {
    transition: all 0.2s ease;
}

.article-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.3);
}

/* External link badge styling - inline-friendly for chat messages */
.link-minimal {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, background-color;
    white-space: nowrap;
    vertical-align: baseline;
    line-height: 1.35;
    margin-top: 0;      /* minimale ruimte */
    margin-bottom: 0;   /* minimale ruimte */
}

.link-minimal:hover {
    background: rgba(245, 158, 11, 0.18);
    transform: translateY(-0.5px);
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.18);
}

.link-minimal:active {
    transform: translateY(0);
    background: rgba(245, 158, 11, 0.24);
    transition-duration: 0.1s;
}

/* Minimalistic Notion link styling - nu ook oranje en compact */
.notion-link-minimal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, background-color, border-color;
    user-select: none;
    white-space: nowrap;
    max-width: fit-content;
    background: rgba(245, 158, 11, 0.12) !important;
    border: 1px solid rgba(245, 158, 11, 0.28) !important;
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    margin-top: 0;
    margin-bottom: 0;
}

.notion-link-minimal:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    background: rgba(245, 158, 11, 0.18) !important;
}

.notion-link-minimal:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

/* Truncate long titles */
.notion-link-minimal span:nth-child(2) {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Legacy external link styling (fallback) */
.chat-ai-message a[target="_blank"]:not(.link-minimal) {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.375rem;
    background: rgba(20, 184, 166, 0.1);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.chat-ai-message a[target="_blank"]:not(.link-minimal):hover {
    background: rgba(20, 184, 166, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.2);
}

/* Error and success states */
.error-message {
    animation: shakeIn 0.5s ease;
}

@keyframes shakeIn {
    0%, 20%, 40%, 60%, 80%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
    }
}

/* Line clamp utility */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Gradient text effects */
.gradient-text {
    background: linear-gradient(45deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: #ffffff;
        --text-secondary: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Notion link minimal badges in chat */
.notion-link-minimal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, background-color, border-color;
    user-select: none;
    white-space: nowrap;
    max-width: fit-content;
    margin-top: 0.125rem;   /* minder verticale ruimte */
    margin-bottom: 0.125rem;/* minder verticale ruimte */
}

/* Kleur-varianten voor categorie-badges (6-tint palette) */
.badge-cat-0 { background: rgba(20, 184, 166, 0.08); border: 1px solid rgba(20, 184, 166, 0.25); }
.badge-cat-1 { background: rgba(37, 99, 235, 0.10);  border: 1px solid rgba(37, 99, 235, 0.28); }
.badge-cat-2 { background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.28); }
.badge-cat-3 { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.28); }
.badge-cat-4 { background: rgba(236, 72, 153, 0.12); border: 1px solid rgba(236, 72, 153, 0.28); }
.badge-cat-5 { background: rgba(34, 197, 94, 0.12);  border: 1px solid rgba(34, 197, 94, 0.28); }

/* Tekstkleur binnen badges subtiel laten meebewegen */
.badge-cat-0 span:nth-child(2) { color: #0d9488; }
.badge-cat-1 span:nth-child(2) { color: #2563eb; }
.badge-cat-2 span:nth-child(2) { color: #7c3aed; }
.badge-cat-3 span:nth-child(2) { color: #d97706; }
.badge-cat-4 span:nth-child(2) { color: #db2777; }
.badge-cat-5 span:nth-child(2) { color: #16a34a; }