/**
 * GeneX User Manual Styles
 * 
 * Professional documentation layout.
 * Sidebar navigation + scrollable content.
 * Responsive: sidebar collapses to top nav on mobile.
 */

/* ============================================
   MANUAL LAYOUT
   ============================================ */

.manual-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg-primary);
}

/* ============================================
   MANUAL SIDEBAR NAVIGATION
   ============================================ */

.manual-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-default);
    overflow-y: auto;
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.manual-sidebar__header {
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.manual-sidebar__back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: var(--space-4);
    transition: color 0.15s ease;
}

.manual-sidebar__back:hover {
    color: var(--color-primary-600);
}

.manual-sidebar__back svg {
    width: 16px;
    height: 16px;
}

.manual-sidebar__logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.manual-sidebar__logo-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary-600), var(--color-accent-500));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--weight-extrabold);
    font-size: var(--text-base);
    color: #ffffff;
}

.manual-sidebar__logo-text {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
}

.manual-sidebar__logo-badge {
    font-size: 10px;
    font-weight: var(--weight-semibold);
    color: var(--color-primary-600);
    background: var(--color-primary-50);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: var(--space-1);
}

[data-theme="dark"] .manual-sidebar__logo-badge {
    background: rgba(92, 124, 250, 0.12);
    color: var(--color-primary-400);
}

.manual-sidebar__nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.manual-sidebar__section-title {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    padding: var(--space-4) var(--space-3) var(--space-2);
}

.manual-sidebar__section-title:first-child {
    padding-top: 0;
}

.manual-sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    line-height: var(--leading-relaxed);
}

.manual-sidebar__link:hover {
    background-color: var(--interactive-secondary);
    color: var(--text-primary);
}

.manual-sidebar__link.is-active {
    background-color: var(--color-primary-50);
    color: var(--color-primary-700);
    font-weight: var(--weight-semibold);
}

[data-theme="dark"] .manual-sidebar__link.is-active {
    background-color: rgba(92, 124, 250, 0.12);
    color: var(--color-primary-400);
}

.manual-sidebar__footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.manual-sidebar__theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.manual-sidebar__theme-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Mobile sidebar toggle */
.manual-mobile-toggle {
    display: none;
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 52px;
    height: 52px;
    background: var(--color-primary-600);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
}

.manual-mobile-toggle svg {
    width: 24px;
    height: 24px;
}

.manual-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: calc(var(--z-sidebar) - 1);
}

/* ============================================
   MANUAL CONTENT
   ============================================ */

.manual-content {
    flex: 1;
    margin-left: 280px;
    max-width: 100%;
}

.manual-content__inner {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-12) var(--space-8) var(--space-20);
}

/* ============================================
   MANUAL HERO
   ============================================ */

.manual-hero {
    margin-bottom: var(--space-16);
    padding-bottom: var(--space-10);
    border-bottom: 1px solid var(--border-light);
}

.manual-hero__eyebrow {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-primary-600);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    margin-bottom: var(--space-3);
}

.manual-hero__title {
    font-size: var(--text-5xl);
    font-weight: var(--weight-extrabold);
    color: var(--text-primary);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tighter);
    margin-bottom: var(--space-4);
}

.manual-hero__description {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    max-width: 36rem;
}

/* ============================================
   MANUAL SECTIONS
   ============================================ */

.manual-section {
    margin-bottom: var(--space-16);
    scroll-margin-top: var(--space-8);
}

.manual-section__title {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-6);
    letter-spacing: var(--tracking-tight);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-primary-100);
}

[data-theme="dark"] .manual-section__title {
    border-bottom-color: rgba(92, 124, 250, 0.2);
}

.manual-section__subtitle {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-top: var(--space-8);
    margin-bottom: var(--space-4);
}

