/* TON File Specification - Site Styles */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #ecf0f1;
    --code-bg: #f8f9fa;
    --code-border: #dee2e6;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --header-height: 60px;
    --sidebar-width: 280px;
    --content-max-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    margin-left: 0.5rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 197, 253, 0.05));
    border-radius: 12px;
    transition: all 0.3s ease;
}

.header-brand:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(147, 197, 253, 0.08));
    transform: translateY(-1px);
}

.header-brand img {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.header-brand:hover img {
    transform: rotate(5deg) scale(1.05);
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.header-brand-text .brand-title {
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #93c5fd, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.header-brand-text .brand-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-nav {
    margin-left: auto;
    margin-right: 1.5rem;
    display: flex;
    gap: 1.5rem;
}

.header-nav a {
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    transition: opacity 0.2s;
}

.header-nav a:hover {
    opacity: 0.8;
}

/* Layout Container */
.container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--sidebar-bg);
    overflow-y: auto;
    padding: 2rem 0;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav > li {
    margin-bottom: 0;
}

.sidebar-nav a {
    display: block;
    padding: 0.4rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.sidebar-nav a:hover {
    background-color: var(--sidebar-hover);
}

.sidebar-nav a.active {
    background-color: var(--secondary-color);
    font-weight: 500;
}

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

.sidebar-section-title {
    padding: 0.3rem 1.5rem;
    color: rgba(236, 240, 241, 0.6);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sidebar-nav .sub-nav {
    list-style: none;
    margin-left: 1rem;
}

.sidebar-nav .sub-nav a {
    padding: 0.35rem 1.5rem;
    font-size: 0.85rem;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem 3rem;
    max-width: calc(var(--content-max-width) + 6rem);
}

.content-wrapper {
    max-width: var(--content-max-width);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

h1 {
    font-size: 2.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    margin-top: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    margin-left: 2rem;
}

li {
    margin-bottom: 0.25rem;
}

/* Code Blocks */
pre {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

code {
    font-family: 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background-color: var(--code-bg);
    border-radius: 3px;
}

pre code {
    padding: 0;
    background: transparent;
    font-size: inherit;
}

/* Syntax Highlighting for TON */
.language-ton .keyword {
    color: #d73a49;
    font-weight: 500;
}

.language-ton .string {
    color: #032f62;
}

.language-ton .number {
    color: #005cc5;
}

.language-ton .boolean {
    color: #d73a49;
}

.language-ton .null {
    color: #d73a49;
}

.language-ton .property {
    color: #6f42c1;
}

.language-ton .comment {
    color: #6a737d;
    font-style: italic;
}

.language-ton .class-name {
    color: #e36209;
    font-weight: 500;
}

.language-ton .enum {
    color: #22863a;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    border: 1px solid var(--code-border);
}

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

th {
    background-color: var(--code-bg);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

/* Alerts and Callouts */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid;
}

.alert-info {
    background-color: #e7f3ff;
    border-left-color: var(--secondary-color);
    color: #004085;
}

.alert-warning {
    background-color: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.alert-success {
    background-color: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-left-color: var(--accent-color);
    color: #721c24;
}

/* Table of Contents */
.toc {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.toc h2 {
    font-size: 1.25rem;
    margin-top: 0;
    border: none;
    padding: 0;
}

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

.toc ul ul {
    margin-left: 1.5rem;
}

.toc a {
    color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

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

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .header {
        padding: 0 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: #6c757d;
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25em 0.5em;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    background-color: var(--secondary-color);
    color: white;
}

.badge-success {
    background-color: #28a745;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-danger {
    background-color: var(--accent-color);
}

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

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background-color: white;
    border: 1px solid var(--code-border);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.copy-button:hover {
    background-color: var(--code-bg);
}

.copy-button.copied {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}