/* Documentation-specific styles */

.docs-main {
    padding-top: var(--header-height);
    min-height: 100vh;
    background: var(--bg-secondary);
}

.docs-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar Navigation */
.docs-sidebar {
    background: white;
    border-right: 1px solid var(--border-light);
    padding: 2rem 0;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.docs-nav__section {
    margin-bottom: 2rem;
    padding: 0 1.5rem;
}

.docs-nav__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.docs-nav__list {
    list-style: none;
}

.docs-nav__item {
    margin-bottom: 0.25rem;
}

.docs-nav__link {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.docs-nav__link:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.docs-nav__link.active {
    color: var(--primary-color);
    background: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 500;
}

/* Main Content */
.docs-content {
    background: white;
    padding: 3rem;
    max-width: none;
}

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

.docs-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

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

.docs-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Article Header */
.docs-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 2rem;
    margin-bottom: 3rem;
}

.docs-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.docs-lead {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.docs-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.docs-version {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.docs-npm {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.docs-npm:hover {
    color: var(--primary-dark);
}

/* Article Body */
.docs-body {
    line-height: 1.7;
}

.docs-content section {
    padding: 0;
}

.docs-section {
    margin-bottom: 1rem;
}

.docs-section h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    margin-top: 2.5rem;
    letter-spacing: -0.01em;
}

.docs-section h3 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.docs-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.docs-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.docs-section ul,
.docs-section ol {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.docs-section li {
    margin-bottom: 0.5rem;
}

/* Code Blocks - Compatible avec Prism.js */
.code-block {
    background: var(--bg-code);
    border-radius: 0.75rem;
    overflow: hidden;
    margin: 1.5rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.code-block pre {
    padding: 1.5rem;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.code-block code {
    font-family: inherit;
    font-size: inherit;
    white-space: pre-wrap;
    word-break: break-word;
    display: block;
    max-width: 100%;
}

/* Amélioration de la compatibilité Prism.js */
.code-block pre[class*="language-"] {
    background: transparent;
    margin: 0;
    padding: 1.5rem;
}

.code-block code[class*="language-"] {
    background: transparent;
    color: inherit;
}

/* Remove top margin from headings in code blocks */
.code-block h4 {
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    color: #e2e8f0;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

/* Adjust padding for pre elements that follow h4 */
.code-block h4+pre {
    padding-top: 1rem !important;
}

/* Prism.js override pour s'adapter à notre thème */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #546e7a !important;
    font-style: italic;
}

.token.keyword,
.token.function {
    color: #c792ea !important;
    font-weight: 500;
}

.token.string,
.token.attr-value {
    color: #c3e88d !important;
}

.token.number {
    color: #f78c6c !important;
}

.token.operator,
.token.punctuation {
    color: #89ddff !important;
}

.token.property,
.token.tag,
.token.boolean,
.token.constant,
.token.symbol {
    color: #82aaff !important;
}

/* Inline code */
p code,
li code,
td code {
    background: var(--bg-secondary);
    color: var(--primary-color);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.875em;
    font-weight: 500;
}

/* Installation Tabs */
.installation-tabs {
    margin: 1.5rem 0;
}

.tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Alerts */
.alert {
    padding: 1.25rem;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.alert h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.alert p,
.alert ul {
    margin-bottom: 0;
}

.alert ul {
    padding-left: 1.25rem;
}

.alert li {
    margin-bottom: 0.25rem;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    color: #1e40af;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
    color: #92400e;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: #10b981;
    color: #047857;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
    color: #dc2626;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.875rem;
}

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

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

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

/* Next Steps */
.next-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.next-step {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-light);
    transition: var(--transition-normal);
}

.next-step:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.next-step h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.next-step h3 a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.125rem;
}

.next-step h3 a:hover {
    text-decoration: underline;
}

.next-step p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Example Links */
.example-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.example-link {
    display: block;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-light);
    text-decoration: none;
    transition: var(--transition-normal);
}

.example-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.example-link h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.example-link p {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Copy Button for Code Blocks */
.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-fast);
    opacity: 0;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        padding: 1rem 0;
    }

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

    .docs-header h1 {
        font-size: 2rem;
    }

    .docs-lead {
        font-size: 1.125rem;
    }

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

    /* Better code block handling on tablets */
    .code-block pre {
        font-size: 0.8rem;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    .tab-buttons {
        flex-wrap: wrap;
    }

    .next-steps,
    .example-links {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .docs-content {
        padding: 1rem;
    }

    .docs-header h1 {
        font-size: 1.75rem;
    }

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

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

    .code-block {
        margin: 1rem 0;
        border-radius: 0.5rem;
    }

    .code-block pre {
        padding: 1rem;
        font-size: 0.8rem;
        line-height: 1.5;
        overflow-x: auto;
        white-space: pre;
        word-wrap: normal;
    }

    .code-block code {
        white-space: pre;
        word-break: normal;
    }
}

/* Service Discovery Patterns specific styles */
.pattern-comparison {
    margin: 2rem 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    overflow: hidden;
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 1rem 0.75rem;
    text-align: left;
}

.comparison-table td {
    padding: 0.875rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

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

.comparison-table tr:nth-child(even) {
    background: var(--bg-secondary);
}

.next-step-card {
    display: block;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-light);
    text-decoration: none;
    transition: var(--transition-normal);
    color: inherit;
}

.next-step-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    background: white;
}

.next-step-card h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
}

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

.docs-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0;
}
