/* ==========================================================================
   YouTube Knowledge AI - Design System & Modern Stylesheet
   ========================================================================== */

:root {
    /* Color Palette - Modern Minimalist SaaS */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --brand-accent: #818cf8;
    --brand-light: #eef2ff;
    
    --yt-red: #ff0000;
    --yt-red-dark: #dc2626;
    --yt-red-light: #fef2f2;

    --border-color: #e2e8f0;
    --border-focus: #a5b4fc;

    /* Spacing & Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

    --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Decorative Soft Glows */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

.bg-glow-1 {
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
}

.bg-glow-2 {
    bottom: -200px;
    right: 10%;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
}

/* App Container */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Navbar */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 2.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.badge-ai {
    background: linear-gradient(135deg, var(--brand-primary), #818cf8);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    margin-left: 0.25rem;

}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: white;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Search Box Area */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 0.75rem 0.75rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12), var(--shadow-lg);
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 0.4rem;
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 2px;
}

textarea#question-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text-primary);
    resize: none;
    min-height: 28px;
    max-height: 140px;
    line-height: 1.5;
}

textarea#question-input::placeholder {
    color: var(--text-muted);
}

.btn-submit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
    align-self: flex-end;
}

.btn-submit:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-submit:active {
    transform: translateY(0);
}

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

/* Suggestions Pills */
.suggestions-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0 0.25rem;
}

.suggestions-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.pills-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-pill {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.suggestion-pill:hover {
    background: var(--brand-light);
    color: var(--brand-primary);
    border-color: var(--border-focus);
    transform: translateY(-1px);
}

/* Cards & Layout Modules */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    animation: fadeIn 0.4s ease-out forwards;
}

.hidden {
    display: none !important;
}

/* Result Card Header */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--brand-light);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

/* Formatted AI Answer Styling */
.answer-content {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #1e293b;
}

.answer-content p {
    margin-bottom: 1.15rem;
}

.answer-content p:last-child {
    margin-bottom: 0;
}

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

.answer-content li {
    margin-bottom: 0.5rem;
}

.answer-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.answer-content h1, .answer-content h2, .answer-content h3 {
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* Sources Section */
.sources-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sources-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

.source-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
}

.source-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.source-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.source-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.source-timestamp {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.btn-yt-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #f0fdf4;
    color: #15803d;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid #bbf7d0;
    transition: all 0.2s ease;
}

.btn-yt-link:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
    transform: translateY(-1px);
}

/* Loading & Skeleton States */
.loading-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.loading-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brand-primary);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--brand-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s infinite;
}

.skeleton-line-long { width: 90%; }
.skeleton-line-medium { width: 75%; }
.skeleton-line-short { width: 50%; }

/* Error Card */
.error-card {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
}

.error-text {
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
}

/* Footer */
.app-footer {
    text-align: center;
    padding-top: 3rem;
    padding-bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .hero-title {
        font-size: 1.85rem;
    }
    
    .search-box {
        flex-direction: column;
        padding: 1rem;
    }
    
    .btn-submit {
        width: 100%;
        justify-content: center;
    }
    
    .sources-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Estilos de Personalización de Marca (Eloísa Wolf)
   ========================================================================== */

.channel-avatar-wrapper {
    position: relative;
    display: inline-block;
}

.channel-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.verified-badge {
    position: absolute;
    bottom: 2px;
    right: -2px;
    background: #0284c7;
    color: white;
    font-size: 10px;
    font-weight: 800;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
}

.channel-stats {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tarjeta Orientativa Amigable */
.welcome-guide-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.5rem;
}

.guide-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.guide-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.925rem;
    color: var(--text-secondary);
}

.guide-text strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Avatar de IA en Tarjeta de Respuesta */
.avatar-eloisa {
    padding: 0;
    background: transparent;
    overflow: hidden;
}

.avatar-eloisa img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.card-subtitle-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

