@import url('https://fonts.googleapis.com/css2?family=Krub:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1e3a5f;
    --primary-light: #3b82f6;
    --primary-dark: #0f172a;
    --primary-bg: #eff6ff;
    --accent: #0ea5e9;
    --success: #10b981;
    --danger: #ef4444;
    --info: #3b82f6;
    --warning: #f59e0b;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --bg: #ffffff;
    --bg-gray: #f8fafc;
    --bg-sidebar: #0f172a;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --radius: 12px;
    --sidebar-w: 280px;
    --font-size: 16px;
    --topbar-bg: rgba(255,255,255,.9);
    --hover-bg: #fafafa;
    --callout-info-bg: #eff6ff;
    --callout-info-color: #1e40af;
    --callout-success-bg: #f0fdf4;
    --callout-success-color: #166534;
    --callout-warning-bg: #fffbeb;
    --callout-warning-color: #92400e;
    --callout-danger-bg: #fef2f2;
    --callout-danger-color: #991b1b;
    --screenshot-bg: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    --code-bg: #f1f5f9;
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
    --primary: #93c5fd;
    --primary-light: #60a5fa;
    --primary-dark: #1e293b;
    --primary-bg: #1e293b;
    --accent: #38bdf8;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --text-muted: #64748b;
    --bg: #1e293b;
    --bg-gray: #0f172a;
    --bg-sidebar: #020617;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,.3), 0 2px 4px rgba(0,0,0,.2);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.3), 0 4px 6px rgba(0,0,0,.2);
    --topbar-bg: rgba(30,41,59,.92);
    --hover-bg: #334155;
    --callout-info-bg: rgba(59,130,246,.12);
    --callout-info-color: #93c5fd;
    --callout-success-bg: rgba(16,185,129,.12);
    --callout-success-color: #6ee7b7;
    --callout-warning-bg: rgba(245,158,11,.12);
    --callout-warning-color: #fcd34d;
    --callout-danger-bg: rgba(239,68,68,.12);
    --callout-danger-color: #fca5a5;
    --screenshot-bg: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
    --code-bg: #334155;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { font-family: 'Krub', sans-serif; color: var(--text); background: var(--bg-gray); line-height: 1.7; font-size: var(--font-size); transition: background .3s, color .3s; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--bg-sidebar); color: #fff;
    overflow-y: auto; z-index: 100; transition: transform .3s;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }
.sidebar-logo {
    padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    text-decoration: none; color: #fff;
}
.sidebar-logo .logo-img { width: 100%; max-width: 160px; height: auto; object-fit: contain; }
.sidebar-logo .logo-sub { font-size: 12px; color: var(--accent); font-weight: 500; letter-spacing: .5px; }
.sidebar-nav { padding: 16px 0; }
.nav-group { margin-bottom: 8px; }
.nav-group-title { padding: 8px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,.4); font-weight: 600; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 10px 20px;
    color: rgba(255,255,255,.7); text-decoration: none; font-size: 14px; font-weight: 500;
    transition: all .2s; border-left: 3px solid transparent;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-link.active { color: #fff; background: rgba(14,165,233,.2); border-left-color: var(--accent); }
.nav-link i { width: 18px; text-align: center; font-size: 14px; }

/* ===== MAIN ===== */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
    position: sticky; top: 0; background: var(--topbar-bg); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border); padding: 16px 32px;
    display: flex; align-items: center; justify-content: space-between; z-index: 50;
    transition: background .3s;
}
.topbar h1 { font-size: 20px; font-weight: 700; color: var(--text); display: none; }
.topbar .breadcrumb { font-size: 13px; color: var(--text-muted); }
.topbar .breadcrumb a { color: var(--accent); text-decoration: none; }
.hamburger { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text); padding: 4px; }
.content { padding: 32px; max-width: 960px; }

