/* ============================================================
   LaborApp Wiki — Design System (matches v2 app)
   ============================================================ */
:root {
    --primary: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #22d3ee;
    --primary-bg: rgba(8, 145, 178, 0.08);
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: rgba(8, 145, 178, 0.2);
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #22d3ee;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --sidebar-width: 280px;
    --topbar-height: 56px;
    --transition: 0.2s ease;
}

/* Dark theme */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --bg-sidebar-hover: #0f172a;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============ LAYOUT ============ */
.wiki-layout {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.wiki-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
}
.wiki-sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.wiki-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}
.wiki-sidebar-brand i {
    color: var(--primary-light);
    font-size: 22px;
}
.wiki-sidebar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.wiki-sidebar-lang {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.wiki-sidebar-lang a {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    color: var(--text-sidebar);
    border: 1px solid rgba(255,255,255,0.12);
    transition: all var(--transition);
}
.wiki-sidebar-lang a:hover,
.wiki-sidebar-lang a.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    border-color: var(--primary);
}

/* Nav sections */
.wiki-nav { padding: 12px 0; flex: 1; }
.wiki-nav-section {
    padding: 0 12px;
    margin-bottom: 4px;
}
.wiki-nav-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}
.wiki-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-sidebar);
    font-size: 13px;
    transition: all var(--transition);
    text-decoration: none;
}
.wiki-nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}
.wiki-nav-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 500;
}
.wiki-nav-link i {
    width: 18px;
    text-align: center;
    font-size: 13px;
    opacity: 0.7;
}
.wiki-nav-link.active i { opacity: 1; }

/* Sidebar footer */
.wiki-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 11px;
    color: var(--text-muted);
}
.wiki-sidebar-footer a { color: var(--primary-light); }

/* ============ MAIN CONTENT ============ */
.wiki-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.wiki-topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.wiki-topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.wiki-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.wiki-topbar-btn {
    display: none; /* mobile only */
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}
.wiki-theme-btn {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
}
.wiki-theme-btn:hover { color: var(--primary); border-color: var(--primary); }

/* Content area */
.wiki-content {
    flex: 1;
    padding: 32px 40px 80px;
    width: 100%;
}

/* ============ PAGE HEADER ============ */
.wiki-page-header {
    margin-bottom: 36px;
    padding: 32px 28px;
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 50%, #22d3ee 100%);
    border-radius: 12px;
    color: white;
}
.wiki-page-header i.main-icon { font-size: 40px; margin-bottom: 12px; display: block; }
.wiki-page-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.wiki-page-header p { font-size: 14px; opacity: 0.9; }

/* ============ CONTENT ELEMENTS ============ */
/* Section */
.wiki-section { margin-bottom: 36px; }
.wiki-section h2 {
    font-size: 19px; font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: flex; align-items: center; gap: 10px;
}
.wiki-section h2 i { color: var(--primary); }
.wiki-section h3 {
    font-size: 15px; font-weight: 600;
    margin: 18px 0 8px;
    color: var(--text);
}
.wiki-section p { margin-bottom: 12px; font-size: 14px; }
.wiki-section ul, .wiki-section ol { padding-left: 20px; margin-bottom: 12px; font-size: 14px; }
.wiki-section li { margin-bottom: 4px; }

/* Feature card */
.wiki-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.wiki-card h4 {
    font-size: 14px; font-weight: 600;
    margin-bottom: 6px;
    display: flex; align-items: center; gap: 8px;
}
.wiki-card h4 i { color: var(--primary); }
.wiki-card p { font-size: 13px; margin-bottom: 0; }
.wiki-card ul { font-size: 13px; margin-top: 6px; padding-left: 18px; }

/* Alert boxes */
.wiki-tip, .wiki-warning, .wiki-info {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    margin: 12px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.wiki-tip { background: rgba(16,185,129,0.1); border-left: 3px solid var(--success); }
.wiki-tip i { color: var(--success); margin-top: 2px; }
.wiki-warning { background: rgba(245,158,11,0.1); border-left: 3px solid var(--warning); }
.wiki-warning i { color: var(--warning); margin-top: 2px; }
.wiki-info { background: var(--primary-bg); border-left: 3px solid var(--primary); }
.wiki-info i { color: var(--primary); margin-top: 2px; }

/* Table */
.wiki-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 12px 0;
}
.wiki-table th {
    background: var(--bg);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    border-bottom: 2px solid var(--border);
}
.wiki-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

/* Home cards grid */
.wiki-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.wiki-home-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text);
    display: block;
}
.wiki-home-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
    transform: translateY(-2px);
}
.wiki-home-card i.card-icon {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}
.wiki-home-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}
.wiki-home-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* TOC */
.wiki-toc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}
.wiki-toc h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; color: var(--primary); }
.wiki-toc ol { padding-left: 20px; }
.wiki-toc li { margin-bottom: 5px; }
.wiki-toc a { color: var(--primary); font-size: 13px; }
.wiki-toc a:hover { text-decoration: underline; }

/* Color samples */
.wiki-color-sample {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px 4px;
}
.wiki-color-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* Footer */
.wiki-footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ============ IMAGES ============ */
.wiki-section img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 8px 0;
}
.wiki-img-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
    align-items: flex-start;
}
.wiki-img-row img {
    margin: 0;
}

/* ============ VIDEO CARDS ============ */
.wiki-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin: 16px 0;
}
.wiki-video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.wiki-video-card video {
    width: 100%;
    display: block;
    background: #000;
}
.wiki-video-card .wiki-video-info {
    padding: 14px 16px;
}
.wiki-video-card .wiki-video-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}
.wiki-video-card .wiki-video-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* ============ SCROLLBARS ============ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #22d3ee; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #0891b2; }
* { scrollbar-width: thin; scrollbar-color: #22d3ee transparent; }

/* ============ MOBILE ============ */
@media (max-width: 768px) {
    .wiki-sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .wiki-sidebar.open { transform: translateX(0); }
    .wiki-main { margin-left: 0; }
    .wiki-topbar-btn { display: flex; }
    .wiki-content { padding: 20px 16px 60px; }
    .wiki-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .wiki-overlay.open { display: block; }
}

/* ============ PRINT ============ */
@media print {
    .wiki-sidebar, .wiki-topbar, .wiki-overlay { display: none !important; }
    .wiki-main { margin-left: 0 !important; }
    .wiki-content { padding: 0; max-width: none; }
    .wiki-page-header { background: var(--primary) !important; -webkit-print-color-adjust: exact; }
}
