/* Svashasan Developer Hub. Light/dark page chrome follows the site's theme switch
   (scripts/theme.js sets html.svh-dark); the console panels are always dark. */

:root {
    --bg: #FFFFFF;
    --fg: #111827;
    --muted: #6B7280;
    --border: #E5E7EB;
    --surface: #F9FAFB;
    --link: #2563EB;
    --navy: #1E1A4D;
    --orange: #F26A1B;
    --console: #0F1424;
    --console-2: #141A2E;
    --console-3: #1B2340;
    --console-border: #273052;
    --console-fg: #E6E9F2;
    --console-muted: #8C95B3;
    --ok: #22C55E;
    --warn: #F59E0B;
    --err: #EF4444;
}
html.svh-dark {
    --bg: #0F1115;
    --fg: #E5E7EB;
    --muted: #9AA1AD;
    --border: #22262E;
    --surface: #15181D;
    --link: #93C5FD;
    color-scheme: dark;
}
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; padding-top: 5.5rem; }
a { color: inherit; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--navy); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---- header (same geometry as svashasan.com; colours via variables so dark mode works) */
.ph-header { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 1px 2px rgba(0,0,0,.05); border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.ph-brand { color: var(--navy); }
html.svh-dark .ph-brand { color: #C7C9FF; }
.ph-nav { color: var(--muted); }
.ph-nav a { transition: color .2s; }
.ph-nav a:hover, .ph-nav a[aria-current="page"] { color: var(--fg); font-weight: 700; }
header .header-right-group svg, header .header-right-group svg * { stroke-width: 1.5; }
header .header-right-group > a, header .header-right-group > button { width: 34px !important; height: 34px !important; padding: 0 !important; color: var(--fg); }
header .header-right-group > a:hover, header .header-right-group > button:hover { color: var(--link); }
header .header-right-group svg { width: 20px !important; height: 20px !important; }
header .header-right-group { gap: 2px !important; }
.sim-badge { display: inline-flex; align-items: center; margin-right: 10px; padding: 3px 8px; border-radius: 9999px; border: 1px solid var(--orange); color: var(--orange); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
body.no-sim-badge .sim-badge { display: none; }
@media (max-width: 400px) { .sim-badge { font-size: 9px; padding: 2px 5px; margin-right: 4px; } }

/* ---- mobile menu (same behaviour as the site pages) */
#mobile-menu { background: var(--bg); color: var(--fg); visibility: hidden; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: opacity .35s ease-out, transform .35s ease-out, visibility 0s linear .35s; display: flex; padding-top: 5rem; }
#mobile-menu.active { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition: opacity .35s ease-out, transform .35s ease-out, visibility 0s; }
#mobile-menu a:hover { color: var(--link); }
@media (min-width: 1024px) { #mobile-menu { display: none !important; } }
#mobile-menu { overflow-y: auto; justify-content: flex-start; padding-bottom: 2rem; }
/* Tools dropdown in the desktop nav (details/summary: keyboard and touch work natively) */
.ph-dd { position: relative; }
.ph-dd > details > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color .2s; }
.ph-dd > details > summary::-webkit-details-marker { display: none; }
.ph-dd > details > summary:hover, .ph-dd > details[open] > summary, .ph-dd > details > summary[aria-current="page"] { color: var(--fg); font-weight: 700; }
.ph-dd > details[open] > summary svg { transform: rotate(180deg); }
.ph-dd-menu { position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%); min-width: 230px; padding: 6px; margin: 0; list-style: none;
  background: var(--bg); border: 1px solid var(--border, rgba(23, 26, 32, .12)); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .12); z-index: 60; }
.ph-dd-menu a { display: block; padding: 8px 12px; border-radius: 8px; font-weight: 500; color: var(--muted); }
.ph-dd-menu a:hover, .ph-dd-menu a[aria-current="page"] { background: rgba(127, 127, 127, .12); color: var(--fg); font-weight: 600; }
.ph-dd-sep { border-top: 1px solid var(--border, rgba(23, 26, 32, .12)); margin-top: 4px; padding-top: 4px; }

/* ---- page typography & components */
.ph-container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 768px) { .ph-container { padding: 0 1.5rem; } }
.ph-h1 { font-size: 2.25rem; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
@media (min-width: 768px) { .ph-h1 { font-size: 3rem; } }
.ph-h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.ph-muted { color: var(--muted); }
.ph-card { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; padding: 1.25rem; }
.ph-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .625rem 1.1rem; border-radius: .75rem; font-weight: 600; font-size: .9375rem; border: 1px solid transparent; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; white-space: nowrap; }
.ph-btn-primary { background: var(--navy); color: #fff; }
.ph-btn-primary:hover { background: #2A2566; }
html.svh-dark .ph-btn-primary { background: #4F46E5; }
html.svh-dark .ph-btn-primary:hover { background: #6366F1; }
.ph-btn-accent { background: var(--orange); color: #fff; }
.ph-btn-accent:hover { background: #D9560F; }
.ph-btn-ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.ph-btn-ghost:hover { border-color: var(--muted); }
.ph-btn[disabled] { opacity: .5; cursor: not-allowed; }
.ph-btn-sm { padding: .375rem .75rem; font-size: .8125rem; border-radius: .5rem; }
.ph-input { width: 100%; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: .625rem; background: var(--bg); color: var(--fg); font-size: .9375rem; }
.ph-input:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
html.svh-dark .ph-input:focus { outline-color: #A5B4FC; }
.ph-label { display: block; font-size: .8125rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.ph-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ph-table th, .ph-table td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.ph-table th { font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.ph-notice { border-left: 4px solid var(--orange); background: color-mix(in srgb, var(--orange) 8%, var(--bg)); padding: .875rem 1rem; border-radius: .5rem; font-size: .9375rem; }
.ph-pill { display: inline-block; padding: .125rem .5rem; border-radius: 9999px; font-size: .75rem; font-weight: 600; border: 1px solid var(--border); color: var(--muted); }
.ph-pill-ok { color: #15803D; border-color: #86EFAC; background: #F0FDF4; }
.ph-pill-warn { color: #B45309; border-color: #FCD34D; background: #FFFBEB; }
.ph-pill-err { color: #B91C1C; border-color: #FCA5A5; background: #FEF2F2; }
html.svh-dark .ph-pill-ok { background: #052E16; border-color: #166534; color: #86EFAC; }
html.svh-dark .ph-pill-warn { background: #451A03; border-color: #92400E; color: #FCD34D; }
html.svh-dark .ph-pill-err { background: #450A0A; border-color: #991B1B; color: #FCA5A5; }
code.ph-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; background: var(--surface); border: 1px solid var(--border); border-radius: .375rem; padding: .1rem .35rem; }

/* ---- method badges */
.method { display: inline-block; min-width: 3.4rem; text-align: center; padding: .15rem .45rem; border-radius: .375rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; font-weight: 700; letter-spacing: .04em; }
.method-get { background: #DCFCE7; color: #166534; }
.method-post { background: #DBEAFE; color: #1E40AF; }
.method-delete { background: #FEE2E2; color: #991B1B; }
html.svh-dark .method-get, .console .method-get { background: #14532D; color: #BBF7D0; }
html.svh-dark .method-post, .console .method-post { background: #1E3A8A; color: #BFDBFE; }
html.svh-dark .method-delete, .console .method-delete { background: #7F1D1D; color: #FECACA; }

/* ---- console (always dark, engineering look) */
.console { background: var(--console); color: var(--console-fg); border: 1px solid var(--console-border); border-radius: 1rem; }
.console-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--console-border); font-size: .8125rem; color: var(--console-muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.console-body { padding: 1rem; }
.console .ph-input, .console select.ph-input, .console textarea.ph-input { background: var(--console-2); border-color: var(--console-border); color: var(--console-fg); }
.console .ph-input:focus { outline-color: #818CF8; }
.console .ph-label { color: var(--console-muted); }
.console a { color: #A5B4FC; }
.console .ph-table th, .console .ph-table td { border-color: var(--console-border); }
.console .ph-table th { color: var(--console-muted); }
.console-list button { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .5rem .75rem; border-radius: .5rem; text-align: left; font-size: .875rem; color: var(--console-fg); background: transparent; border: 1px solid transparent; }
.console-list button:hover { background: var(--console-2); }
.console-list button[aria-current="true"] { background: var(--console-3); border-color: var(--console-border); }
.console-list .path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8125rem; }
.console-list .tag { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--console-muted); padding: .75rem .75rem .25rem; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8125rem; }
.status-code { font-weight: 700; padding: .1rem .5rem; border-radius: .375rem; }
.status-2xx { background: #14532D; color: #BBF7D0; }
.status-4xx { background: #7C2D12; color: #FED7AA; }
.status-5xx, .status-0 { background: #7F1D1D; color: #FECACA; }

/* ---- JSON viewer (json-viewer.ts) */
.json { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; line-height: 1.55; white-space: pre; overflow: auto; margin: 0; tab-size: 2; }
.json .k { color: #93C5FD; }
.json .s { color: #FDBA74; }
.json .n { color: #86EFAC; }
.json .b { color: #C4B5FD; }
.json .z { color: #9CA3AF; font-style: italic; }
.json .p { color: #8C95B3; }

/* ---- code examples */
.code-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--console-border); padding: 0 .5rem; }
.code-tabs button { padding: .6rem .9rem; font-size: .8125rem; font-weight: 600; color: var(--console-muted); border-bottom: 2px solid transparent; }
.code-tabs button[aria-selected="true"] { color: var(--console-fg); border-bottom-color: var(--orange); }
pre.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; line-height: 1.55; white-space: pre; overflow: auto; margin: 0; padding: 1rem; color: var(--console-fg); }
.copy-btn { font-size: .75rem; font-weight: 600; color: var(--console-muted); border: 1px solid var(--console-border); border-radius: .375rem; padding: .25rem .6rem; background: transparent; }
.copy-btn:hover { color: var(--console-fg); border-color: #6B7280; }
.copy-btn[data-copied="1"] { color: #86EFAC; border-color: #166534; }

/* ---- vehicle status cards */
.stat { background: var(--console-2); border: 1px solid var(--console-border); border-radius: .75rem; padding: .875rem 1rem; }
.stat .v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; color: var(--console-muted); font-weight: 700; margin-bottom: .35rem; }
.stat .u { font-size: .75rem; color: var(--console-muted); margin-left: .25rem; font-weight: 500; }
.mode-btn { padding: .5rem .9rem; border-radius: .625rem; border: 1px solid var(--console-border); background: var(--console-2); color: var(--console-fg); font-size: .8125rem; font-weight: 600; }
.mode-btn:hover { border-color: #6B7280; }
.mode-btn[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); color: #fff; }

/* ---- docs */
.doc-op { scroll-margin-top: 6rem; }
.doc-schema { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8125rem; }
.doc-toc a { display: block; padding: .3rem .5rem; border-radius: .375rem; font-size: .875rem; color: var(--muted); }
.doc-toc a:hover { background: var(--surface); color: var(--fg); }

/* ---- modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 60; }
.modal { background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 1rem; max-width: 36rem; width: 100%; padding: 1.5rem; }

/* ---- footer in dark mode (same rules as svashasan.com's dark-mode.css) */
html.svh-dark .site-footer { background: #0B0D10; border-top-color: #22262E; color: #D1D5DB; }
html.svh-dark .site-footer .sf-heading, html.svh-dark .site-footer .sf-toggle { color: #F3F4F6; }
html.svh-dark .site-footer .sf-toggle:hover { color: #FFFFFF; }
html.svh-dark .site-footer .sf-toggle-icon { color: #9AA1AD; }
html.svh-dark .site-footer a { color: #AAB0BB; }
html.svh-dark .site-footer a:hover { color: #FFFFFF; }
html.svh-dark .site-footer a:focus-visible { outline-color: #A5B4FC; }
html.svh-dark .site-footer .sf-brand p, html.svh-dark .site-footer .sf-copy { color: #9AA1AD; }
html.svh-dark .site-footer .sf-bottom, html.svh-dark .site-footer .sf-col, html.svh-dark .site-footer .sf-brand + .sf-col { border-color: #22262E; }
html.svh-dark .site-footer .sf-social a:hover { background: #1F232B; }
html.svh-dark .site-footer .sf-wordmark g { fill: #171A20; }
html.svh-dark .theme-switch { background: #15181D; border-color: #2F3540; color: #D1D5DB; }
html.svh-dark .theme-switch:hover { border-color: #6B7280; color: #FFFFFF; }
html.svh-dark img[src$="/linkedin.svg"], html.svh-dark img[src$="/twitter.svg"], html.svh-dark img[src$="/youtube.svg"], html.svh-dark img[src$="/github.svg"], html.svh-dark img[src$="/whatsapp.svg"] { filter: invert(1); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } #mobile-menu { transition: none; } }