/* ===== TOOLBAR (Theme & Font) ===== */
.doc-toolbar { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.doc-toolbar .tb-group {
    display: flex; align-items: center; gap: 2px;
    background: var(--bg-gray); border: 1px solid var(--border);
    border-radius: 8px; padding: 2px;
}
.doc-toolbar .tb-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px; border: none;
    background: transparent; color: var(--text-light); cursor: pointer;
    font-size: 14px; font-weight: 600; transition: all .2s;
    font-family: 'Krub', sans-serif;
}
.doc-toolbar .tb-btn:hover { background: var(--border); color: var(--text); }
.doc-toolbar .tb-btn.active { background: var(--accent); color: #fff; }
.doc-toolbar .tb-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.doc-toolbar .tb-size-label {
    font-size: 11px; color: var(--text-muted); font-weight: 600;
    min-width: 28px; text-align: center; user-select: none;
}

/* ===== TYPOGRAPHY ===== */
.page-title { font-size: 32px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.page-desc { font-size: 16px; color: var(--text-light); margin-bottom: 32px; }
h2 { font-size: 24px; font-weight: 700; margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border); color: var(--text); }
h2:first-child { margin-top: 0; }
h3 { font-size: 18px; font-weight: 600; margin: 28px 0 12px; color: var(--text); }
p { margin-bottom: 16px; }

/* ===== CARDS ===== */
.card { background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; border: 1px solid var(--border); }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ===== FEATURE GRID ===== */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 32px; }
.feature-card {
    background: var(--bg); border-radius: var(--radius); padding: 24px;
    border: 1px solid var(--border); box-shadow: var(--shadow); text-decoration: none;
    color: var(--text); transition: all .25s; display: flex; flex-direction: column;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.feature-card .fc-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; margin-bottom: 16px;
}
.fc-icon.blue { background: #dbeafe; color: #2563eb; }
.fc-icon.green { background: #d1fae5; color: #059669; }
.fc-icon.orange { background: #fef3c7; color: #d97706; }
.fc-icon.red { background: #fee2e2; color: #dc2626; }
.fc-icon.purple { background: #ede9fe; color: #7c3aed; }
.fc-icon.teal { background: #ccfbf1; color: #0d9488; }
.fc-icon.pink { background: #fce7f3; color: #db2777; }
.fc-icon.indigo { background: #e0e7ff; color: #4f46e5; }
.fc-icon.sky { background: #e0f2fe; color: #0284c7; }
.fc-icon.slate { background: #f1f5f9; color: #475569; }
.feature-card .fc-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.feature-card .fc-desc { font-size: 14px; color: var(--text-light); line-height: 1.5; flex: 1; }

/* ===== STEPS ===== */
.steps { margin: 20px 0 28px; counter-reset: step; }
.step { display: flex; gap: 16px; margin-bottom: 20px; position: relative; }
.step::before {
    counter-increment: step; content: counter(step); flex-shrink: 0;
    width: 32px; height: 32px; background: var(--accent); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.step-content { flex: 1; padding-top: 4px; }
.step-content strong { display: block; margin-bottom: 4px; }

/* ===== CALLOUTS ===== */
.callout { padding: 16px 20px; border-radius: 8px; margin: 16px 0; font-size: 14px; display: flex; gap: 12px; align-items: flex-start; transition: background .3s, color .3s; }
.callout i { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.callout-info { background: var(--callout-info-bg); border-left: 4px solid var(--info); color: var(--callout-info-color); }
.callout-success { background: var(--callout-success-bg); border-left: 4px solid var(--success); color: var(--callout-success-color); }
.callout-warning { background: var(--callout-warning-bg); border-left: 4px solid var(--warning); color: var(--callout-warning-color); }
.callout-danger { background: var(--callout-danger-bg); border-left: 4px solid var(--danger); color: var(--callout-danger-color); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; margin: 16px 0 24px; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--bg-gray); font-weight: 600; text-align: left; padding: 12px 16px; border-bottom: 2px solid var(--border); white-space: nowrap; transition: background .3s; }
td { padding: 10px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--hover-bg); }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-dev { background: rgba(250,204,21,.12); color: #a16207; }

/* ===== CODE ===== */
code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; color: var(--primary); }
kbd { background: var(--code-bg); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 2px 6px; font-size: 12px; color: var(--text); }

/* ===== LISTS ===== */
ul, ol { margin: 8px 0 16px 24px; }
li { margin-bottom: 6px; }

/* ===== SCREENSHOT PLACEHOLDER ===== */
.screenshot {
    background: var(--screenshot-bg); border-radius: 8px;
    padding: 60px 32px; text-align: center; color: var(--primary);
    margin: 16px 0 24px; border: 2px dashed var(--accent); font-size: 14px;
    transition: background .3s;
}
.screenshot i { font-size: 40px; margin-bottom: 8px; display: block; }

/* ===== PAGE NAV ===== */
.page-nav { display: flex; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.page-nav a {
    flex: 1; display: block; padding: 16px 20px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none;
    color: var(--text); transition: all .2s;
}
.page-nav a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.page-nav .pn-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.page-nav .pn-title { font-weight: 600; font-size: 15px; }
.page-nav .pn-next { text-align: right; }

/* ===== ROLE TAGS ===== */
.role-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.role-admin { background: #fee2e2; color: #991b1b; }
.role-staff { background: #e0e7ff; color: #3730a3; }
.role-dentist { background: #d1fae5; color: #065f46; }
.role-cashier { background: #fef3c7; color: #92400e; }

/* ===== FLOW ===== */
.flow { display: flex; align-items: center; gap: 0; margin: 20px 0 28px; flex-wrap: wrap; justify-content: center; }
.flow-step { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 600; text-align: center; min-width: 100px; }
.flow-arrow { color: var(--accent); font-size: 20px; padding: 0 8px; }

/* ===== FOOTER ===== */
.doc-footer { text-align: center; padding: 40px 0 20px; color: var(--text-muted); font-size: 13px; }
.doc-footer img { max-width: 80px; display: block; margin: 0 auto 8px; }

/* ===== DARK SIDEBAR ===== */
[data-theme="dark"] .sidebar { background: var(--bg-sidebar); }
[data-theme="dark"] .sidebar-logo .logo-sub { color: var(--accent); }
[data-theme="dark"] .nav-link.active { background: rgba(56,189,248,.15); }

/* ===== DARK BADGES ===== */
[data-theme="dark"] .badge-blue { background: rgba(59,130,246,.2); color: #93c5fd; }
[data-theme="dark"] .badge-green { background: rgba(16,185,129,.2); color: #6ee7b7; }
[data-theme="dark"] .badge-orange { background: rgba(245,158,11,.2); color: #fcd34d; }
[data-theme="dark"] .badge-red { background: rgba(239,68,68,.2); color: #fca5a5; }
[data-theme="dark"] .badge-gray { background: rgba(100,116,139,.2); color: #94a3b8; }
[data-theme="dark"] .badge-purple { background: rgba(124,58,237,.2); color: #c4b5fd; }
[data-theme="dark"] .badge-dev { background: rgba(250,204,21,.1); color: #fcd34d; }

/* ===== DARK FEATURE CARDS ===== */
[data-theme="dark"] .feature-card:hover { border-color: var(--accent); box-shadow: 0 10px 15px rgba(0,0,0,.3); }
[data-theme="dark"] .fc-icon.blue { background: rgba(37,99,235,.2); }
[data-theme="dark"] .fc-icon.green { background: rgba(5,150,105,.2); }
[data-theme="dark"] .fc-icon.orange { background: rgba(217,119,6,.2); }
[data-theme="dark"] .fc-icon.red { background: rgba(220,38,38,.2); }
[data-theme="dark"] .fc-icon.purple { background: rgba(124,58,237,.2); }
[data-theme="dark"] .fc-icon.teal { background: rgba(13,148,136,.2); }
[data-theme="dark"] .fc-icon.pink { background: rgba(219,39,119,.2); }
[data-theme="dark"] .fc-icon.indigo { background: rgba(79,70,229,.2); }
[data-theme="dark"] .fc-icon.sky { background: rgba(2,132,199,.2); }
[data-theme="dark"] .fc-icon.slate { background: rgba(71,85,105,.2); }

/* ===== DARK FLOW ===== */
[data-theme="dark"] .flow-step { background: var(--bg); border-color: var(--border); color: var(--text); }

/* ===== DARK PAGE NAV ===== */
[data-theme="dark"] .page-nav a { background: var(--bg); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .page-nav a:hover { border-color: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }
    .overlay.show { display: block; }
    .main { margin-left: 0; }
    .hamburger { display: block; }
    .topbar { padding: 12px 16px; }
    .topbar h1 { display: none; }
    .content { padding: 20px 16px; }
    .feature-grid { grid-template-columns: 1fr; }
    .page-nav { flex-direction: column; }
    .doc-toolbar .tb-btn { width: 28px; height: 28px; font-size: 12px; }
}
