/* User Guide Styles */

/* Layout */
.guide-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.guide-main {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--background);
}

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

.guide-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.guide-back-link:hover {
    color: var(--primary);
}

.guide-sidebar-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* Navigation */
.guide-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.guide-nav-section {
    margin-bottom: 0.5rem;
}

.guide-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

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

.guide-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.guide-nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.guide-nav-item.active svg {
    opacity: 1;
}

/* Section headers */
.guide-nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.guide-nav-section-header:hover {
    background: var(--hover-bg);
}

.guide-nav-section-header svg {
    transition: transform 0.2s;
}

.guide-nav-section.collapsed .guide-nav-section-header svg {
    transform: rotate(-90deg);
}

.guide-nav-subsections {
    display: block;
}

.guide-nav-section.collapsed .guide-nav-subsections {
    display: none;
}

.guide-nav-subsection {
    padding-left: 1rem;
}

.guide-nav-subsection .guide-nav-item {
    font-size: 0.875rem;
    padding: 0.625rem 1.5rem 0.625rem 2.5rem;
}

/* Content Area */
.guide-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.guide-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.guide-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Markdown Content Styles */
.guide-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
}

.guide-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
}

.guide-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem 0;
}

.guide-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.25rem 0 0.5rem 0;
}

.guide-content p {
    margin: 0 0 1rem 0;
    line-height: 1.7;
    color: var(--text-secondary);
}

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

.guide-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.guide-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.guide-content code {
    background: var(--hover-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary);
}

.guide-content pre {
    background: var(--hover-bg);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0 0 1rem 0;
}

.guide-content pre code {
    background: none;
    padding: 0;
}

.guide-content a {
    color: var(--primary);
    text-decoration: none;
}

.guide-content a:hover {
    text-decoration: underline;
}

.guide-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.guide-content blockquote {
    border-left: 4px solid var(--primary);
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    border-radius: 0 8px 8px 0;
}

.guide-content blockquote p {
    margin: 0;
}

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

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

.guide-content th {
    background: var(--hover-bg);
    font-weight: 600;
    color: var(--text-primary);
}

.guide-content td {
    color: var(--text-secondary);
}

.guide-content tr:nth-child(even) td {
    background: var(--surface);
}

/* Mobile Header */
.guide-mobile-header {
    display: none;
    position: sticky;
    top: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    z-index: 50;
}

.guide-mobile-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.guide-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.guide-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .guide-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .guide-sidebar.open {
        transform: translateX(0);
    }

    .guide-sidebar-overlay.open {
        display: block;
    }

    .guide-main {
        margin-left: 0;
    }

    .guide-mobile-header {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .guide-menu-toggle {
        display: block;
    }

    .guide-content {
        padding: 1.5rem;
    }

    .guide-content h1 {
        font-size: 1.5rem;
    }

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

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

    .guide-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Search Styles */
.guide-search-container {
    margin-top: 1rem;
    position: relative;
}

.guide-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.guide-search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.guide-search-input {
    width: 100%;
    padding: 0.625rem 2.25rem 0.625rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--background);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

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

.guide-search-clear {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.guide-search-clear:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.guide-search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .guide-search-results {
        background: #1f2937;
    }
}

.guide-search-results-header {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: #f3f4f6;
}

@media (prefers-color-scheme: dark) {
    .guide-search-results-header {
        background: #374151;
        color: #9ca3af;
    }
}

.guide-search-result {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    background: #ffffff;
}

@media (prefers-color-scheme: dark) {
    .guide-search-result {
        border-bottom-color: #374151;
        background: #1f2937;
    }
}

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

.guide-search-result:hover,
.guide-search-result.selected {
    background: #f3f4f6;
}

@media (prefers-color-scheme: dark) {
    .guide-search-result:hover,
    .guide-search-result.selected {
        background: #374151;
    }
}

.guide-search-result-title {
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.guide-search-result-section {
    font-size: 0.75rem;
    color: #2563eb;
    margin-bottom: 0.25rem;
}

.guide-search-result-preview {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (prefers-color-scheme: dark) {
    .guide-search-result-title {
        color: #f9fafb;
    }
    .guide-search-result-section {
        color: #60a5fa;
    }
    .guide-search-result-preview {
        color: #9ca3af;
    }
}

.guide-search-result-preview mark {
    background: var(--warning-light, #fef3c7);
    color: var(--text-primary);
    padding: 0 0.125rem;
    border-radius: 2px;
}

.guide-search-no-results {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #6b7280;
    background: #ffffff;
}

@media (prefers-color-scheme: dark) {
    .guide-search-no-results {
        color: #9ca3af;
        background: #1f2937;
    }
}

.guide-search-no-results svg {
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Keyboard navigation hint */
.guide-search-hint {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 1rem;
    justify-content: center;
    background: #f9fafb;
}

.guide-search-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    font-size: 0.6875rem;
    font-family: inherit;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    margin-right: 0.25rem;
    color: #374151;
}

@media (prefers-color-scheme: dark) {
    .guide-search-hint {
        color: #9ca3af;
        border-top-color: #374151;
        background: #111827;
    }
    .guide-search-hint kbd {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
}

/* Print styles */
@media print {
    .guide-sidebar,
    .guide-mobile-header,
    .guide-sidebar-overlay {
        display: none !important;
    }

    .guide-main {
        margin-left: 0;
    }

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