/**
 * KyotoTech Documentation Styles
 * Responsive documentation layout with sidebar navigation and syntax highlighting
 * Version: 1.0.0
 */

/* Documentation Page Layout */
.docs-page {
    padding-top: 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.docs-layout {
    display: flex;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar */
.docs-sidebar {
    width: 280px;
    min-width: 280px;
    background: #f8f9fa;
    border-right: 1px solid var(--border-color);
    height: calc(100vh - 80px);
    position: sticky;
    top: 80px;
    overflow-y: auto;
    padding: 1.5rem 0;
    transition: transform 0.3s ease;
}

.docs-sidebar-header {
    padding: 0 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.docs-sidebar-header h2 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
}

/* Search Box */
.docs-search {
    position: relative;
}

.docs-search-input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.25rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
    color: var(--primary-color);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

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

.docs-search-input::placeholder {
    color: #b0b0b0;
}

.docs-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.docs-search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    background: #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.docs-search-clear:hover {
    background: #d0d0d0;
    color: var(--primary-color);
}

.docs-search-input:not(:placeholder-shown) + .docs-search-icon + .docs-search-clear {
    display: flex;
}

/* Search Results */
.docs-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

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

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

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

.docs-search-result:hover {
    background: #f7f9fb;
}

.docs-search-result-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.docs-search-result-context {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.docs-search-result-context mark {
    background: #fff3cd;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.docs-search-no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Product Navigation */
.docs-nav-products {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.docs-nav-products h3 {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0.5rem 0.5rem;
}

.docs-product-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.docs-product-link:hover {
    background: #ffffff;
    color: var(--primary-color);
}

.docs-product-link.active {
    background: #ffffff;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.docs-product-link .product-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: linear-gradient(135deg, #c41e3a 0%, #8b1a2e 100%);
    color: #fff;
    border-radius: 4px;
    margin-left: auto;
}

/* Section Navigation */
.docs-nav-sections {
    padding: 0 1rem;
}

.docs-nav-sections h3 {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0.5rem 0.5rem;
}

.docs-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-nav-item {
    margin-bottom: 0.125rem;
}

.docs-nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.docs-nav-link:hover {
    background: #ffffff;
    color: var(--primary-color);
}

.docs-nav-link.active {
    background: #ffffff;
    color: var(--primary-color);
    border-left-color: #c41e3a;
    font-weight: 500;
}

/* Main Content */
.docs-main {
    flex: 1;
    min-width: 0;
    padding: 2rem 3rem 4rem;
    max-width: 900px;
}

/* Documentation Header */
.docs-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.docs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.docs-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.docs-breadcrumb a:hover {
    color: var(--primary-color);
}

.docs-breadcrumb span {
    color: #d0d0d0;
}

.docs-title {
    font-size: 2.25rem;
    font-weight: 300;
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
}

.docs-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.docs-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.docs-meta-item svg {
    width: 14px;
    height: 14px;
}

/* Documentation Content */
.docs-content h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--primary-color);
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.docs-content h2:first-child {
    margin-top: 0;
}

.docs-content h3 {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--primary-color);
    margin: 2rem 0 0.75rem;
}

.docs-content h4 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    margin: 1.5rem 0 0.5rem;
}

.docs-content p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.docs-content ul,
.docs-content ol {
    margin: 0.75rem 0 1rem 1.5rem;
    padding: 0;
}

.docs-content li {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.docs-content li strong {
    color: var(--primary-color);
}

/* Anchor Links */
.docs-content h2[id],
.docs-content h3[id],
.docs-content h4[id] {
    position: relative;
    scroll-margin-top: 100px;
}

.docs-content h2[id]:hover .anchor-link,
.docs-content h3[id]:hover .anchor-link,
.docs-content h4[id]:hover .anchor-link {
    opacity: 1;
}

.anchor-link {
    position: absolute;
    left: -1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-weight: 400;
}

.anchor-link:hover {
    color: #c41e3a;
}

/* Code Blocks */
.docs-content code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
}

.docs-content p code,
.docs-content li code {
    background: #f5f5f5;
    color: #c41e3a;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid #e8e8e8;
}

.docs-content pre {
    margin: 1rem 0 1.5rem;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.docs-content pre code {
    display: block;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    background: #1e1e2e;
    color: #cdd6f4;
    line-height: 1.6;
    font-size: 0.875rem;
    -webkit-overflow-scrolling: touch;
}

/* Code Block Header (optional language label) */
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: #181825;
    font-size: 0.75rem;
    color: #6c7086;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: #6c7086;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
}

.code-copy-btn:hover {
    color: #cdd6f4;
    background: rgba(255, 255, 255, 0.1);
}

.code-copy-btn.copied {
    color: #a6e3a1;
}

/* Syntax Highlighting - Catppuccin Mocha Theme */
.hljs-keyword,
.hljs-built_in {
    color: #cba6f7;
}

.hljs-type,
.hljs-class .hljs-title,
.hljs-title.class_ {
    color: #f9e2af;
}

.hljs-string,
.hljs-attr {
    color: #a6e3a1;
}

.hljs-number,
.hljs-literal {
    color: #fab387;
}

.hljs-comment {
    color: #6c7086;
    font-style: italic;
}

.hljs-function .hljs-title,
.hljs-title.function_ {
    color: #89b4fa;
}

.hljs-variable,
.hljs-params {
    color: #f38ba8;
}

.hljs-property {
    color: #89dceb;
}

.hljs-punctuation {
    color: #94e2d5;
}

.hljs-operator {
    color: #89dceb;
}

/* Tables */
.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
    font-size: 0.9rem;
}

