/* Docs Webapp — Style */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #333; }

/* Login */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #f0f4f8; }
.login-card { background: #fff; padding: 2.5rem 2rem; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.1); text-align: center; width: 360px; }
.login-card h1 { font-size: 1.3rem; color: #1a56db; letter-spacing: 1px; }
.login-form label, #login-form label { display: block; text-align: left; font-size: .85rem; color: #555; margin-bottom: .3rem; }
#pin { width: 100%; padding: .7rem; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 1.1rem; letter-spacing: 3px; text-align: center; outline: none; transition: border .2s; }
#pin:focus { border-color: #1a56db; }
#login-form button { width: 100%; padding: .7rem; margin-top: 1rem; background: #1a56db; color: #fff; border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; transition: background .2s; }
#login-form button:hover { background: #1547b3; }
.error-msg { color: #e53e3e; font-size: .85rem; margin-top: .5rem; min-height: 1.2em; }

/* Layout — sidebar + content */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: #1e293b; color: #cbd5e0; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-header { padding: 1.25rem 1rem .75rem; border-bottom: 1px solid #334155; }
.sidebar-header h1 { font-size: .95rem; color: #fff; letter-spacing: 1px; }
.sidebar-search { padding: .75rem 1rem; }
.sidebar-search input { width: 100%; padding: .5rem .75rem; border: 1px solid #475569; border-radius: 6px; background: #0f172a; color: #e2e8f0; font-size: .85rem; outline: none; }
.sidebar-search input:focus { border-color: #1a56db; }
.sidebar-search input::placeholder { color: #64748b; }

/* Feature menu */
.feature-menu { flex: 1; overflow-y: auto; padding: .5rem 0; }
.feature-menu::-webkit-scrollbar { width: 6px; }
.feature-menu::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.menu-item { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; cursor: pointer; transition: background .15s; border-left: 3px solid transparent; }
.menu-item:hover { background: #334155; }
.menu-item.active { background: #1a56db; color: #fff; border-left-color: #60a5fa; }
.menu-num { font-size: .75rem; font-weight: 700; color: #64748b; min-width: 22px; }
.menu-item.active .menu-num { color: #93c5fd; }
.menu-name { flex: 1; font-size: .85rem; }
.menu-badge { background: #334155; color: #94a3b8; font-size: .7rem; padding: .1rem .4rem; border-radius: 4px; }
.menu-item.active .menu-badge { background: rgba(255,255,255,.2); color: #fff; }
.menu-empty { padding: 1rem; text-align: center; color: #64748b; font-size: .85rem; }

/* Sidebar footer */
.sidebar-footer { padding: .75rem 1rem; border-top: 1px solid #334155; display: flex; flex-direction: column; gap: .5rem; }
.stats { font-size: .75rem; color: #64748b; }
#logout-btn { background: none; border: 1px solid #475569; color: #94a3b8; padding: .4rem .75rem; border-radius: 6px; cursor: pointer; font-size: .8rem; }
#logout-btn:hover { border-color: #e53e3e; color: #e53e3e; }

/* Content area */
.content { flex: 1; padding: 1.5rem 2rem; overflow-y: auto; max-height: 100vh; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60vh; text-align: center; }
.empty-state p { font-size: 1.1rem; color: #4a5568; }
.empty-state .muted { font-size: .9rem; color: #a0aec0; margin-top: .5rem; }
.loading { color: #999; font-style: italic; }

/* Doc header */
.doc-header { margin-bottom: 1rem; border-bottom: 2px solid #e2e8f0; padding-bottom: .75rem; }
.doc-title-row { display: flex; align-items: center; justify-content: space-between; }
.doc-header h2 { font-size: 1.3rem; color: #1a56db; }
.open-product { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; padding: .3rem .75rem; border-radius: 6px; font-size: .85rem; text-decoration: none; transition: all .2s; }
.open-product:hover { background: #dcfce7; border-color: #4ade80; }
.doc-info { font-size: .85rem; color: #64748b; margin-top: .3rem; }
.doc-info code { background: #f1f5f9; padding: .15rem .4rem; border-radius: 4px; font-size: .8rem; font-family: 'SF Mono', Consolas, monospace; }

/* Tabs + Actions */
.tabs-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; border-bottom: 2px solid #f0f0f0; }
.tabs { display: flex; gap: .5rem; }
.tab { padding: .5rem 1rem; background: #f7f7f7; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 6px 6px 0 0; cursor: pointer; font-size: .85rem; color: #666; transition: all .2s; }
.tab:hover { background: #eee; }
.tab.active { background: #1a56db; color: #fff; border-bottom-color: #1a56db; }
.doc-actions { display: flex; gap: .5rem; padding-bottom: .4rem; }
.action-btn { padding: .35rem .7rem; border: 1px solid #cbd5e0; border-radius: 6px; background: #fff; cursor: pointer; font-size: .8rem; color: #4a5568; transition: all .2s; }
.action-btn:hover { border-color: #1a56db; color: #1a56db; background: #ebf4ff; }

/* Doc content */
.doc-body { line-height: 1.7; font-size: .9rem; }
.doc-body h1 { font-size: 1.4rem; color: #1a56db; margin: 1rem 0 .5rem; }
.doc-body h2 { font-size: 1.15rem; color: #2d3748; margin: 1.5rem 0 .5rem; border-bottom: 1px solid #eee; padding-bottom: .25rem; }
.doc-body h3 { font-size: 1rem; color: #4a5568; margin: 1rem 0 .4rem; }
.doc-body p { margin: .5rem 0; }
.doc-body table { width: 100%; border-collapse: collapse; margin: .5rem 0; font-size: .85rem; overflow-x: auto; display: block; }
.doc-body th { background: #f7fafc; padding: .5rem .75rem; text-align: left; border: 1px solid #e2e8f0; font-weight: 600; white-space: nowrap; }
.doc-body td { padding: .4rem .75rem; border: 1px solid #e2e8f0; vertical-align: top; }
.doc-body code { background: #f1f5f9; padding: .15rem .4rem; border-radius: 4px; font-size: .85em; font-family: 'SF Mono', Consolas, monospace; }
.doc-body pre { background: #f1f5f9; padding: .75rem; border-radius: 8px; overflow-x: auto; font-size: .8rem; }
.doc-body img { max-width: 100%; height: auto; margin: 1rem 0; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.doc-body ul, .doc-body ol { margin: .5rem 0 .5rem 1.5rem; }
.doc-body li { margin: .25rem 0; }
.doc-body strong { color: #2d3748; }
.doc-body hr { border: none; border-top: 1px solid #eee; margin: 1rem 0; }
.doc-body blockquote { border-left: 4px solid #1a56db; padding-left: 1rem; color: #666; margin: .5rem 0; }

/* Screenshots */
.screenshots { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid #eee; font-size: .8rem; color: #888; word-break: break-all; }
.shot-link { color: #1a56db; text-decoration: none; margin-right: .5rem; }
.shot-link:hover { text-decoration: underline; }

/* Mobile responsive */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; max-height: 200px; overflow-y: auto; }
  .content { max-height: none; padding: 1rem; }
  .tabs-row { flex-direction: column; align-items: stretch; gap: .5rem; }
  .doc-actions { justify-content: flex-end; }
}
