/*
   Documentation Layout Styles - GDX Cloud
   ============================================== */

/* Docs Container */
.docs-container {
    display: flex;
    position: relative;
    min-height: calc(100vh - 80px);
    margin: 0;
    max-width: 100%;
}

/* Docs Sidebar - Clean Left Navigation */
.docs-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
    transition: all 0.3s ease;
    z-index: 100;
}

/* Hide scrollbar but keep functionality */
.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;
}

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

.docs-sidebar-header {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.docs-sidebar-header h3 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-tertiary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Prevent link styling on sidebar header */
.docs-sidebar-header a {
    color: var(--text-tertiary) !important;
    text-decoration: none !important;
    border-bottom: none !important;
    pointer-events: none;
}

.docs-sidebar-header h3 a {
    color: inherit !important;
}

.docs-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
}

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

/* Sidebar Navigation - Clean Modern Style */
.docs-sidebar-nav {
    padding: 0 1.25rem;
}

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

.docs-nav-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}

.docs-nav-title {
    flex: 1;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.docs-nav-toggle {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

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

.docs-nav-toggle i {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.docs-nav-section:not(.expanded) .docs-nav-toggle i {
    transform: rotate(-90deg);
}

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

span.docs-nav-title {
    cursor: default;
    pointer-events: none;
}

span.docs-nav-title:hover {
    color: var(--text-tertiary);
}

.docs-nav-title.current {
    color: var(--primary-color);
}

.docs-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.docs-nav-list.collapsed {
    display: none;
}

.docs-nav-item {
    margin-bottom: 0;
}

.docs-nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.15s ease;
    position: relative;
}

.docs-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary-color);
    border-radius: 0 2px 2px 0;
    transition: height 0.15s ease;
}

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

.docs-nav-link:hover::before {
    height: 20px;
}

.docs-nav-link.current {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.1), transparent);
    color: var(--primary-color);
    font-weight: 600;
}

.docs-nav-link.current::before {
    height: 100%;
}

.docs-nav-sublist {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0.5rem 0;
    padding-left: 1.25rem;
    border-left: 1px solid var(--border-color);
}

.docs-nav-subitem {
    margin-bottom: 0;
}

.docs-nav-sublink {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-tertiary);
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

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

.docs-nav-sublink.current {
    background: var(--bg-secondary);
    color: var(--primary-color);
    font-weight: 600;
}

.docs-sidebar-toggle {
    display: none;
}

/* Main Content Area - Clean & Spacious */
.docs-main {
    flex: 1;
    min-width: 0;
    padding: 3rem 4rem;
    max-width: 1000px;
    margin: 0 auto;
}

/* Breadcrumb */
.docs-breadcrumb {
    margin-bottom: 2rem;
}

.docs-breadcrumb .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

.docs-breadcrumb .breadcrumb-item {
    color: var(--text-secondary);
}

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

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

.docs-breadcrumb .breadcrumb-item span {
    color: var(--text-secondary);
    cursor: default;
}

.docs-breadcrumb .breadcrumb-item span:hover {
    color: var(--text-secondary);
}

.docs-breadcrumb .breadcrumb-item.active {
    color: var(--text-primary);
}

.docs-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* Documentation Page - Clean Typography */
.docs-page {
    margin-bottom: 4rem;
}

.docs-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.docs-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.docs-body {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-body);
}

.docs-body h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    scroll-margin-top: 100px;
}

.docs-body h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    scroll-margin-top: 100px;
}

.docs-body h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    scroll-margin-top: 100px;
}

.docs-body p {
    margin-bottom: 1.25rem;
    color: var(--text-body);
}

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

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

.docs-body a {
    color: #3b82f6;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

.docs-body a:hover {
    color: #2563eb;
    border-bottom-color: #3b82f6;
}

.docs-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-body);
    font-style: italic;
}

/* Table Styles */
.docs-body table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

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

.docs-body th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

/* Horizontally Scrollable Table Wrapper - Only for Small/Medium Devices */
@media (max-width: 991px) {
    .table-scroll-wrapper {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 1.5rem 0;
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }
    
    .table-scroll-wrapper table {
        margin: 0;
    }
    
    .docs-body th,
    .docs-body td {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }
}

@media (max-width: 767px) {
    .docs-body th,
    .docs-body td {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* Documentation Cards */
.docs-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.docs-card {
    display: block;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.docs-card:hover {
    background: var(--bg-card);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.1);
}

.docs-card h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.docs-card p {
    color: var(--text-body);
    margin-bottom: 0;
    font-size: 0.9375rem;
}

.docs-card-arrow {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--primary-color);
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.docs-card:hover .docs-card-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* Next Section - Hextra Style */
.docs-next-section {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.docs-next-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.docs-next-subtitle {
    color: var(--text-body);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.docs-next-card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
    max-width: 600px;
}

.docs-next-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.15);
}

.docs-card-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 0.5rem;
    color: white;
    font-size: 1.5rem;
}

