/* ===========================================
   Docs Hub Styles
   Extends shared-header.css for documentation pages
   =========================================== */

/* Docs Layout - Sidebar + Content */
.docs-layout {
    display: flex;
    min-height: calc(100vh - 120px);
}

/* Sidebar */
.docs-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    padding: 24px;
    position: sticky;
    top: 69px;
    height: calc(100vh - 69px);
    overflow-y: auto;
}

/* Search Box */
.docs-search {
    position: relative;
    margin-bottom: 24px;
}

.docs-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 121, 203, 0.1);
}

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

.docs-search::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 4px;
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}

.search-results:empty {
    display: none;
}

.search-results a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.search-results a:last-child {
    border-bottom: none;
}

.search-results a:hover {
    background: var(--bg-alt);
}

.search-results .result-category {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-alt);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Sidebar Navigation */
.docs-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.docs-nav-section {
    margin-bottom: 16px;
}

.docs-nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.docs-nav-section-title:hover {
    color: var(--text);
}

.docs-nav-section-title .chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.docs-nav-section.collapsed .chevron {
    transform: rotate(-90deg);
}

.docs-nav-section.collapsed .docs-nav-items {
    display: none;
}

.docs-nav-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.docs-nav-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: background 0.1s, color 0.1s;
}

.docs-nav-item:hover {
    background: var(--bg);
    color: var(--text);
}

.docs-nav-item.active {
    background: rgba(26, 121, 203, 0.1);
    color: var(--primary);
    font-weight: 500;
}

/* Main Content Area */
.docs-content {
    flex: 1;
    padding: 48px 64px;
    max-width: 860px;
}

.docs-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.docs-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.docs-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.docs-content p {
    margin-bottom: 16px;
    color: var(--text);
    line-height: 1.7;
}

.docs-content ul, .docs-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.docs-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* TLDR Box */
.tldr {
    background: linear-gradient(135deg, #e3f4fd 0%, #d0e9f8 100%);
    border-left: 4px solid var(--primary);
    padding: 20px 24px;
    border-radius: 0 12px 12px 0;
    margin-bottom: 32px;
}

.tldr strong {
    color: var(--primary);
    font-weight: 700;
    margin-right: 8px;
}

.tldr p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

/* Properties Table */
.properties-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}

.properties-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-alt);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text);
}

.properties-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.properties-table tr:hover td {
    background: var(--bg-alt);
}

.properties-table code {
    background: rgba(26, 121, 203, 0.1);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
}

.properties-table .prop-name {
    font-weight: 600;
    color: var(--text);
}

.properties-table .prop-type {
    color: var(--text-muted);
    font-size: 12px;
}

.properties-table .prop-default {
    color: #10b981;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
}

/* Tip Box */
.tip-box {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 24px 0;
}

.tip-box.info {
    background: #dbeafe;
    border-left-color: #3b82f6;
}

.tip-box.success {
    background: #dcfce7;
    border-left-color: #22c55e;
}

.tip-box strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.tip-box p {
    margin: 0;
    font-size: 14px;
}

/* Related Docs Section */
.related-docs {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.related-docs h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.related-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.related-doc-card {
    display: block;
    padding: 16px;
    background: var(--bg-alt);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.2s;
}

.related-doc-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.related-doc-card .card-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.related-doc-card .card-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Node Icon Colors */
.node-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.node-icon.entry { background: #dcfce7; color: #22c55e; }
.node-icon.processor { background: #dbeafe; color: #3b82f6; }
.node-icon.exit { background: #ffedd5; color: #f97316; }
.node-icon.batcher { background: #f3e8ff; color: #a855f7; }
.node-icon.combiner { background: #cffafe; color: #06b6d4; }
.node-icon.separator { background: #fce7f3; color: #ec4899; }
.node-icon.assign { background: #ccfbf1; color: #14b8a6; }
.node-icon.resource { background: #fef3c7; color: #eab308; }
.node-icon.custom { background: #e0e7ff; color: #6366f1; }
.node-icon.text { background: #f1f5f9; color: #64748b; }
.node-icon.image { background: #f1f5f9; color: #64748b; }

/* Docs Hub Home - Cards Grid */
.docs-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.docs-category-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
}

.docs-category-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.docs-category-card h3 {
    margin-top: 0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.docs-category-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.docs-category-card .card-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Mobile Responsive */
@media (max-width: 960px) {
    .docs-layout {
        flex-direction: column;
    }

    .docs-sidebar {
        width: 100%;
        min-width: 100%;
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px 24px;
    }

    .docs-content {
        padding: 32px 24px;
    }

    .docs-nav-section {
        margin-bottom: 8px;
    }

    .docs-nav-items {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .docs-nav-item {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 640px) {
    .docs-content h1 {
        font-size: 1.5rem;
    }

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

    .properties-table {
        font-size: 13px;
    }

    .properties-table th,
    .properties-table td {
        padding: 10px 12px;
    }

    .docs-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .docs-sidebar {
        display: none;
    }

    .docs-content {
        padding: 0;
        max-width: 100%;
    }
}
