/* ============================================
   Satoshi Hero Docs - GitBook Three-Column Layout
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Pacifico&display=swap');

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

:root {
    /* Dark Theme (Default) */
    --bg-primary: #171717;
    --bg-secondary: #1a1a1a;
    --bg-sidebar: #1e1e1e;
    --bg-card: #262626;
    --bg-card-hover: #2a2a2a;
    --bg-header: #2d2a35;
    --text-primary: #ffffff;
    --text-secondary: #b8b8b8;
    --text-muted: #737373;
    --border-color: #2e2e2e;
    --border-light: #404040;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --link-color: #60a5fa;
    --check-color: #22c55e;
    --header-height: 60px;
    --sidebar-width: 260px;
    --toc-width: 240px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-sidebar: #f3f4f6;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f6;
    --bg-header: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #d1d5db;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
}

/* ============================================
   Header
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
}

.logo {
    display: flex;
    align-items: center;
    font-family: 'Pacifico', cursive;
    font-size: 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.logo:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    background: transparent;
}

.header-btn:hover {
    background-color: rgba(255,255,255,0.05);
    text-decoration: none;
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    min-width: 180px;
    transition: all 0.2s;
}

.search-trigger:hover {
    border-color: var(--border-light);
}

.search-trigger span {
    flex: 1;
    text-align: left;
}

.search-trigger kbd {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: inherit;
}

/* ============================================
   Three-Column Layout
   ============================================ */

.layout {
    display: flex;
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ============================================
   Left Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 16px 0;
}

/* Language Selector */
.language-selector {
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    position: relative;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.15s;
}

.language-btn:hover {
    background-color: var(--bg-card);
}

.language-btn .flag-icon {
    font-size: 1.125rem;
}

.language-btn .lang-name {
    flex: 1;
    text-align: left;
}

.language-btn i {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.language-btn.active i {
    transform: rotate(180deg);
}

/* Language Dropdown */
.language-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 16px;
    right: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-height: 320px;
    overflow-y: auto;
}

.language-dropdown.active {
    display: block;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    text-align: left;
    transition: all 0.15s;
}

.language-option:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.language-option.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.language-option .flag-icon {
    font-size: 1.25rem;
}

.language-option .lang-name {
    flex: 1;
}

.language-option .check-icon {
    color: var(--check-color);
    font-size: 0.75rem;
    display: none;
}

.language-option.active .check-icon {
    display: block;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 0 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.nav-item .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* Navigation Group (Expandable) */
.nav-group {
    margin-bottom: 2px;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    text-align: left;
}

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

.nav-group-toggle .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.nav-group-toggle .chevron {
    margin-left: auto;
    font-size: 0.625rem;
    transition: transform 0.2s;
}

.nav-group-toggle.active .chevron {
    transform: rotate(90deg);
}

.nav-submenu {
    display: none;
    padding-left: 20px;
    margin-top: 2px;
}

.nav-submenu.active {
    display: block;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    border-radius: 6px;
    transition: all 0.15s;
    margin-bottom: 1px;
}

.nav-subitem:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-subitem .nav-icon {
    font-size: 0.875rem;
    width: 16px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.powered-by {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.15s;
}

.powered-by:hover {
    background-color: var(--bg-card);
    text-decoration: none;
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-right: var(--toc-width);
    min-width: 0;
}

.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 40px 80px;
}

/* Content Header */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.breadcrumb .flag-icon {
    font-size: 0.875rem;
}

/* Copy Dropdown */
.copy-wrapper {
    position: relative;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.copy-btn .chevron {
    font-size: 0.625rem;
    transition: transform 0.2s;
}

.copy-btn.active .chevron {
    transform: rotate(180deg);
}

.copy-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    display: none;
    z-index: 50;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.copy-dropdown.active {
    display: block;
}

.copy-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s;
}

.copy-item:hover {
    background-color: var(--bg-card);
}

.copy-item > i {
    margin-top: 2px;
    color: var(--text-muted);
    width: 16px;
}

.copy-item i.small {
    font-size: 0.625rem;
    margin-left: 4px;
    vertical-align: middle;
}

.copy-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.copy-item-text strong {
    font-weight: 500;
    font-size: 0.875rem;
}

.copy-item-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Page Content */
.page-content {
    color: var(--text-primary);
}

.page-title {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.title-icon {
    font-size: 2rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 40px;
}

/* Sections */
section {
    margin-bottom: 40px;
    scroll-margin-top: calc(var(--header-height) + 24px);
}

section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.section-icon {
    font-size: 1.25rem;
}

section p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

section p strong {
    color: var(--text-primary);
}

/* Lists */
ul {
    list-style: none;
    margin-bottom: 16px;
}

.check-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    color: var(--text-secondary);
}

.check-list li i {
    color: var(--check-color);
    margin-top: 3px;
}

.diamond-list li {
    padding: 4px 0;
    color: var(--text-secondary);
}

.diamond-list li::before {
    content: "◆ ";
    color: var(--accent);
}

.country-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    color: var(--text-secondary);
}