.docs-card-content {
    flex: 1;
}

.docs-card-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.docs-card-content p {
    color: var(--text-body);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.6;
}

/* Table of Contents */
.docs-toc {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 78px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 0.5rem 0 2rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    align-self: flex-start;
}

.docs-toc::-webkit-scrollbar {
    width: 6px;
}

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

.docs-toc::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.docs-toc-header h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
    border-bottom: none;
}

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

.docs-toc-nav li {
    margin-bottom: 0;
}

.docs-toc-nav a {
    display: block;
    padding: 0.25rem 0;
    color: var(--text-body);
    text-decoration: none;
    font-size: 0.8125rem;
    border-left: none;
    padding-left: 0;
    transition: color 0.2s ease;
    line-height: 1.4;
}

.docs-toc-nav a:hover {
    color: var(--primary-color);
    padding-left: 0;
}

.docs-toc-nav a.active {
    color: var(--primary-color);
    font-weight: 500;
    padding-left: 0;
}

/* Nested TOC items */
.docs-toc-nav ul ul {
    margin-left: 1rem;
    margin-top: 0.5rem;
}

/* Page Navigation */
.docs-page-nav {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.docs-page-nav-inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.docs-page-nav-link {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    max-width: calc(50% - 0.5rem);
    position: relative;
    overflow: hidden;
}

.docs-page-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.docs-page-nav-link:hover::before {
    transform: scaleX(1);
}

.docs-page-nav-link:hover {
    background: var(--bg-card);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.12);
}

.docs-page-nav-prev {
    align-items: flex-start;
}

.docs-page-nav-next {
    align-items: flex-end;
}

.docs-page-nav-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.docs-page-nav-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.docs-page-nav-link:hover .docs-page-nav-title {
    color: var(--primary-color);
}

/* Edit Link */
.docs-edit-link {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.docs-edit-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-body);
    text-decoration: none;
    font-size: 0.9375rem;
}

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

/* ============================================
   Responsive Design
   Mobile: < 576px
   Small: 576px - 768px
   Medium: 768px - 992px
   Large: 992px - 1200px
   Desktop: > 1200px
   ============================================ */

/* Large screens and below (hide TOC) */
@media (max-width: 1400px) {
    .docs-toc {
        display: none;
    }
    
    .docs-main {
        max-width: 100%;
    }
}

/* Desktop to Large tablets (< 1200px) */
@media (max-width: 1199px) {
    .docs-container {
        max-width: 100%;
    }
    
    .docs-main {
        padding: 2rem 1.5rem;
    }
}

/* Medium screens - Tablets (< 992px) */
@media (max-width: 991px) {
    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
    
    .docs-sidebar.open {
        transform: translateX(0);
    }
    
    .docs-sidebar-close {
        display: block;
    }
    
    .docs-sidebar-toggle {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: fixed;
        bottom: 2rem;
        left: 1rem;
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 0.75rem 1.25rem;
        border-radius: 2rem;
        font-size: 0.9375rem;
        font-weight: 500;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
        z-index: 99;
        transition: all 0.3s ease;
    }
    
    .docs-sidebar-toggle:hover {
        background: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(168, 85, 247, 0.4);
    }
    
    .docs-container {
        flex-direction: column;
    }
    
    .docs-main {
        padding: 1.5rem 1rem;
    }
    
    .docs-title {
        font-size: 2rem;
    }
}

/* Small screens - Mobile landscape (< 768px) */
@media (max-width: 767px) {
    .docs-page-nav-inner {
        flex-direction: column;
    }
    
    .docs-page-nav-link {
        max-width: 100%;
    }
    
    .docs-cards {
        grid-template-columns: 1fr;
    }
    
    .docs-title {
        font-size: 1.75rem;
    }
    
    .docs-description {
        font-size: 1.125rem;
    }
    
    .docs-main {
        padding: 1.25rem 1rem;
    }
    
    .docs-sidebar-toggle {
        bottom: 1.5rem;
        left: 0.75rem;
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

/* Mobile portrait (< 576px) */
@media (max-width: 575px) {
    .docs-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .docs-description {
        font-size: 1rem;
    }
    
    .docs-main {
        padding: 1rem 0.75rem;
    }
    
    .docs-content {
        font-size: 0.9375rem;
    }
    
    .docs-page-nav {
        margin-top: 2rem;
        padding: 1rem;
    }
    
    .docs-page-nav-link {
        padding: 0.875rem;
    }
    
    .docs-breadcrumb {
        font-size: 0.8125rem;
    }
}

/* Scrollbar Styling */
.docs-sidebar::-webkit-scrollbar,
.docs-toc::-webkit-scrollbar {
    width: 6px;
}

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

.docs-sidebar::-webkit-scrollbar-thumb,
.docs-toc::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.docs-sidebar::-webkit-scrollbar-thumb:hover,
.docs-toc::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