.manual-section p {
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

.manual-section p:last-child {
    margin-bottom: 0;
}

/* ============================================
   MANUAL STEP LIST
   ============================================ */

.manual-steps {
    list-style: none;
    padding: 0;
    margin: var(--space-6) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    counter-reset: step-counter;
}

.manual-step {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    counter-increment: step-counter;
    transition: border-color 0.2s ease;
}

.manual-step:hover {
    border-color: var(--color-primary-200);
}

[data-theme="dark"] .manual-step:hover {
    border-color: rgba(92, 124, 250, 0.2);
}

.manual-step__number {
    width: 36px;
    height: 36px;
    background: var(--color-primary-100);
    color: var(--color-primary-700);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    flex-shrink: 0;
}

[data-theme="dark"] .manual-step__number {
    background: rgba(92, 124, 250, 0.15);
    color: var(--color-primary-400);
}

.manual-step__content {
    flex: 1;
    min-width: 0;
}

.manual-step__title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.manual-step__text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ============================================
   MANUAL INFO BOXES
   ============================================ */

.manual-info {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    margin: var(--space-6) 0;
    display: flex;
    gap: var(--space-3);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.manual-info__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.manual-info--tip {
    background: var(--color-success-50);
    border: 1px solid var(--color-success-200);
    color: var(--color-success-800);
}

[data-theme="dark"] .manual-info--tip {
    background: rgba(81, 207, 102, 0.08);
    border-color: rgba(81, 207, 102, 0.2);
    color: var(--color-success-300);
}

.manual-info--warning {
    background: var(--color-warning-50);
    border: 1px solid var(--color-warning-200);
    color: var(--color-warning-800);
}

[data-theme="dark"] .manual-info--warning {
    background: rgba(255, 169, 77, 0.08);
    border-color: rgba(255, 169, 77, 0.2);
    color: var(--color-warning-300);
}

.manual-info--note {
    background: var(--color-primary-50);
    border: 1px solid var(--color-primary-200);
    color: var(--color-primary-800);
}

[data-theme="dark"] .manual-info--note {
    background: rgba(92, 124, 250, 0.08);
    border-color: rgba(92, 124, 250, 0.2);
    color: var(--color-primary-300);
}

/* ============================================
   MANUAL CODE / KEYBOARD SHORTCUT
   ============================================ */

.manual-code {
    display: inline;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-code);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--color-primary-700);
}

[data-theme="dark"] .manual-code {
    color: var(--color-primary-400);
}

/* ============================================
   MANUAL FEATURE GRID
   ============================================ */

.manual-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin: var(--space-6) 0;
}

.manual-feature {
    padding: var(--space-5);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
}

.manual-feature__icon {
    font-size: 24px;
    margin-bottom: var(--space-3);
}

.manual-feature__title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.manual-feature__text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: var(--leading-relaxed);
}

/* ============================================
   MANUAL TABLE
   ============================================ */

.manual-table-wrapper {
    overflow-x: auto;
    margin: var(--space-6) 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.manual-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.manual-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}

.manual-table td {
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    line-height: var(--leading-relaxed);
}

.manual-table tr:last-child td {
    border-bottom: none;
}

.manual-table tr:hover td {
    background: var(--bg-secondary);
}

/* ============================================
   MANUAL FAQ
   ============================================ */

.manual-faq {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: var(--space-6) 0;
}

.manual-faq__item {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.manual-faq__question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: none;
    border: none;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease;
}

.manual-faq__question:hover {
    background: var(--bg-secondary);
}

.manual-faq__question-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.manual-faq__item.is-open .manual-faq__question-icon {
    transform: rotate(45deg);
}

.manual-faq__answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.manual-faq__item.is-open .manual-faq__answer {
    max-height: 500px;
}

.manual-faq__answer-inner {
    padding: 0 var(--space-5) var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ============================================
   BACK TO TOP
   ============================================ */

.manual-back-top {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 44px;
    height: 44px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: var(--z-raised);
}

.manual-back-top.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.manual-back-top:hover {
    color: var(--color-primary-600);
    border-color: var(--color-primary-300);
}

.manual-back-top svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .manual-sidebar {
        transform: translateX(-100%);
    }

    .manual-sidebar.is-open {
        transform: translateX(0);
    }

    .manual-sidebar-overlay.is-visible {
        display: block;
    }

    .manual-content {
        margin-left: 0;
    }

    .manual-mobile-toggle {
        display: flex;
    }

    .manual-back-top {
        bottom: var(--space-20);
    }
}

@media (max-width: 768px) {
    .manual-content__inner {
        padding: var(--space-8) var(--space-5) var(--space-16);
    }

    .manual-hero__title {
        font-size: var(--text-3xl);
    }

    .manual-section__title {
        font-size: var(--text-2xl);
    }

    .manual-features {
        grid-template-columns: 1fr;
    }

    .manual-step {
        flex-direction: column;
        gap: var(--space-3);
    }
}

@media (max-width: 380px) {
    .manual-content__inner {
        padding: var(--space-6) var(--space-4) var(--space-12);
    }

    .manual-hero__title {
        font-size: var(--text-2xl);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .manual-faq__answer {
        transition: none;
    }

    .manual-back-top {
        transition: none;
    }
}