/* Custom styles for NLWeb Demo */

/* ============================================================================
   Navigation
   ============================================================================ */

header {
    position: sticky;
    top: 0;
    background: var(--pico-background-color);
    z-index: 1000;
    border-bottom: 1px solid var(--pico-muted-border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.nav-brand {
    font-size: 1.25rem;
}

.mobile-menu-toggle {
    background: none;
    border: 2px solid var(--pico-primary);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--pico-border-radius);
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: var(--pico-primary-background);
    transform: scale(1.05);
}

.mobile-menu-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--pico-primary);
    stroke-width: 2;
}

.nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--pico-card-background-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    margin: 0;
    animation: slideDown 0.3s ease-out;
}

.nav-menu.active {
    display: flex;
    flex-direction: column;
}

.nav-link {
    display: block;
    padding: 1rem;
    text-decoration: none;
    color: var(--pico-color);
    border-radius: var(--pico-border-radius);
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.nav-link:hover {
    background: var(--pico-primary-background);
    color: var(--pico-primary);
    transform: translateX(5px);
}

.nav-menu hr {
    margin: 0.5rem 0;
    border-color: var(--pico-muted-border-color);
}

/* ============================================================================
   Theme Toggle
   ============================================================================ */

.theme-toggle-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    background: none;
    border: 1px solid var(--pico-primary);
    border-radius: var(--pico-border-radius);
    cursor: pointer;
    font-size: 1rem;
    color: var(--pico-color);
    transition: all 0.3s ease;
}

.theme-toggle-menu:hover {
    background: var(--pico-primary-background);
    color: var(--pico-primary);
    transform: translateX(5px);
}

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

.theme-label {
    font-weight: 500;
}

/* ============================================================================
   Section Backgrounds
   ============================================================================ */

.hero-section {
    background: linear-gradient(135deg,
        var(--pico-primary-background) 0%,
        transparent 100%);
    padding: 4rem 0;
    animation: fadeIn 0.8s ease-in;
}

.playground-section {
    background: var(--pico-background-color);
    padding: 4rem 0;
    border-top: 1px solid var(--pico-muted-border-color);
}

.features-section {
    background: linear-gradient(135deg,
        transparent 0%,
        var(--pico-card-background-color) 100%);
    padding: 4rem 0;
    border-top: 1px solid var(--pico-muted-border-color);
}

.quickstart-section {
    background: var(--pico-background-color);
    padding: 4rem 0;
    border-top: 1px solid var(--pico-muted-border-color);
}

.api-section {
    background: linear-gradient(135deg,
        var(--pico-card-background-color) 0%,
        var(--pico-background-color) 100%);
    padding: 4rem 0;
    border-top: 1px solid var(--pico-muted-border-color);
}

/* ============================================================================
   Hero Section
   ============================================================================ */

#hero {
    text-align: center;
}

#hero hgroup {
    margin-bottom: 3rem;
    animation: slideDown 0.6s ease-out;
}

#hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--pico-primary), var(--pico-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 768px) {
    #hero h1 {
        font-size: 3.5rem;
    }
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.hero-buttons a[role="button"] {
    margin: 0;
}

@media (max-width: 576px) {
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons a[role="button"] {
        width: 100%;
    }
}

/* ============================================================================
   Architecture Diagram
   ============================================================================ */

