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

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --primary-bg: #f5f3ff;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --info: #3b82f6;
    --warning: #f59e0b;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --bg: #ffffff;
    --bg-gray: #f8fafc;
    --bg-sidebar: #1e1b4b;
    --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;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: 'Sarabun', sans-serif;
    color: var(--text);
    background: var(--bg-gray);
    line-height: 1.7;
    font-size: 16px;
}

/* ===== 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: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
}
.sidebar-logo .logo-img {
    width: 100%;
    max-width: 180px;
    height: auto;
    object-fit: contain;
}
.sidebar-logo .logo-sub {
    font-size: 12px;
    color: var(--primary-light);
    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(124,58,237,.3);
    border-left-color: var(--primary-light);
}
.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: .8;
}
.nav-link .nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,.9);
    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;
}
.topbar h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}
.topbar .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
}
.topbar .breadcrumb a {
    color: var(--primary);
    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;
}

/* ===== 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;
}
.card-title .icon { font-size: 22px; }

/* ===== 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(--primary-light);
}
.feature-card .fc-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}
.feature-card .fc-icon.purple { background: #ede9fe; color: var(--primary); }
.feature-card .fc-icon.blue { background: #dbeafe; color: #2563eb; }
.feature-card .fc-icon.green { background: #d1fae5; color: #059669; }
.feature-card .fc-icon.orange { background: #fef3c7; color: #d97706; }
.feature-card .fc-icon.red { background: #fee2e2; color: #dc2626; }
.feature-card .fc-icon.teal { background: #ccfbf1; color: #0d9488; }
.feature-card .fc-icon.indigo { background: #e0e7ff; color: #4f46e5; }
.feature-card .fc-icon.pink { background: #fce7f3; color: #db2777; }
.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(--primary);
    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; }

/* ===== ALERTS / CALLOUTS ===== */
.callout {
    padding: 16px 20px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.callout .co-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.callout-info { background: #eff6ff; border-left: 4px solid var(--info); color: #1e40af; }
.callout-success { background: #f0fdf4; border-left: 4px solid var(--success); color: #166534; }
.callout-warning { background: #fffbeb; border-left: 4px solid var(--warning); color: #92400e; }
.callout-danger { background: #fef2f2; border-left: 4px solid var(--danger); color: #991b1b; }

/* ===== 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;
}
td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ===== CODE ===== */
code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--primary-dark);
}
pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    margin: 12px 0 20px;
}
pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.badge-purple { background: #ede9fe; color: var(--primary-dark); }
.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; }

/* ===== KEYBOARD SHORTCUTS ===== */
kbd {
    background: #f1f5f9;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: 'SF Mono', monospace;
    color: var(--text);
}

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

/* ===== SCREENSHOT PLACEHOLDER ===== */
.screenshot {
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    border-radius: 8px;
    padding: 60px 32px;
    text-align: center;
    color: var(--primary-dark);
    margin: 16px 0 24px;
    border: 2px dashed var(--primary-light);
    font-size: 14px;
}
.screenshot .ss-icon { font-size: 40px; margin-bottom: 8px; }
.screenshot .ss-label { font-weight: 600; }

/* ===== NAVIGATION (PREV/NEXT) ===== */
.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(--primary-light);
    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: #fef3c7; color: #92400e; }
.role-cashier { background: #dbeafe; color: #1e40af; }
.role-stock { background: #d1fae5; color: #065f46; }
.role-report { background: #e0e7ff; color: #3730a3; }

/* ===== STATUS INDICATORS ===== */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}
.status::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
}
.status-active::before { background: var(--success); }
.status-inactive::before { background: var(--text-muted); }
.status-warning::before { background: var(--warning); }
.status-danger::before { background: var(--danger); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .hamburger { display: block; }
    .content { padding: 20px 16px; }
    .feature-grid { grid-template-columns: 1fr; }
    .page-nav { flex-direction: column; }
    .topbar { padding: 12px 16px; }
}

/* ===== OVERLAY (Mobile) ===== */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 90;
}
.overlay.show { display: block; }

/* ===== PRINT ===== */
@media print {
    .sidebar, .topbar, .hamburger, .page-nav { display: none; }
    .main { margin-left: 0; }
    .content { max-width: 100%; padding: 0; }
}

/* ===== FLOW DIAGRAM ===== */
.flow {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 20px 0 28px;
    flex-wrap: wrap;
    justify-content: center;
}
.flow-step {
    background: var(--primary-bg);
    border: 2px solid var(--primary-light);
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    min-width: 120px;
}
.flow-arrow {
    font-size: 20px;
    color: var(--primary-light);
    padding: 0 6px;
}

/* ===== PERMISSION MATRIX ===== */
.perm-check { color: var(--success); font-weight: 700; }
.perm-cross { color: var(--danger); font-weight: 700; }

/* ===== FOOTER ===== */
.doc-footer {
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
