/* ============================================
   DARK THEME - GHOST MAIL DOCUMENTATION
   ============================================ */

:root {
    --primary-color: #ff00ff;
    --primary-dark: #cc00cc;
    --bg-dark: #0d1117;
    --bg-darker: #010409;
    --bg-card: #161b22;
    --bg-code: #0d1117;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --success-color: #3fb950;
    --warning-color: #d29922;
    --error-color: #f85149;
    --spacing: 1.5rem;
    --border-radius: 0.5rem;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 1.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

.nav-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-group:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.nav-group-label {
    padding: 0.5rem 1.5rem 0.35rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    list-style: none;
    cursor: pointer;
}

.nav-group-label::-webkit-details-marker {
    display: none;
}

.nav-group-content {
    display: flex;
    flex-direction: column;
}

.nav-group[open] .nav-group-label {
    color: var(--primary-color);
}

.nav-link {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(255, 0, 255, 0.05);
    border-left-color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    background: rgba(255, 0, 255, 0.08);
}

.nav-sublink {
    padding: 0.5rem 1.5rem 0.5rem 2.4rem;
    font-size: 0.86rem;
    border-left-width: 2px;
}

.nav-external {
    padding: 0.75rem 1.5rem 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.nav-external:hover {
    color: var(--primary-color);
    background: rgba(255, 0, 255, 0.05);
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

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

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    width: 2.75rem;
    height: 2.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 9999px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.sidebar.open .menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.sidebar.open .menu-toggle span:nth-child(2) {
    opacity: 0;
}

.sidebar.open .menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    margin-left: 260px;
    padding: 2rem;
}

.section {
    margin: 0 0 3rem 0;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    scroll-margin-top: 1.5rem;
}

.section:last-of-type {
    border-bottom: none;
}

.intro-section {
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.1) 0%, rgba(255, 0, 255, 0.05) 100%);
    border: 1px solid rgba(255, 0, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
}

.note-section {
    background: rgba(255, 0, 255, 0.08);
    border: 1px solid rgba(255, 0, 255, 0.15);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
}

.section-content {
    max-width: 800px;
}

.section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

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

.section h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.lead {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.section-subtle-hint {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 1rem;
}

.section strong,
.step strong,
.option strong,
.faq-item strong,
.beginner-note strong,
.info-box strong,
.warning-box strong,
.success-box strong {
    color: #d5dee8;
    font-weight: 650;
}

/* ============================================
   CARDS AND TIMELINE
   ============================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.1);
}

.card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.card p {
    color: var(--text-secondary);
    margin: 0;
}

.timeline {
    margin: 2rem 0;
}

.timeline-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 1.3rem;
    top: 3rem;
    width: 2px;
    height: 40px;
    background: var(--border-color);
}

.timeline-marker {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.timeline-content h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.timeline-content p {
    margin: 0;
    color: var(--text-secondary);
}

/* ============================================
   BADGES AND HEADERS
   ============================================ */

.part-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.difficulty {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.difficulty.easy {
    background: rgba(63, 185, 80, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.difficulty.hard {
    background: rgba(248, 81, 73, 0.2);
    color: var(--error-color);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.time {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   STEPS
   ============================================ */

.step {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--bg-darker);
    font-weight: bold;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.step h3 {
    display: flex;
    align-items: center;
    margin-top: 0;
}

.step p {
    color: var(--text-secondary);
    margin: 1rem 0;
}

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

.step li {
    margin-bottom: 0.75rem;
    line-height: 1.8;
}

.step a {
    color: var(--primary-color);
    text-decoration: none;
}

.step a:hover {
    text-decoration: underline;
}

.step code {
    background: var(--bg-code);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

/* ============================================
   OPTIONS
   ============================================ */

.option {
    background: var(--bg-card);
    border-left: 3px solid var(--primary-color);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0.25rem;
}

.option h4 {
    margin-top: 0;
    color: var(--primary-color);
}

/* ============================================
   CODE BLOCKS
   ============================================ */
.code-collapsible {
    border: 1px solid #30363d;
    border-radius: 6px;
    margin: 15px 0;
    background: #0d1117;
}

.code-collapsible summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 12px 15px;
    cursor: pointer;
    color: #58a6ff;
    font-weight: bold;
    outline: none;
    list-style: none;
    position: relative;
    background: linear-gradient(90deg, rgba(88, 166, 255, 0.14) 0%, rgba(88, 166, 255, 0.05) 100%);
    transition: background 0.2s ease, color 0.2s ease;
}

.code-collapsible summary::-webkit-details-marker {
    display: none;
}

.code-collapsible[open] summary {
    border-bottom: 1px solid #30363d;
    margin-bottom: 0;
    color: #9ac8ff;
    background: linear-gradient(90deg, rgba(88, 166, 255, 0.2) 0%, rgba(88, 166, 255, 0.08) 100%);
}

.code-collapsible summary::before {
    content: 'Click to expand';
    flex: 0 0 auto;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0d1117;
    background: #58a6ff;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
}

.code-collapsible summary::after {
    content: '▾';
    margin-left: auto;
    color: inherit;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.code-collapsible .code-block {
    margin: 0;
    border: none;
}

.code-collapsible[open] summary::after {
    transform: rotate(180deg);
}

.code-block {
    position: relative;
    background: var(--bg-code);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 1.5rem 0;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
}

.code-block code {
    color: var(--text-primary);
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    text-decoration: none !important;
    border: 0;
    background: transparent;
}

.hljs {
    background: var(--bg-code) !important;
    color: var(--text-primary) !important;
    text-decoration: none !important;
}

.hljs,
.hljs * {
    text-decoration: none !important;
    box-shadow: none !important;
}

.hljs-string,
.hljs-literal {
    color: #79c0ff !important;
}

.hljs-attr {
    color: var(--primary-color) !important;
}

.hljs-title,
.hljs-name {
    color: #79c0ff !important;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--bg-darker);
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    z-index: 10;
}

.copy-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background: var(--success-color);
}

/* ============================================
   INFO / SUCCESS / WARNING BOXES
   ============================================ */

.info-box,
.success-box,
.warning-box,
.beginner-note {
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.info-box {
    background: rgba(79, 192, 255, 0.1);
    border-left: 3px solid #0ea5e9;
    color: var(--text-secondary);
}

.success-box {
    background: rgba(63, 185, 80, 0.1);
    border-left: 3px solid var(--success-color);
    color: var(--text-secondary);
}

.warning-box {
    background: rgba(210, 153, 34, 0.1);
    border-left: 3px solid var(--warning-color);
    color: var(--text-secondary);
}

.beginner-note {
    background: rgba(255, 0, 255, 0.1);
    border-left: 3px solid var(--primary-color);
    color: var(--text-secondary);
}

.beginner-note h2 {
    margin-top: 0;
}

.beginner-note ul {
    margin: 1rem 0 1rem 2rem;
}

.beginner-note li {
    margin-bottom: 0.5rem;
}

/* ============================================
   FAQ
   ============================================ */

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.1);
}

.faq-item h3 {
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
}

.faq-item p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.8;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background: var(--bg-card);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    html {
        scroll-padding-top: 7rem;
    }

    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow: hidden;
        z-index: 1100;
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1rem 1rem;
    }

    .menu-toggle {
        display: flex;
        flex-shrink: 0;
    }

    .sidebar-nav {
        display: none;
        flex-direction: column;
        padding: 0.5rem 0;
    }

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

    .sidebar-footer {
        display: none;
    }

    .sidebar.open .sidebar-footer {
        display: block;
    }

    .nav-link {
        flex: 1;
        min-width: 100px;
        text-align: left;
        width: 100%;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-group {
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
    }

    .nav-group-label {
        padding: 0.65rem 1rem 0.6rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        font-size: 0.78rem;
        background: rgba(255, 0, 255, 0.04);
        border-radius: 0.35rem;
        margin: 0 0.5rem 0.4rem;
    }

    .nav-group-label::after {
        content: '▾';
        color: var(--text-muted);
        font-size: 0.85rem;
        transition: transform 0.2s ease;
    }

    .nav-group[open] .nav-group-label::after {
        transform: rotate(180deg);
    }

    .nav-sublink {
        display: block;
        padding-left: 1.9rem;
    }

    .nav-external {
        display: block;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .nav-group-content {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
    }

    .nav-group:not([open]) .nav-group-content {
        display: none;
    }

    .section-subtle-hint {
        display: block;
    }

    .nav-link:hover,
    .nav-link.active {
        border-left: none;
        border-bottom-color: var(--primary-color);
    }

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

    .section {
        padding: 1rem 0;
        scroll-margin-top: 7rem;
    }

    .section h1 {
        font-size: 1.75rem;
    }

    .section h2 {
        font-size: 1.5rem;
    }

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

    .code-block pre {
        padding: 1rem 0.5rem;
        font-size: 0.75rem;
    }

    .copy-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    html {
        scroll-padding-top: 7rem;
    }

    .main-content {
        margin-top: 0;
        padding: 0.5rem;
    }

    .section {
        scroll-margin-top: 7rem;
    }

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

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

    .step {
        padding: 1rem;
    }

    .step::before {
        background-position: right 0.75rem top 0.75rem;
        background-size: 120px auto;
    }

    .code-block {
        margin: 1rem 0;
    }
}