/* ============================================
   RED SCIENTIFIC DOCUMENTATION STYLES
   ============================================ */

/* Documentation Layout */
.docs-page {
    --docs-sidebar-width: 280px;
}

.docs-container {
    display: grid;
    grid-template-columns: var(--docs-sidebar-width) 1fr;
    min-height: calc(100vh - 80px);
    margin-top: 80px;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.docs-sidebar {
    background: var(--light-surface);
    border-right: 1px solid rgba(0,0,0,0.08);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

.docs-sidebar-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.docs-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--gray-dark);
    font-weight: 600;
    font-size: 1.1rem;
}

.docs-logo img {
    width: 32px;
    height: 32px;
}

.docs-logo:hover {
    color: var(--red);
}

/* Navigation Sections */
.docs-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.docs-nav-section {
    margin-top: 1.5rem;
}

.docs-nav-section:first-child {
    margin-top: 0;
}

.docs-nav-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-medium);
    margin-bottom: 0.75rem;
    display: block;
}

.docs-nav-item {
    display: block;
    padding: 0.5rem 1rem 0.5rem 0;
    color: var(--gray-medium);
    font-size: 0.95rem;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: all var(--transition-fast);
}

.docs-nav-item:hover {
    color: var(--gray-dark);
    background: rgba(0,0,0,0.03);
}

.docs-nav-item.active {
    color: var(--red);
    border-left-color: var(--red);
    background: rgba(196, 30, 58, 0.05);
    font-weight: 500;
}

.docs-nav-section .docs-nav-item {
    padding-left: 1rem;
}

.docs-sidebar-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.docs-sidebar-footer .btn {
    width: 100%;
    text-align: center;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.docs-content {
    padding: 3rem 4rem;
    max-width: 900px;
}

/* Breadcrumbs */
.docs-breadcrumb {
    font-size: 0.85rem;
    color: var(--gray-medium);
    margin-bottom: 2rem;
}

.docs-breadcrumb a {
    color: var(--gray-medium);
    transition: color var(--transition-fast);
}

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

.docs-breadcrumb span {
    margin: 0 0.5rem;
    color: rgba(0,0,0,0.3);
}

/* ============================================
   ARTICLE CONTENT
   ============================================ */
.docs-article {
    line-height: 1.7;
}

.docs-article h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--gray-dark);
    letter-spacing: -0.02em;
}

.docs-article .lead {
    font-size: 1.25rem;
    color: var(--gray-medium);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.docs-article h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.08);
    color: var(--gray-dark);
}

.docs-article h2:first-of-type {
    margin-top: 2rem;
    padding-top: 0;
    border-top: none;
}

.docs-article h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--gray-dark);
}

.docs-article h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-dark);
}

.docs-article p {
    margin-bottom: 1rem;
}

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

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

.docs-article strong {
    font-weight: 600;
    color: var(--gray-dark);
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */
.docs-toc {
    background: var(--light-surface);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.docs-toc h2 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
    padding: 0;
    border: none;
    color: var(--gray-medium);
}

.docs-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-toc li {
    margin: 0;
    padding: 0.35rem 0;
}

.docs-toc a {
    color: var(--gray-medium);
    font-size: 0.95rem;
}

.docs-toc a:hover {
    color: var(--red);
}

/* ============================================
   CODE BLOCKS
   ============================================ */
.docs-code {
    background: var(--dark-bg);
    color: #e0e0e0;
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 1rem 0;
}

.docs-code code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* Inline code */
.docs-article code {
    background: rgba(0,0,0,0.05);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.875em;
    color: var(--red-dark);
}

/* ============================================
   TABLES
   ============================================ */
.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.docs-table th,
.docs-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.docs-table th {
    background: var(--light-surface);
    font-weight: 600;
    color: var(--gray-dark);
    white-space: nowrap;
}

.docs-table tr:hover td {
    background: rgba(0,0,0,0.02);
}

.docs-table code {
    font-size: 0.85em;
}

/* ============================================
   CALLOUTS
   ============================================ */
.docs-callout {
    background: var(--light-surface);
    border-left: 4px solid var(--red);
    padding: 1.25rem 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}

.docs-callout h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--gray-dark);
}

