/* Documentation Page Styles */

.docs-page {
    padding: 100px 0 60px;
    min-height: calc(100vh - 200px);
}

.docs-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 60px;
    align-items: start;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--primary);
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: var(--text-highlight);
}

/* Sidebar */
.docs-sidebar {
    position: sticky;
    top: 100px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    backdrop-filter: blur(10px);
    /* Ensure minimum touch targets */
    min-height: 44px;
    overflow: visible;
}

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

.search-box i.fa-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    width: 100%;
    padding: 10px 36px 10px 36px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.3s ease;
}

.clear-btn:hover {
    color: var(--text-highlight);
}

/* Search Highlight */
.search-highlight {
    animation: highlightPulse 0.5s ease;
}

@keyframes highlightPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Search Match Highlighting */
mark.search-match {
    background: rgba(99, 102, 241, 0.25);
    color: var(--text-highlight);
    padding: 1px 3px;
    border-radius: 3px;
    font-style: inherit;
    font-weight: inherit;
}

/* Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    font-family: inherit;
    font-size: 0.9rem;
}

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

.search-result-item:hover,
.search-result-item.search-result-active {
    background: rgba(99, 102, 241, 0.1);
}

.search-result-item.search-result-active {
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-highlight);
    font-size: 0.9rem;
}

.search-result-snippet {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-snippet strong {
    color: var(--primary);
    font-weight: 600;
}

/* Search Status Badge */
.search-status {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    z-index: 50;
}

.search-results-dropdown+.search-status {
    top: auto;
    position: relative;
    display: inline-block;
    margin-top: 4px;
}

/* Jump Flash Animation */
@keyframes jumpFlash {
    0% {
        background: rgba(99, 102, 241, 0.15);
    }

    100% {
        background: transparent;
    }
}

.search-jump-flash {
    animation: jumpFlash 1s ease;
    border-radius: var(--radius-md);
}

/* Sidebar search match */
.search-sidebar-match {
    color: var(--primary) !important;
    font-weight: 600;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
    display: block;
}

.no-results p {
    font-size: 1.1rem;
}

.no-results-hint {
    font-size: 0.95rem !important;
    margin-top: 12px;
}

.no-results-clear {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    font-size: inherit;
    text-decoration: underline;
    font-family: inherit;
}

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sidebar-section ul {
    list-style: none;
}

.sidebar-section ul li {
    margin-bottom: 8px;
}

.sidebar-section ul li a {
    display: block;
    padding: 6px 12px;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    /* Touch-friendly targets */
    min-height: 44px;
    display: flex;
    align-items: center;
}

.sidebar-section ul li a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-highlight);
}

.sidebar-section ul li a.active {
    background: var(--primary);
    color: white;
}

/* Mobile Sidebar Specific Styles */
.docs-sidebar h4 {
    margin-top: 16px;
}

.docs-sidebar .search-box {
    margin-top: 24px;
}

/* Main Content */
.docs-content {
    max-width: 800px;
    min-width: 0;
}

.docs-content h1 {
    font-size: 3rem;
    margin-bottom: 16px;
}

.lead {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 60px;
}

@media (max-width: 768px) {
    .lead {
        font-size: 1.1rem;
        margin-bottom: 40px;
    }

    .doc-section {
        margin-bottom: 60px;
    }

    .code-block-wrapper pre {
        padding: 16px;
    }
}

.doc-section {
    margin-bottom: 80px;
    scroll-margin-top: 100px;
}

.doc-section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text-highlight);
}

.doc-section h2 i {
    color: var(--primary);
    font-size: 1.5rem;
}

.doc-section h3 {
    font-size: 1.5rem;
    margin-top: 32px;
    margin-bottom: 16px;
}

.doc-section p {
    margin-bottom: 16px;
    line-height: 1.8;
}

.doc-section ul {
    margin: 16px 0;
    padding-left: 24px;
}

.doc-section ul li {
    margin-bottom: 8px;
    color: var(--text-muted);
    line-height: 1.8;
}

.doc-section ul li strong {
    color: var(--text-highlight);
}

/* Steps */
.steps {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 32px;
}

.step {
    display: flex;
    gap: 24px;
    align-items: start;
}

.step-number {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: var(--gradient-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-content h3 {
    font-size: 1.25rem;
    margin: 0 0 12px 0;
}

.step-content .code-block-wrapper {
    margin: 12px 0;
}

.note {
    display: flex;
    align-items: start;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    background: rgba(6, 182, 212, 0.1);
    border-left: 3px solid var(--secondary);
    border-radius: 4px;
    font-size: 0.95rem;
}

.note i {
    color: var(--secondary);
    margin-top: 2px;
}

/* Info Boxes */
.info-box {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 24px 0;
}

.info-box h4 {
    color: var(--primary);
    margin-bottom: 16px;
}

.info-box ul {
    padding-left: 0;
}

.info-box ul li {
    list-style: none;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-box ul li:last-child {
    border-bottom: none;
}

.warning-box {
    display: flex;
    gap: 16px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 24px 0;
}

.warning-box i {
    color: #fbbf24;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.warning-box code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Architecture Diagram */
.architecture-diagram {
    margin: 32px 0;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.arch-layer {
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
}

.arch-layer h4 {
    color: var(--primary);
    margin-bottom: 8px;
}

.arch-layer p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.arch-arrow {
    text-align: center;
    font-size: 2rem;
    color: var(--primary);
    margin: 12px 0;
}

/* Module Grid */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.3s ease;
}

.module-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.module-card h4 {
    color: var(--text-highlight);
    margin-bottom: 12px;
}

.module-card code {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary);
}

/* FAQ */
.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 16px;
}

.faq-item h4 {
    color: var(--text-highlight);
    margin-bottom: 12px;
}

.help-box {
    margin-top: 48px;
    text-align: center;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.help-box h4 {
    margin-bottom: 16px;
}

.help-box .btn {
    margin-top: 20px;
}

/* API Links */
.api-links {
    margin-top: 32px;
}

.api-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.api-link:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

/* Mobile Sidebar Toggle */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* Architecture Diagram Mobile */
@media (max-width: 768px) {
    .architecture-diagram {
        padding: 20px;
    }

    .arch-layer {
        padding: 16px;
    }

    .arch-layer h4 {
        font-size: 1rem;
    }

    .arch-layer p {
        font-size: 0.8rem;
    }

    .arch-arrow {
        font-size: 1.5rem;
        margin: 8px 0;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .docs-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

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

    .docs-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        z-index: 1001;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        border-top: none;
        border-bottom: none;
        border-left: none;
        padding: 24px;
        overflow-y: auto;
        max-height: none;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    }

    .docs-sidebar.active {
        left: 0;
    }

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

@media (max-width: 768px) {
    .docs-page {
        padding: 80px 0 40px;
    }

    .docs-content h1 {
        font-size: clamp(1.875rem, 5vw, 2.2rem);
    }

    .doc-section h2 {
        font-size: clamp(1.375rem, 4vw, 1.5rem);
    }

    .step {
        flex-direction: column;
        gap: 16px;
    }

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

    .module-card {
        padding: 20px;
    }

    .code-block-wrapper code {
        font-size: 0.85rem;
    }

    .breadcrumb {
        font-size: 0.85rem;
        gap: 8px;
        margin-bottom: 24px;
        flex-wrap: wrap;
    }

    .search-box input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}

@media (max-width: 640px) {
    .docs-container {
        gap: 32px;
    }

    .breadcrumb {
        font-size: 0.85rem;
        gap: 8px;
    }

    .docs-sidebar {
        padding: 16px;
    }

    .doc-section {
        margin-bottom: 48px;
    }
}