.docs-content th,
.docs-content td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.docs-content th {
    font-weight: 500;
    color: var(--primary-color);
    background: #f7f9fb;
}

.docs-content tbody tr:hover {
    background: #fafbfc;
}

/* Info Boxes */
.docs-info-box {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.docs-info-box p {
    margin: 0;
}

.docs-info-box.note {
    background: #f0f9ff;
    border-color: #0ea5e9;
}

.docs-info-box.warning {
    background: #fff8f0;
    border-color: #f97316;
}

.docs-info-box.danger {
    background: #fff0f0;
    border-color: #ef4444;
}

.docs-info-box.tip {
    background: #f0fdf4;
    border-color: #22c55e;
}

.docs-info-box-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-info-box.note .docs-info-box-title {
    color: #0284c7;
}

.docs-info-box.warning .docs-info-box-title {
    color: #ea580c;
}

.docs-info-box.danger .docs-info-box-title {
    color: #dc2626;
}

.docs-info-box.tip .docs-info-box-title {
    color: #16a34a;
}

/* Mobile Sidebar Toggle */
.docs-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1001;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.docs-mobile-toggle:hover {
    transform: scale(1.05);
}

.docs-mobile-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile Overlay */
.docs-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.docs-overlay.active {
    opacity: 1;
}

/* Version Badge */
.docs-version {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .docs-main {
        padding: 1.5rem 2rem 3rem;
    }
}

@media (max-width: 768px) {
    .docs-page {
        padding-top: 70px;
    }

    .docs-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        padding-top: 80px;
    }

    .docs-sidebar.active {
        transform: translateX(0);
    }

    .docs-mobile-toggle {
        display: flex;
    }

    .docs-overlay {
        display: block;
        pointer-events: none;
    }

    .docs-overlay.active {
        pointer-events: auto;
    }

    .docs-main {
        padding: 1.5rem 1.5rem 3rem;
        max-width: 100%;
    }

    .docs-title {
        font-size: 1.75rem;
    }

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

    .docs-content h3 {
        font-size: 1.1rem;
    }

    .docs-content pre code {
        font-size: 0.8rem;
        padding: 1rem;
    }

    .anchor-link {
        display: none;
    }

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

@media (max-width: 480px) {
    .docs-sidebar {
        width: 100%;
        min-width: 100%;
    }

    .docs-main {
        padding: 1rem 1rem 2rem;
    }

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

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

    .docs-content pre {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
    }

    .docs-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Print Styles */
@media print {
    .docs-sidebar,
    .docs-mobile-toggle,
    .navbar {
        display: none !important;
    }

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

    .docs-content pre {
        white-space: pre-wrap;
        word-wrap: break-word;
    }
}