.docs-callout p {
    margin: 0;
    color: var(--gray-medium);
}

.docs-callout p + p {
    margin-top: 0.5rem;
}

.docs-callout-hardware {
    border-left-color: #3498db;
}

.docs-callout-warning {
    border-left-color: #f39c12;
    background: rgba(243, 156, 18, 0.08);
}

.docs-callout-info {
    border-left-color: #3498db;
    background: rgba(52, 152, 219, 0.08);
}

.docs-callout-links {
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
}

.docs-callout-links a {
    font-weight: 500;
}

/* ============================================
   STEPS / NUMBERED LISTS
   ============================================ */
.docs-steps {
    counter-reset: step-counter;
    list-style: none;
    padding-left: 0;
}

.docs-steps li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1rem;
}

.docs-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* ============================================
   TROUBLESHOOTING EXPANDABLE
   ============================================ */
.docs-troubleshoot {
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    margin: 1rem 0;
    background: white;
}

.docs-troubleshoot summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-dark);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.docs-troubleshoot summary::-webkit-details-marker {
    display: none;
}

.docs-troubleshoot summary::before {
    content: '+';
    width: 1.5rem;
    height: 1.5rem;
    background: var(--light-surface);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    color: var(--gray-medium);
    flex-shrink: 0;
}

.docs-troubleshoot[open] summary::before {
    content: '-';
}

.docs-troubleshoot[open] summary {
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.docs-troubleshoot-content {
    padding: 1rem 1.5rem;
}

.docs-troubleshoot ol {
    margin: 0;
    padding-left: 1.25rem;
}

/* ============================================
   PAGINATION (PREV/NEXT)
   ============================================ */
.docs-pagination {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.docs-pagination-prev,
.docs-pagination-next {
    display: block;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.docs-pagination-prev:hover,
.docs-pagination-next:hover {
    border-color: var(--red);
    background: var(--light-surface);
}

.docs-pagination-next {
    text-align: right;
}

.docs-pagination-label {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-medium);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.docs-pagination-title {
    display: block;
    font-weight: 500;
    color: var(--gray-dark);
}

/* Empty pagination slot */
.docs-pagination-prev:empty,
.docs-pagination-next:empty {
    visibility: hidden;
}

/* ============================================
   RELATED MODULES
   ============================================ */
.docs-related {
    background: var(--light-surface);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 3rem;
}

.docs-related h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
}

.docs-related ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-related li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.docs-related li:last-child {
    border-bottom: none;
}

/* ============================================
   SCREENSHOTS
   ============================================ */
.docs-screenshot {
    display: block;
    max-width: 100%;
    margin: 1.5rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
}

.docs-image-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.docs-image-row figure {
    margin: 0;
    text-align: center;
}

.docs-image-row .docs-screenshot {
    margin: 0 0 0.5rem 0;
}

.docs-image-row figcaption {
    font-size: 0.9rem;
    color: var(--gray-medium);
    font-style: italic;
}

@media (max-width: 600px) {
    .docs-image-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FEATURE GRID (for overview page)
   ============================================ */
.docs-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.docs-feature-card {
    background: var(--light-surface);
    padding: 1.5rem;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.docs-feature-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.docs-feature-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.docs-feature-card p {
    margin: 0;
    color: var(--gray-medium);
    font-size: 0.95rem;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .docs-container {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1001;
        height: 100vh;
        padding-top: 5rem;
    }

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

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

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

    .docs-pagination {
        grid-template-columns: 1fr;
    }
}

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

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

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

    .docs-table th,
    .docs-table td {
        padding: 0.5rem 0.75rem;
    }
}

/* ============================================
   MOBILE DOCS NAVIGATION
   ============================================ */
.docs-mobile-nav {
    display: none;
    position: sticky;
    top: 80px;
    background: white;
    padding: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    z-index: 100;
}

@media (max-width: 1024px) {
    .docs-mobile-nav {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
}

.docs-menu-toggle {
    width: 40px;
    height: 40px;
    background: var(--light-surface);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.docs-page-select {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .docs-sidebar,
    .docs-mobile-nav,
    .docs-pagination {
        display: none !important;
    }

    .docs-container {
        grid-template-columns: 1fr;
    }

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