.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Base Mobile Layout */
.docs-layout {
    display: block;
    padding: 1rem;
    min-height: calc(100vh - 200px);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: block;
    position: fixed;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    z-index: 1000;
    background: var(--brand-primary);
    color: var(--bg);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all var(--transition-speed) ease;
    font-size: 1.2rem;
}

.sidebar-toggle:hover {
    background: var(--brand-accent);
    transform: translateY(-50%) scale(1.05);
}

.sidebar-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

/* Mobile Sidebar */
.docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.docs-sidebar.active {
    transform: translateX(0);
}

.sidebar-content {
    width: 280px;
    height: 100%;
    background-color: var(--surface-bg);
    border-right: var(--border-width) solid var(--border-color);
    overflow-y: auto;
    position: relative;
}

.sidebar-content::after {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
    box-shadow: 4px 0 0 var(--brand-primary);
}

.sidebar-close {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all var(--transition-speed) ease;
}

.sidebar-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.docs-nav {
    padding: 3rem 1.5rem 1.5rem;
}

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

.nav-section:last-child {
    margin-bottom: 0;
}

.nav-section-title {
    font-family: var(--font-sans) !important;
    font-size: 0.9rem;
    color: var(--brand-primary);
    margin-bottom: 0.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: block;
    padding: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    position: relative;
    min-height: 44px; /* Touch target */
    text-decoration: none;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: color-mix(in srgb, var(--brand-primary) 10%, transparent);
}

.nav-link.active {
    color: var(--brand-primary);
    background-color: color-mix(in srgb, var(--brand-primary) 15%, transparent);
    font-weight: 600;
}

/* Main Content */
.docs-main {
    width: 100%;
    padding-left: 0;
}

.docs-content {
    width: 100%;
}

/* Page Header */
.docs-header {
    margin-bottom: 2rem;
}

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

.breadcrumb a {
    color: var(--brand-primary);
    font-weight: 600;
    text-decoration: none;
}

.breadcrumb-separator {
    color: var(--border-color);
}

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

.docs-header h1 {
    margin-bottom: 1rem;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.docs-intro {
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Content Sections */
.docs-section {
    margin-bottom: 3rem;
}

.docs-section:last-child {
    margin-bottom: 0;
}

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

.section-header h2 {
    margin: 0 0 0.5rem 0;
    scroll-margin-top: 120px;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.section-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--brand-primary);
    color: var(--bg);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--border-radius);
    font-family: var(--font-code);
}

.section-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Content Cards */
.content-card {
    background-color: var(--surface-bg);
    padding: 1.5rem;
    border: var(--border-width) solid var(--border-color);
    position: relative;
    border-radius: var(--border-radius);
}

.content-card::after {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
    box-shadow: 4px 4px 0 var(--brand-primary);
}

.content-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
}

.content-card h4 {
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 700;
    margin: 1.5rem 0 0.75rem 0;
}

.content-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

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

/* Method Cards */
.method-card {
    background-color: var(--surface-bg);
    border: var(--border-width) solid var(--border-color);
    margin-bottom: 1.5rem;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.method-card::after {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
    box-shadow: 4px 4px 0 var(--brand-primary);
}

.method-header {
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
    background-color: color-mix(in srgb, var(--brand-primary) 5%, transparent);
}

.method-name {
    font-family: var(--font-code);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--brand-primary);
    word-break: break-all;
}

.method-name .param {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.93rem;
    font-style: oblique;
}

.method-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.method-description {
    padding: 1rem 1.5rem;
}

.method-description p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Responsive Tables */
.method-params {
    padding: 0 1.5rem 1rem;
}

.method-params h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-family: var(--font-sans) !important;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 500px;
}

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

.params-table th {
    background-color: var(--bg);
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-sans) !important;
    position: sticky;
    top: 0;
}

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

.params-table code {
    background-color: var(--bg);
    padding: 0.25rem 0.4rem;
    border-radius: 2px;
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--brand-primary);
    word-break: break-all;
}
.method-example {
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--border-color);
    background-color: color-mix(in srgb, var(--brand-primary) 5%, transparent);
}
.example-card {
    background-color: var(--surface-bg);
    border: var(--border-width) solid var(--border-color);
    margin-bottom: 1.5rem;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: none;
}
.example-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: color-mix(in srgb, var(--brand-primary) 10%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.example-header h4 {
    padding: 1rem 1.5rem;
    font-family: var(--font-sans) !important;
    font-weight: 700;
    margin: 0;
    font-size: 0.9rem;
    color: var(--brand-primary);
}
.example-header .badge-example {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}
.example-demo {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg);
    padding: 1rem 1.5rem;
}
.example-demo label {
    display: block;
    margin: 1rem 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}