.country-code, .lang-code {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 24px;
}

.language-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: var(--text-secondary);
}

.social-list li {
    padding: 6px 0;
}

.social-list li a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}

.social-list li a:hover {
    color: var(--accent-hover);
}

/* ============================================
   Right Sidebar - Table of Contents
   ============================================ */

.toc-sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: var(--toc-width);
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 100;
}

.toc-content {
    padding: 24px 16px;
}

.toc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-left: 8px;
}

.toc-icon {
    font-size: 1rem;
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    border-radius: 4px;
    border-left: 2px solid transparent;
    transition: all 0.15s;
    line-height: 1.4;
}

.toc-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-card);
    text-decoration: none;
}

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

.toc-link-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* ============================================
   Next Section
   ============================================ */

.next-section {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    margin-top: 40px;
}

.next-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.next-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
}

.next-link:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-light);
    text-decoration: none;
}

.next-link span {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.next-link i {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============================================
   Theme Switcher
   ============================================ */

.theme-switcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 4px;
    padding: 4px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 1000;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.theme-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.theme-btn.active {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* ============================================
   Search Modal
   ============================================ */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    z-index: 2000;
}

.search-overlay.active {
    display: flex;
}

.search-modal {
    width: 90%;
    max-width: 600px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
}

.search-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.search-header i {
    color: var(--text-muted);
}

.search-header input {
    flex: 1;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

.search-header input::placeholder {
    color: var(--text-muted);
}

.search-header kbd {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
}

.search-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}

.search-result {
    display: block;
    padding: 12px 16px;
    border-radius: 6px;
    text-decoration: none;
    margin-bottom: 4px;
}

.search-result:hover {
    background-color: var(--bg-card);
    text-decoration: none;
}

.search-result-title {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.search-result-excerpt {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.search-result mark {
    background-color: rgba(167, 139, 250, 0.3);
    color: var(--text-primary);
    border-radius: 2px;
    padding: 0 2px;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1200px) {
    .toc-sidebar {
        display: none;
    }

    .main-content {
        margin-right: 0;
    }
}

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

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

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .header-btn {
        display: none;
    }

    .content-wrapper {
        padding: 24px 20px 60px;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .title-icon {
        font-size: 1.5rem;
    }

    section h2 {
        font-size: 1.25rem;
    }

    .theme-switcher {
        bottom: 16px;
        right: 16px;
    }
}

@media (max-width: 600px) {
    .search-trigger {
        min-width: auto;
        padding: 8px;
    }

    .search-trigger span,
    .search-trigger kbd {
        display: none;
    }

    .page-title {
        font-size: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.toc-sidebar::-webkit-scrollbar {
    width: 4px;
}

/* ============================================
   Tables
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

thead {
    background: linear-gradient(135deg, var(--bg-header) 0%, rgba(167, 139, 250, 0.15) 100%);
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--accent);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

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

tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
    background-color: var(--bg-card-hover);
}

tbody td {
    padding: 12px 16px;
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

/* Table with accent first column */
table.accent-first tbody td:first-child {
    color: var(--accent);
}

/* Compact table variant */
table.compact thead th {
    padding: 10px 12px;
}

table.compact tbody td {
    padding: 8px 12px;
}

/* Light theme table adjustments */
[data-theme="light"] thead {
    background: linear-gradient(135deg, #f8f9fa 0%, rgba(167, 139, 250, 0.1) 100%);
}

[data-theme="light"] tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Responsive tables */
@media (max-width: 600px) {
    table {
        font-size: 0.8rem;
    }
    
    thead th,
    tbody td {
        padding: 10px 12px;
    }
    
    /* Stack tables on very small screens */
    table.responsive {
        display: block;
    }
    
    table.responsive thead {
        display: none;
    }
    
    table.responsive tbody {
        display: block;
    }
    
    table.responsive tr {
        display: block;
        margin-bottom: 16px;
        background-color: var(--bg-card);
        border-radius: 8px;
        padding: 8px;
    }
    
    table.responsive td {
        display: flex;
        justify-content: space-between;
        padding: 8px 12px;
        border-bottom: 1px solid var(--border-color);
    }
    
    table.responsive td:last-child {
        border-bottom: none;
    }
    
    table.responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-primary);
    }
}

/* Logo color adjustment for light theme */
[data-theme="light"] .logo img {
    filter: invert(1);
}