.architecture-diagram {
    max-width: 680px;
    margin: 2rem auto;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.arch-layer {
    background: linear-gradient(135deg, var(--pico-primary) 0%, var(--pico-primary-hover) 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.arch-layer::after {
    content: '▼';
    position: absolute;
    right: 1rem;
    top: 1.25rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

.arch-layer:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.arch-layer.active {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px) scale(1.02);
}

.arch-layer.active::after {
    transform: rotate(180deg);
}

.arch-layer[data-layer="sources"] {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.arch-layer[data-layer="ingestion"] {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.arch-layer[data-layer="vectorstore"] {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

.arch-layer[data-layer="core"] {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.arch-layer[data-layer="llm"] {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.arch-layer[data-layer="api"] {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.arch-layer[data-layer="clients"] {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.arch-layer-title {
    color: white;
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    margin: 0 0 0.75rem 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@media (min-width: 768px) {
    .arch-layer-title {
        font-size: 1.125rem;
    }
}

.arch-layer-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.arch-tag {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.arch-layer-desc {
    color: white;
    font-size: 0.875rem;
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.arch-layer-desc.visible {
    opacity: 1;
    max-height: 100px;
}

.arch-arrow {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

.arch-arrow svg {
    color: var(--pico-muted-color);
    opacity: 0.5;
}

.arch-dual-layer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
    .arch-dual-layer {
        flex-direction: row;
        align-items: stretch;
    }

    .arch-dual-layer .arch-layer {
        flex: 1;
        margin-bottom: 0;
    }
}

.arch-dual-arrow {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
}

@media (min-width: 768px) {
    .arch-dual-arrow {
        display: flex;
    }

    .arch-dual-arrow svg {
        color: var(--pico-muted-color);
        opacity: 0.5;
    }
}

.arch-insight {
    margin-top: 2rem;
    background: var(--pico-card-background-color);
    border: 2px solid var(--pico-muted-border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.arch-insight h4 {
    color: var(--pico-color);
    font-weight: 600;
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
}

.arch-insight p {
    color: var(--pico-muted-color);
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.6;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.button-glow {
    position: relative;
    overflow: hidden;
}

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

.button-glow:hover::before {
    left: 100%;
}

/* ============================================================================
   Playground Section
   ============================================================================ */

#playground h2,
#features h2,
#quickstart h2,
#api h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.mode-selector {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease-in;
}

.mode-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

.query-section {
    margin: 2rem 0;
}

.query-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.mode-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.mode-buttons label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

.example-queries {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.example-query {
    text-align: left;
    margin: 0;
    transition: transform 0.2s ease;
}

.example-query:hover {
    transform: translateX(5px);
}

/* ============================================================================
   Response Display
   ============================================================================ */

#responseContainer {
    margin-top: 2rem;
    animation: fadeIn 0.5s ease-in;
}

.response-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.response-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

.pretty-response {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.result-item {
    background: var(--pico-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: var(--pico-primary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.result-title {
    font-weight: 600;
    margin: 0;
    color: var(--pico-primary);
}

.result-score {
    background: var(--pico-primary-background);
    color: var(--pico-primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--pico-border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.result-url {
    font-size: 0.875rem;
    color: var(--pico-muted-color);
    word-break: break-all;
    margin: 0.25rem 0;
}

.result-description {
    margin: 0.75rem 0;
}

.result-schema {
    margin-top: 0.75rem;
}

.result-schema summary {
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-schema pre {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    max-height: 300px;
    overflow-y: auto;
}

.raw-response {
    background: var(--pico-code-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1.5rem;
    max-height: 600px;
    overflow: auto;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.raw-response code {
    background: none;
    padding: 0;
}

/* ============================================================================
   Syntax Highlighting for JSON
   ============================================================================ */

.json-key {
    color: #0066cc;
}

[data-theme="dark"] .json-key {
    color: #66b3ff;
}

.json-string {
    color: #008000;
}

[data-theme="dark"] .json-string {
    color: #90ee90;
}

.json-number {
    color: #ff8c00;
}

[data-theme="dark"] .json-number {
    color: #ffa500;
}

.json-boolean {
    color: #cc0000;
}

[data-theme="dark"] .json-boolean {
    color: #ff6666;
}

.json-null {
    color: #999999;
}

/* ============================================================================
   Features Section
   ============================================================================ */

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

#features article {
    height: 100%;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

#features article:hover {
    transform: translateY(-5px);
    border-color: var(--pico-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

#features h3 {
    margin-top: 0;
    font-size: 1.25rem;
}

/* ============================================================================
   Quick Start & API Sections
   ============================================================================ */

#quickstart article,
#api article {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
    border-left: 4px solid var(--pico-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

#quickstart article:hover,
#api article:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-left-width: 6px;
}

/* ============================================================================
   Loading Indicator
   ============================================================================ */

#loading {
    text-align: center;
    padding: 2rem;
}

/* ============================================================================
   Footer
   ============================================================================ */

footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    background: var(--pico-card-background-color);
    border-top: 1px solid var(--pico-muted-border-color);
}

/* ============================================================================
   Animations
   ============================================================================ */

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

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* ============================================================================
   Responsive Adjustments
   ============================================================================ */

@media (max-width: 768px) {
    .nav-brand {
        font-size: 1rem;
    }

    .mobile-menu-toggle {
        width: 2.5rem;
        height: 2.5rem;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }

    .query-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .mode-buttons {
        flex-direction: column;
        align-items: flex-start;
    }

    .response-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .hero-section,
    .playground-section,
    .features-section,
    .quickstart-section,
    .api-section {
        padding: 2rem 0;
    }

    #hero h1 {
        font-size: 1.75rem;
    }

    .nav-link {
        font-size: 1rem;
    }
}

/* Desktop optimizations */
@media (min-width: 769px) {
    .nav-menu {
        max-width: 400px;
        right: 0;
        left: auto;
    }
}

/* ============================================================================
   Smooth Scrolling
   ============================================================================ */

html {
    scroll-behavior: smooth;
}

/* ============================================================================
   Code Blocks
   ============================================================================ */

pre {
    background: var(--pico-code-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
    overflow-x: auto;
}

code {
    font-family: 'Courier New', Courier, monospace;
}
