/* ===================================
   Documentation Styles
   Extends TheSecureNote Design System
   =================================== */

/* Documentation Layout */
.docs-layout {
    display: flex;
    gap: var(--space-12);
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-10) var(--space-6) var(--space-16);
    min-height: calc(100vh - 56px);
}

/* Sidebar with TOC */
.docs-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: var(--space-10);
    height: fit-content;
    min-height: calc(100vh - 80px);
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-full);
}

.docs-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-medium);
}

/* Main Content Area */
.docs-main {
    flex: 1;
    min-width: 0;
    max-width: 800px;
}

/* Documentation Header */
.docs-header {
    margin-bottom: var(--space-12);
    padding-bottom: var(--space-6);
    border-bottom: 2px solid var(--border-light);
}

.docs-header h1 {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: var(--space-3);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.docs-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Table of Contents - Enhanced Design */
.toc {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}

.toc:hover {
    box-shadow: var(--shadow-md);
}

.toc h2 {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-light);
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-list li {
    margin: 0;
}

.toc-list a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    position: relative;
    border-left: 2px solid transparent;
}

.toc-text {
    flex: 1;
}

.toc-eye-icon {
    opacity: 0;
    transition: opacity 0.2s ease;
    color: var(--brand-primary);
    margin-left: auto;
}

.toc-list a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-left-color: var(--brand-primary);
    transform: translateX(2px);
}

.toc-list a:hover .toc-eye-icon {
    opacity: 1;
}

.toc-list a.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%);
    color: var(--brand-primary);
    font-weight: 600;
    border-left-color: var(--brand-primary);
}

.toc-list a.active .toc-icon {
    transform: scale(1.05);
}

.toc-list a.active .toc-eye-icon {
    opacity: 1;
}

.toc-icon {
    flex-shrink: 0;
    font-size: 1rem;
    transition: transform 0.2s ease;
    line-height: 1;
}

/* Documentation Section */
.docs-section {
    margin-bottom: var(--space-12);
    scroll-margin-top: 100px;
}

.docs-section h2 {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--border-light);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.docs-section h3 {
    font-size: 1.375rem;
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.docs-section h4 {
    font-size: 1.0625rem;
    margin-top: var(--space-5);
    margin-bottom: var(--space-2);
    color: var(--text-primary);
    font-weight: 600;
}

.docs-section p {
    margin-bottom: var(--space-3);
    line-height: 1.65;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.docs-section ul,
.docs-section ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
    color: var(--text-secondary);
}

.docs-section li {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

.docs-section li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Alert Boxes */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.alert-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-content p {
    margin-bottom: 0;
}

.alert.info {
    background: var(--brand-primary-light);
    border: 1px solid var(--brand-primary);
}

.alert.info .alert-icon {
    color: var(--brand-primary);
}

.alert.warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
}

.alert.warning .alert-icon {
    color: var(--warning);
}

.alert.danger {
    background: var(--danger-light);
    border: 1px solid var(--danger);
}

.alert.danger .alert-icon {
    color: var(--danger);
}

.alert.success {
    background: var(--success-bg);
    border: 1px solid var(--success);
}

.alert.success .alert-icon {
    color: var(--success);
}

/* Code Blocks */
.code-block {
    background: #1e293b;
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
    overflow-x: auto;
}

.code-block code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e2e8f0;
    display: block;
    white-space: pre-line;
}

.code-block-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Inline code */
code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
    color: var(--brand-primary);
}

.code-block code {
    background: transparent;
    padding: 0;
}

/* Step Cards */
.step-cards {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.step-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.step-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--brand-primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.step-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.step-card:hover::before {
    transform: scaleY(1);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover));
    color: white;
    font-weight: 700;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    font-size: 0.9375rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.step-card h4 {
    margin-top: 0;
    margin-bottom: var(--space-2);
    font-size: 1.0625rem;
    font-weight: 600;
}

.step-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9375rem;
    margin-bottom: 0;
}

/* FAQ Section */
.faq-list {
    list-style: none;
    padding: 0;
}

.faq-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    overflow: hidden;
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: var(--brand-primary);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    background: var(--bg-primary);
    transition: background 0.15s ease;
    user-select: none;
}

.faq-question:hover {
    background: var(--bg-secondary);
}

.faq-question h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.faq-toggle {
    flex-shrink: 0;
    color: var(--brand-primary);
    transition: transform 0.3s ease;
}

.faq-item.active .faq-toggle {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer-content {
    padding: 0 var(--space-5) var(--space-4);
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-answer-content p:last-child {
    margin-bottom: 0;
}

/* Collapsible Sections (for DNS providers) */
.collapsible-section {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    overflow: hidden;
    transition: all 0.2s ease;
}

.collapsible-section:hover {
    border-color: var(--brand-primary);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    background: var(--bg-secondary);
    transition: background 0.15s ease;
    user-select: none;
}

.collapsible-header:hover {
    background: var(--bg-tertiary);
}

.collapsible-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.collapsible-toggle {
    flex-shrink: 0;
    color: var(--brand-primary);
    transition: transform 0.3s ease;
}

.collapsible-section.active .collapsible-toggle {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-section.active .collapsible-content {
    max-height: 800px;
}

.collapsible-content-inner {
    padding: var(--space-4);
    color: var(--text-secondary);
    line-height: 1.7;
    background: var(--bg-primary);
}

.collapsible-content-inner ol {
    margin: 0;
    padding-left: var(--space-6);
}

.collapsible-content-inner li {
    margin-bottom: var(--space-2);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.feature-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all 0.3s ease;
}

.feature-item:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.feature-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.1));
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.feature-item-icon svg {
    color: var(--brand-primary);
}

.feature-item h4 {
    margin-top: 0;
    margin-bottom: var(--space-2);
    font-size: 1rem;
    font-weight: 600;
}

.feature-item p {
    margin-bottom: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Pricing Comparison */
.pricing-comparison {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
}

.pricing-comparison h3 {
    margin-top: 0;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-4);
}

.pricing-table th,
.pricing-table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.pricing-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.pricing-table td {
    color: var(--text-secondary);
}

.pricing-table tr:last-child td {
    border-bottom: none;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
    z-index: 100;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.back-to-top.visible {
    display: flex;
}

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

    .docs-sidebar {
        position: relative;
        top: 0;
        width: 100%;
        max-height: none;
        margin-bottom: var(--space-6);
    }

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

@media (max-width: 768px) {
    .docs-header h1 {
        font-size: 2rem;
    }

    .docs-section h2 {
        font-size: 1.5rem;
    }

    .docs-section h3 {
        font-size: 1.25rem;
    }

    .toc-list {
        grid-template-columns: 1fr;
    }

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

    .pricing-table {
        font-size: 0.875rem;
    }

    .pricing-table th,
    .pricing-table td {
        padding: var(--space-2);
    }
}