/* ====================================
   Saros SDK Documentation - Viewer Styles
   ==================================== */

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 30, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-brand:hover {
    color: var(--primary);
}

.navbar-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

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

.nav-link.active {
    color: var(--primary);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 80px;
    bottom: 0;
    width: 280px;
    background: rgba(15, 15, 30, 0.9);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 2rem 1rem;
    z-index: 99;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    padding-left: 1rem;
}

.sidebar-link {
    display: block;
    padding: 0.7rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 0.3rem;
}

.sidebar-link:hover {
    background: rgba(124, 58, 237, 0.1);
    color: var(--text-primary);
    transform: translateX(5px);
}

.sidebar-link.active {
    background: rgba(124, 58, 237, 0.2);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* Main Content */
.main-content {
    margin-left: 300px;
    margin-top: 80px;
    margin-right: 300px; /* Add right margin for TOC */
    min-height: calc(100vh - 80px);
    padding: 3rem 1.5rem; /* Further optimize padding for better fit */
}

.content-wrapper {
    width: 100%;
    margin: 0;
}

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

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

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

/* Article Styles */
.article {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem 2rem; /* Reduced horizontal padding to account for tighter layout */
    backdrop-filter: blur(10px);
    width: 100%; /* Use full available width */
    max-width: none; /* Remove max-width constraint */
    margin: 0; /* Remove auto margin */
}

.article h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.article-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Markdown Content Styles */
.article h2 {
    font-size: 2rem;
    margin: 3rem 0 1.5rem;
    color: var(--text-primary);
    position: relative;
    padding-left: 1rem;
}

.article h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--primary);
    border-radius: 2px;
}

.article h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--text-primary);
}

.article h4 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.8rem;
    color: var(--text-primary);
}

.article p {
    margin: 1rem 0;
    color: var(--text-secondary);
    line-height: 1.8;
}

.article ul, .article ol {
    margin: 1rem 0;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.article li {
    margin: 0.5rem 0;
    line-height: 1.8;
}

.article pre {
    background: #1a1a2e;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem;
    margin: 2rem 0;
    overflow-x: auto;
}

.article code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9rem;
}

.article :not(pre) > code {
    background: rgba(124, 58, 237, 0.1);
    color: #a78bfa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.article blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(124, 58, 237, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 8px;
}

.article table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.article th {
    background: rgba(124, 58, 237, 0.1);
    padding: 1rem;
    text-align: left;
    color: var(--text-primary);
    font-weight: 600;
}

.article td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.article tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.article a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.article a:hover {
    border-bottom-color: var(--primary);
}

.article img {
    max-width: 100%;
    border-radius: 10px;
    margin: 2rem 0;
}

/* Table of Contents */
.toc {
    position: fixed;
    right: 2rem; /* Slightly closer to the edge */
    top: 120px;
    width: 260px;
    background: rgba(15, 15, 30, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 90; /* Ensure it's below navigation but above content */
}

.toc-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toc-link {
    display: block;
    padding: 0.5rem 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
}

.toc-link:hover {
    color: var(--text-primary);
    border-left-color: var(--primary);
}

.toc-link.active {
    color: var(--primary);
    border-left-color: var(--primary);
}

.toc-link.h3 {
    padding-left: 1.5rem;
    font-size: 0.85rem;
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Copy Button for Code Blocks */
.code-block-wrapper {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-button:hover {
    background: rgba(124, 58, 237, 0.3);
}

.copy-button.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    color: var(--success);
}

/* Mobile Responsive */
@media (max-width: 1700px) {
    .toc {
        display: none;
    }

    .main-content {
        margin-right: 2rem; /* Restore normal right margin when TOC is hidden */
    }

    .article {
        max-width: 1200px; /* Restore max-width when TOC is hidden */
        margin: 0 auto; /* Center the article */
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        margin-right: 0; /* Remove right margin on mobile */
        padding: 2rem;
    }
}

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

    .article {
        padding: 2rem 1.5rem;
        border-radius: 15px;
    }

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

    .navbar-nav {
        display: none;
    }

    .menu-toggle {
        display: block;
    }
}