/* ShiftFlex Docs - Stylesheet */
/* Inherits CSS variables from ../styles.css */

/* ─── Root & Reset ───────────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --content-max: 860px;
    --toc-width: 220px;

    /* From landing styles.css (repeated for standalone use) */
    --brand-primary: #4FACFE;
    --brand-primary-light: #00F2FE;
    --brand-primary-dark: #0EA5E9;
    --brand-secondary: #F43F5E;
    --brand-tertiary: #6366F1;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --bg-app: #0F172A;
    --bg-card: #1E293B;
    --bg-secondary: #334155;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-light: #CBD5E1;
    --border: #334155;
    --gradient-primary: linear-gradient(135deg, #4FACFE 0%, #00F2FE 100%);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

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

html {
    scroll-behavior: smooth;
}

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

h1,
h2,
h3,
h4,
h5,
h6,
.logo,
.btn {
    font-family: 'Poppins', sans-serif;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--brand-primary-light);
}

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 64px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}

.navbar .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.navbar .logo img {
    width: 36px;
    height: 36px;
}

.navbar .logo-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.navbar .docs-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.navbar .nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar .nav-right a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.navbar .nav-right a:hover {
    color: var(--text-main);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--bg-app);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 172, 254, 0.35);
    color: var(--bg-app);
}

/* Mobile menu toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-main);
}

.sidebar-toggle svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ─── Layout shell ───────────────────────────────────────── */
.docs-shell {
    display: flex;
    padding-top: 64px;
    min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.docs-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: rgba(30, 41, 59, 0.5);
    padding: 24px 0 40px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-secondary) transparent;
}

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

.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.sidebar-section {
    margin-bottom: 28px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0 20px;
    margin-bottom: 6px;
}

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

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav li a:hover {
    color: var(--text-main);
    background: rgba(79, 172, 254, 0.05);
}

.sidebar-nav li a.active {
    color: var(--brand-primary);
    border-left-color: var(--brand-primary);
    background: rgba(79, 172, 254, 0.08);
    font-weight: 500;
}

.sidebar-nav li a svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ─── Content area ───────────────────────────────────────── */
.docs-content {
    flex: 1;
    min-width: 0;
    padding: 40px 48px 80px;
    max-width: calc(var(--content-max) + 96px);
}

/* ─── Breadcrumbs ────────────────────────────────────────── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

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

.breadcrumbs a:hover {
    color: var(--brand-primary);
}

.breadcrumbs .sep {
    color: var(--border);
}

.breadcrumbs .current {
    color: var(--text-light);
}

/* ─── Page header ────────────────────────────────────────── */
.page-header {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.page-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand-primary);
    margin-bottom: 10px;
}

.page-header h1 {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 12px;
}

.page-header .lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 640px;
    line-height: 1.7;
}

/* ─── Prose content ──────────────────────────────────────── */
.prose h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.prose h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--text-light);
}

.prose p {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.prose ul,
.prose ol {
    color: var(--text-muted);
    padding-left: 24px;
    margin-bottom: 16px;
}

.prose li {
    margin-bottom: 6px;
    line-height: 1.7;
}

.prose strong {
    color: var(--text-main);
    font-weight: 600;
}

.prose code {
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85em;
    background: var(--bg-secondary);
    color: var(--brand-primary);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ─── Callout boxes ──────────────────────────────────────── */
.callout {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin: 24px 0;
    border: 1px solid;
}

.callout-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.callout-body {
    flex: 1;
    min-width: 0;
}

.callout-body p {
    margin-bottom: 0;
    font-size: 0.925rem;
}

.callout-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.callout.note {
    background: rgba(79, 172, 254, 0.08);
    border-color: rgba(79, 172, 254, 0.25);
}

.callout.note .callout-title {
    color: var(--brand-primary);
}

.callout.tip {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
}

.callout.tip .callout-title {
    color: var(--success);
}

.callout.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}

.callout.warning .callout-title {
    color: var(--warning);
}

.callout.danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}

.callout.danger .callout-title {
    color: var(--error);
}

/* ─── Step guides ────────────────────────────────────────── */
.steps {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

.step-item {
    display: flex;
    gap: 18px;
    margin-bottom: 28px;
    position: relative;
}

.step-item::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 44px;
    bottom: -28px;
    width: 2px;
    background: var(--border);
}

.step-item:last-child::before {
    display: none;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--bg-app);
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.step-content {
    flex: 1;
    padding-top: 6px;
}

.step-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.step-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.doc-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.doc-card h3 {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--text-main);
}

.doc-card p {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin: 0;
}

.doc-card .arrow {
    margin-top: auto;
    color: var(--brand-primary);
    font-size: 1.1rem;
}

/* ─── Tables ─────────────────────────────────────────────── */
.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 24px 0;
}

.prose th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-secondary);
    color: var(--text-light);
    font-weight: 600;
    border: 1px solid var(--border);
}

.prose td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: top;
}

.prose tr:nth-child(even) td {
    background: rgba(30, 41, 59, 0.4);
}

/* ─── Status badges ──────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.badge.green {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge.blue {
    background: rgba(79, 172, 254, 0.15);
    color: var(--brand-primary);
}

.badge.yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge.red {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge.purple {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

/* ─── Role pills ─────────────────────────────────────────── */
.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.role-pill.manager {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.role-pill.employee {
    background: rgba(79, 172, 254, 0.15);
    color: var(--brand-primary);
    border: 1px solid rgba(79, 172, 254, 0.25);
}

/* ─── Inline feature checklist ───────────────────────────── */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.feature-list li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ─── Prev / Next navigation ─────────────────────────────── */
.page-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 64px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.page-nav a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    text-decoration: none;
}

.page-nav a:hover {
    border-color: var(--brand-primary);
}

.page-nav a .page-nav-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.page-nav a .page-nav-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.page-nav .next {
    text-align: right;
    grid-column: 2;
}

.page-nav .prev {
    grid-column: 1;
}

/* ─── Highlight on scroll (TOC active) ───────────────────── */
.prose h2[id],
.prose h3[id] {
    scroll-margin-top: 88px;
}

/* ─── Divider ────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 40px 0;
}

/* ─── Workflow diagram (simple) ──────────────────────────── */
.flow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 24px 0;
}

.flow-step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
}

.flow-arrow {
    color: var(--text-muted);
    padding: 0 6px;
    font-size: 1rem;
}

.flow-step.highlight {
    border-color: var(--brand-primary);
    background: rgba(79, 172, 254, 0.1);
    color: var(--brand-primary);
    font-weight: 600;
}

/* ─── Mobile responsive ──────────────────────────────────── */
@media (max-width: 900px) {
    .docs-sidebar {
        position: fixed;
        top: 64px;
        left: -100%;
        bottom: 0;
        z-index: 150;
        width: var(--sidebar-width);
        transition: left 0.3s ease;
        background: var(--bg-card);
        border-right: 1px solid var(--border);
    }

    .docs-sidebar.open {
        left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .docs-content {
        padding: 28px 20px 60px;
    }

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

@media (max-width: 600px) {
    .page-nav {
        grid-template-columns: 1fr;
    }

    .page-nav .next {
        grid-column: 1;
        text-align: left;
    }

    .flow {
        flex-direction: column;
        align-items: flex-start;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }
}

/* ─── Sidebar overlay ────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 140;
}

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