.example-demo .pickle-select {
    margin: 1rem 1rem 1rem 0;
}
.example-code {
    padding: 1rem;
}
.example-content {
    padding: 1rem;
}
.example-card pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.example-card code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}


/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    font-family: var(--font-code);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-returns {
    background-color: var(--brand-accent);
    color: var(--bg);
}

.badge-param {
    background-color: var(--brand-primary);
    color: var(--bg);
}

.badge-example {
    background-color: #10b981;
    color: white;
}

/* ==========================================================================
   Tablet Styles (min-width: 768px)
   ========================================================================== */

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
    
    .docs-layout {
        padding: 2rem;
    }
    
    .docs-header {
        margin-bottom: 3rem;
    }
    
    .docs-section {
        margin-bottom: 4rem;
    }
    
    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        flex-wrap: wrap;
        margin-bottom: 2rem;
    }
    
    .content-card {
        padding: 2rem;
    }
    
    .method-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .method-name {
        margin: 0;
    }
    
    .params-table {
        font-size: 0.9rem;
    }
    
    .sidebar-toggle {
        left: 2rem;
    }
}

/* ==========================================================================
   Desktop Styles (min-width: 1024px)
   ========================================================================== */

@media (min-width: 1024px) {
    .docs-layout {
        display: grid;
        grid-template-columns: 300px 1fr;
        gap: 2rem;
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .docs-sidebar {
        position: sticky;
        top: 120px;
        height: fit-content;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--border-color) transparent;
        background: transparent;
        transform: none;
        width: auto;
    }
    
    .docs-sidebar::-webkit-scrollbar {
        width: 4px;
    }
    
    .docs-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .docs-sidebar::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 2px;
    }
    
    .sidebar-content {
        width: 100%;
        height: auto;
        background-color: var(--surface-bg);
        border: var(--border-width) solid var(--border-color);
        border-radius: var(--border-radius);
    }
    
    .sidebar-content::after {
        box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--brand-primary);
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .sidebar-close {
        display: none;
    }
    
    .docs-nav {
        padding: 1.5rem;
    }
    
    .nav-section {
        margin-bottom: 2rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        min-height: auto;
    }
    
    .nav-link.active::before {
        content: '';
        position: absolute;
        left: -1.5rem;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 20px;
        background-color: var(--brand-primary);
        border-radius: 2px;
    }
    
    .docs-main {
        display: flex;
        gap: 2rem;
        max-width: 980px;
        padding-left: 0;
    }
    
    .params-table {
        min-width: auto;
    }
}

/* ==========================================================================
   Large Desktop Styles (min-width: 1200px)
   ========================================================================== */

@media (min-width: 1200px) {
    .docs-layout {
        grid-template-columns: 320px 1fr;
        gap: 3rem;
    }
    
    .docs-main {
        gap: 3rem;
    }
    
    .content-card::after,
    .method-card::after {
        box-shadow: clamp(4px, 1vw, 8px) clamp(4px, 1vw, 8px) 0 var(--brand-primary);
    }
}

/* ==========================================================================
   Utilities and Accessibility
   ========================================================================== */

/* Focus states for accessibility */
.nav-link:focus,
.sidebar-toggle:focus,
.sidebar-close:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .docs-sidebar,
    .sidebar-toggle,
    .nav-link {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .content-card,
    .method-card {
        border-width: 2px;
    }
    
    .content-card::after,
    .method-card::after {
        box-shadow: 6px 6px 0 var(--brand-primary);
    }
}

/* Print styles */
@media print {
    .docs-sidebar,
    .sidebar-toggle {
        display: none;
    }
    
    .docs-layout {
        display: block;
        padding: 0;
    }
    
    .content-card::after,
    .method-card::after {
        display: none;
    }
    
    .content-card,
    .method-card {
        border: 1px solid #000;
        box-shadow: none;
        break-inside: avoid;
    }
}