/* =============================================================================
   ATOOX Documentation Styles
   ============================================================================= */

/* Layout */
.docs-body {
    background: var(--color-bg);
}

.docs-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 60px);
    padding-top: 60px;
}

@media (max-width: 968px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }
}

/* Sidebar */
.docs-sidebar {
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

@media (max-width: 968px) {
    .docs-sidebar {
        display: none;
    }
}

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

.sidebar-header a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-text);
}

.sidebar-header .logo-icon {
    color: var(--color-primary);
}

.sidebar-nav {
    flex: 1;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

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

.nav-section li {
    margin: 0.125rem 0;
}

.nav-section a {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-section a:hover {
    color: var(--color-text);
    background: var(--color-bg-tertiary);
}

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

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

@media (max-width: 768px) {
    .docs-main {
        padding: 1.5rem;
    }
}

/* Content Styling */
.docs-content {
    line-height: 1.8;
}

.docs-content h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.docs-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border-light);
}

.docs-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.docs-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

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

.docs-content a {
    color: var(--color-primary-light);
}

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

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

.docs-content ul {
    list-style: disc;
}

.docs-content ol {
    list-style: decimal;
}

.docs-content li {
    margin: 0.5rem 0;
    color: var(--color-text-secondary);
}

.docs-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.2rem 0.4rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-primary-light);
}

.docs-content pre {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.docs-content pre code {
    padding: 0;
    background: none;
    border: none;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

.docs-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: rgba(99, 102, 241, 0.05);
    border-left: 4px solid var(--color-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.docs-content blockquote p {
    margin: 0;
    color: var(--color-text);
}

.docs-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

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

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

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

.docs-content img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

/* Callouts */
.docs-content .callout {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid;
}

.docs-content .callout-info {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
}

.docs-content .callout-warning {
    background: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.2);
}

.docs-content .callout-success {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

/* Pagination */
.docs-pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.pagination-link {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    max-width: 45%;
}

.pagination-link:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.pagination-link.next {
    text-align: right;
    margin-left: auto;
}

.pagination-label {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.pagination-title {
    font-weight: 600;
    color: var(--color-text);
}

/* Footer */
.docs-footer {
    padding: 1.5rem;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.docs-footer p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0.25rem 0;
}

.docs-footer a {
    color: var(--color-text-secondary);
}

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

/* Not Found */
.not-found {
    text-align: center;
    padding: 4rem 2rem;
}

.not-found h1 {
    border: none !important;
}

.not-found p {
    margin-bottom: 1.5rem;
}

/* PRO Badge */
.badge-pro {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Mobile sidebar toggle */
.docs-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--color-primary, #b04a22);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 968px) {
    .docs-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .docs-sidebar {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 999;
        overflow-y: auto;
        background: var(--color-bg, #faf8f5);
        padding: 2rem;
    }

    .docs-sidebar.docs-sidebar-open {
        display: block;
    }

    .docs-content {
        padding: 1rem;
    }

    .docs-content pre {
        overflow-x: auto;
    }

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

/* ═══════════════════════════════════════════════════ */
/* RESPONSIVE MOBILE COMPLET                          */
/* ═══════════════════════════════════════════════════ */

/* Force le body à ne pas déborder horizontalement */
.docs-body {
    overflow-x: hidden;
}

/* Le conteneur docs ne doit jamais déborder */
.docs-main {
    min-width: 0; /* Fix grid overflow */
    overflow-x: hidden;
}

.docs-content {
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Tables : scroll horizontal */
.docs-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

.docs-content table th,
.docs-content table td {
    white-space: normal;
    min-width: 100px;
}

/* Code blocks : scroll horizontal */
.docs-content pre {
    max-width: 100%;
    overflow-x: auto;
}

.docs-content code {
    word-break: break-all;
}

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

/* Images ne débordent jamais */
.docs-content img {
    max-width: 100%;
    height: auto;
}

/* ASCII art et diagrammes dans blockquote */
.docs-content blockquote pre {
    font-size: 0.75rem;
}

@media (max-width: 968px) {
    /* Nav docs sur mobile */
    .docs-body .nav .nav-links {
        display: none;
    }

    /* Contenu pleine largeur */
    .docs-main {
        padding: 1rem;
    }

    /* Titres plus petits */
    .docs-content h1 {
        font-size: 1.5rem;
    }

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

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

    /* Pagination en colonne */
    .docs-pagination {
        flex-direction: column;
        gap: 0.5rem;
    }

    .docs-pagination a {
        width: 100%;
        text-align: center;
    }
}

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

    .docs-content h1 {
        font-size: 1.3rem;
    }

    .docs-content pre {
        font-size: 0.75rem;
        padding: 0.75rem;
    }

    .docs-content th,
    .docs-content td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}
