/* AgentRegistry Documentation - Matches Admin Panel Premium Style */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --bg-primary: #030305;
    --bg-secondary: rgba(15, 15, 20, 0.7);
    --bg-tertiary: rgba(25, 25, 35, 0.6);
    --bg-card: rgba(20, 20, 30, 0.6);
    --border: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(139, 92, 246, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #9ca3af;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.5);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.3);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.4);

    /* Premium Gradients */
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --gradient-text: linear-gradient(to right, #c4b5fd, #67e8f9);
    --gradient-hero: linear-gradient(180deg, rgba(139, 92, 246, 0.15) 0%, rgba(0, 0, 0, 0) 100%);

    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
    --surface: rgba(30, 30, 45, 0.6);
    --surface-hover: rgba(40, 40, 60, 0.7);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: rgba(255, 255, 255, 0.9);
    --bg-tertiary: rgba(240, 240, 250, 0.8);
    --bg-card: rgba(255, 255, 255, 0.9);
    --border: rgba(0, 0, 0, 0.1);
    --border-glow: rgba(138, 43, 226, 0.2);
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --surface: rgba(240, 240, 250, 0.9);
    --surface-hover: rgba(230, 230, 245, 1);
    --gradient-hero: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-2);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1000;
    transition: transform 0.3s, box-shadow 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px var(--accent-glow);
}

/* Search Bar */
.search-bar {
    position: relative;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
}

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

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--surface-hover);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Global Copy Button */
.code-block {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    opacity: 0;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.copy-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--success);
    color: var(--success);
    opacity: 1;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 4rem;
    /* Account for fixed nav */
}

/* Fix anchor scroll position for fixed header */
[id] {
    scroll-margin-top: 4rem;
}

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

/* Typography Enhancements - Match Admin Panel */
h1,
h2,
h3,
.section-title,
.logo {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(76, 29, 149, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.08), transparent 25%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation - Matching Admin Header */
nav {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1400px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.logo span {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-links a.active {
    background: var(--gradient-2);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Hero Section */
.hero {
    padding: 10rem 2rem 5rem;
    text-align: center;
    background: var(--gradient-hero);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('assets/hero.jpg') center/cover;
    opacity: 0.1;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.4rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons - Matching Admin Panel */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.btn-primary {
    background: var(--gradient-2);
    border: none;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

/* Stats Grid - Matching Admin Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glow);
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.1);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

/* Features Grid */
.section {
    padding: 5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.1);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Quick Start - Matching Section Cards */
.quick-start {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    margin-top: 3rem;
}

.quick-start h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Code Blocks */
.code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.9rem;
    color: #e0e0e0;
    line-height: 1.8;
}

.code-block code {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
}

.code-block .comment {
    color: #6a9955;
}

.code-block .command {
    color: #dcdcaa;
}

.code-block .string {
    color: #ce9178;
}

.code-block .keyword {
    color: #569cd6;
}

/* Documentation Layout */
.docs-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 5rem;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    padding: 2rem;
    position: fixed;
    top: 5rem;
    left: max(0px, calc((100vw - 1400px) / 2));
    height: calc(100vh - 5rem);
    overflow-y: auto;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
}

.sidebar h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 0.25rem;
}

.sidebar a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.sidebar a:hover {
    color: var(--accent-light);
    background: var(--bg-tertiary);
}

/* Main Content */
.content {
    flex: 1;
    margin-left: 260px;
    padding: 3rem 4rem;
    max-width: 900px;
}

.content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content .lead {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.content h2 {
    font-size: 1.5rem;
    margin: 3rem 0 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-primary);
}

.content h2:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.content h3 {
    font-size: 1.1rem;
    margin: 2rem 0 1rem;
    color: var(--accent-light);
}

.content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.content ul,
.content ol {
    margin: 1rem 0 1.5rem 1.5rem;
    color: var(--text-secondary);
}

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

.content code {
    background: rgba(139, 92, 246, 0.15);
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9em;
    color: var(--accent-light);
}

/* Tables - Matching Admin Panel */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

th,
td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-tertiary);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

td {
    color: var(--text-primary);
}

/* Boxes - Matching Admin Panel Style */
.highlight-box,
.tip-box,
.warning-box {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
}

.highlight-box {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.tip-box {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.highlight-box h4,
.tip-box h4,
.warning-box h4 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.highlight-box p,
.tip-box p,
.warning-box p,
.highlight-box ul,
.tip-box ul,
.warning-box ul {
    margin-bottom: 0;
    color: var(--text-secondary);
}

/* Badges - Matching Admin Panel */
.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

/* Footer */
footer {
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

footer p {
    color: var(--text-secondary);
}

footer a {
    color: var(--accent-light);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent);
}

.footer-docs {
    margin-left: 260px;
}

/* ============================
   MOBILE RESPONSIVE DESIGN
   ============================ */

/* Hamburger Menu (hidden on desktop) */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Overlay */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    padding: 5rem 2rem 2rem;
    overflow-y: auto;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav a {
    display: block;
    padding: 1rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
    min-height: 48px;
    /* Touch target */
}

.mobile-nav a:hover,
.mobile-nav a.active {
    background: var(--gradient-2);
    color: white;
}

/* Responsive: Medium screens (tablets, 600-900px) */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
        padding: 2rem 1.5rem;
    }

    .footer-docs {
        margin-left: 0;
    }

    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Theme toggle: visible above mobile nav */
    .theme-toggle {
        z-index: 1002;
    }
}

/* Responsive: Compact screens (phones, <600px) */
@media (max-width: 600px) {
    nav {
        padding: 0.75rem 1rem;
    }

    .nav-content {
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.2rem;
        gap: 0.5rem;
    }

    .logo img {
        width: 32px !important;
        height: 32px !important;
    }

    .logo span:last-child {
        display: none;
        /* Hide "Docs" label on mobile */
    }

    .hero {
        padding: 7rem 1rem 3rem;
    }

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

    .hero p {
        font-size: 1rem;
    }

    .hero-highlights {
        flex-direction: column;
        align-items: center;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    .section {
        padding: 2rem 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        padding: 2rem 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .content {
        padding: 1.5rem 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .content h1 {
        font-size: 1.75rem;
    }

    .content h2 {
        font-size: 1.25rem;
    }

    /* Code blocks: horizontal scroll */
    .code-block {
        padding: 1rem;
        font-size: 0.8rem;
        margin: 1rem -0.5rem;
        border-radius: 8px;
    }

    /* Tables: horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* Touch targets */
    .btn {
        min-height: 48px;
        padding: 0.875rem 1.25rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .quick-start {
        padding: 1.5rem;
    }

    /* Theme toggle position */
    .theme-toggle {
        bottom: calc(1rem + env(safe-area-inset-bottom));
        right: 1rem;
        width: 44px;
        height: 44px;
    }

    footer {
        padding: 2rem 1rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    }

    /* Forms: prevent iOS zoom */
    input,
    select,
    textarea,
    .search-input {
        font-size: 16px !important;
    }
}

/* Prevent horizontal overflow */
html,
body {
    max-width: 100vw;
    overflow-x: hidden;
}