/* CSS Variables for theming */
:root {
    --primary-color: #238636;
    --primary-hover: #2ea043;
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --border-light: #21262d;
    --link-color: #58a6ff;
    --code-bg: #1f2428;
    --highlight-bg: rgba(56, 139, 253, 0.15);
    --success-color: #238636;
    --warning-color: #d29922;
    --danger-color: #f85149;
    --header-height: 200px;
    --nav-height: 50px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 20px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 40px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #58a6ff, #a371f7, #f778ba);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* Search */
.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

#search {
    width: 100%;
    padding: 14px 45px 14px 20px;
    font-size: 1rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: all var(--transition);
}

#search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(35, 134, 54, 0.3);
}

#search::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    font-size: 1rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.clear-btn.visible {
    opacity: 1;
}

.clear-btn:hover {
    color: var(--text-primary);
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    box-shadow: var(--shadow-md);
}

.nav-toggle {
    display: none;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    position: relative;
    transition: var(--transition);
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    left: 0;
    transition: var(--transition);
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    list-style: none;
    padding: 10px 0;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-list li a {
    display: block;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-list li a:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.nav-list li a.active {
    color: var(--primary-color);
    background-color: rgba(35, 134, 54, 0.15);
}

/* Main content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Sections */
.section {
    margin-bottom: 25px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.section:hover {
    box-shadow: var(--shadow-md);
}

.section.highlight {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    cursor: pointer;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid transparent;
    transition: all var(--transition);
}

.section-header:hover {
    background-color: rgba(35, 134, 54, 0.1);
}

.section-header[aria-expanded="true"] {
    border-bottom-color: var(--border-color);
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-icon {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.section-header[aria-expanded="false"] .toggle-icon {
    transform: rotate(0deg);
}

.section-content {
    padding: 25px;
    animation: fadeIn 0.3s ease;
}

.section-content.collapsed {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tables */
.command-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.command-table:last-child {
    margin-bottom: 0;
}

.command-table thead th {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 2-column tables: first column fixed width */
.command-table:not(.cols-3) th:first-child,
.command-table:not(.cols-3) td:first-child {
    width: 280px;
    min-width: 280px;
}

/* 3-column tables: equal width distribution */
.command-table.cols-3 th,
.command-table.cols-3 td {
    width: 33.33%;
}

.command-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.command-table tbody tr:last-child td {
    border-bottom: none;
}

.command-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.command-table.compact {
    margin-bottom: 0;
}

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

/* Code elements */
code {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 0.9em;
    background-color: var(--code-bg);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: #79c0ff;
    border: 1px solid var(--border-light);
}

code.copyable {
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}

code.copyable:hover {
    background-color: var(--highlight-bg);
    border-color: var(--link-color);
}

code.copyable::after {
    content: '📋';
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    opacity: 0;
    transition: opacity var(--transition);
}

code.copyable:hover::after {
    opacity: 0.7;
}

code.block {
    display: block;
    padding: 12px 15px;
    margin: 8px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

code.copied {
    background-color: rgba(35, 134, 54, 0.3);
    border-color: var(--success-color);
}

/* Keyboard shortcuts */
kbd {
    display: inline-block;
    padding: 4px 8px;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.85em;
    color: var(--text-primary);
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 0 var(--border-color);
}

/* Tip and example boxes */
.tip-box, .example-box {
    background-color: var(--bg-tertiary);
    border-left: 4px solid var(--primary-color);
    padding: 15px 20px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-top: 15px;
}

.tip-box ul {
    margin: 10px 0 0 20px;
    color: var(--text-secondary);
}

.tip-box li {
    margin-bottom: 5px;
}

.example-box {
    border-left-color: var(--link-color);
}

/* Mode cycle display */
.mode-cycle {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    padding: 10px;
    margin-top: 10px;
    background-color: var(--code-bg);
    border-radius: var(--radius-sm);
    text-align: center;
    color: #a371f7;
}

/* Mental model box */
.mental-model {
    background-color: var(--bg-tertiary);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
}

.mental-model h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.mental-model ul {
    list-style: none;
}

.mental-model li {
    padding: 8px 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.mental-model li:last-child {
    border-bottom: none;
}

.mental-model li code {
    margin-right: 10px;
}

/* Agents grid */
.agents-grid {
    margin-top: 20px;
}

.agents-grid h4 {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.agent-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.agent-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
}

.agent-icon {
    font-size: 1.8rem;
}

.agent-card strong {
    color: var(--text-primary);
}

.agent-role {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: auto;
}

/* File tree */
.file-tree {
    background-color: var(--code-bg);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    overflow-x: auto;
}

.file-tree pre {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Recipe cards */
.recipe-card {
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

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

.recipe-card h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.recipe-steps {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.recipe-note {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    padding-left: 15px;
}

/* Tips list */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tip-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.tip-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary-color), #2ea043);
    color: white;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
}

.tip-content {
    flex: 1;
}

.tip-content strong {
    color: var(--text-primary);
}

/* Resources grid */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.resource-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition);
}

.resource-link:hover {
    border-color: var(--link-color);
    background-color: var(--highlight-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.resource-text {
    font-size: 0.95rem;
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    text-align: center;
    margin-top: 40px;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.footer strong {
    color: var(--text-primary);
}

.last-updated {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    box-shadow: var(--shadow-lg);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
}

/* Copy toast */
.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--success-color);
    color: white;
    padding: 12px 25px;
    border-radius: var(--radius-lg);
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.copy-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Section headings inside content */
.section-content h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.section-content h3:first-child {
    margin-top: 0;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-results h3 {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .nav-toggle {
        display: block;
        width: 100%;
        text-align: left;
        padding: 15px 20px;
    }

    .nav-list {
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 0 0 15px;
    }

    .nav-list.open {
        display: flex;
    }

    .nav-list li a {
        padding: 12px 20px;
        border-radius: 0;
    }

    .section-header {
        padding: 15px 20px;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .section-content {
        padding: 15px;
    }

    .command-table {
        display: block;
        overflow-x: auto;
    }

    .command-table thead {
        display: none;
    }

    .command-table tbody, 
    .command-table tr, 
    .command-table td {
        display: block;
    }

    .command-table tbody tr {
        margin-bottom: 15px;
        padding: 15px;
        background-color: var(--bg-tertiary);
        border-radius: var(--radius-md);
    }

    .command-table tbody td {
        padding: 5px 0;
        border-bottom: none;
    }

    .command-table tbody td:first-child {
        font-weight: 600;
        color: var(--text-secondary);
        margin-bottom: 5px;
    }

    .shortcuts-table tbody td:first-child,
    .troubleshooting-table tbody td:first-child {
        margin-bottom: 10px;
    }

    .agent-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .agent-role {
        margin-left: 0;
    }

    .resources-grid {
        grid-template-columns: 1fr;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }

    code.copyable::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 30px 15px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    #search {
        padding: 12px 40px 12px 15px;
        font-size: 0.95rem;
    }

    .tip-item {
        flex-direction: column;
        gap: 10px;
    }

    .tip-number {
        align-self: flex-start;
    }
}

/* Print styles */
@media print {
    .header {
        padding: 20px;
    }

    .nav, .back-to-top, .search-container, .clear-btn {
        display: none !important;
    }

    .section {
        break-inside: avoid;
        border: 1px solid #ccc;
        margin-bottom: 15px;
    }

    .section-content {
        display: block !important;
    }

    .section-header {
        cursor: default;
    }

    .toggle-icon {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }

    code {
        background-color: #f5f5f5;
        border-color: #ddd;
        color: #333;
    }

    .command-table tbody tr:hover {
        background-color: transparent;
    }
}
