/* Product Documentation Portal - single stylesheet, no framework. */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #d9dce1;
    --text: #1f2430;
    --text-muted: #5d6675;
    --accent: #1f4e79;
    --accent-dark: #163a5a;
    --ok-bg: #e7f4ea;
    --ok-text: #1d6b33;
    --err-bg: #fdeaea;
    --err-text: #a32020;
    --warn-bg: #fdf5e3;
    --warn-text: #8a6100;
    --code-bg: #f1f3f6;
    --radius: 6px;
    --max-content: 900px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4 { line-height: 1.25; color: #16202e; }
h1 { font-size: 1.7rem; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 .6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.08rem; margin: 1.5rem 0 .4rem; }

p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: .3rem; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Keyboard users can jump straight to the content. */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #fff;
    color: var(--accent);
    padding: .5rem .8rem;
    z-index: 10;
}
.skip-link:focus { left: .5rem; top: .5rem; }

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.25rem;
    background: var(--accent);
    color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar-brand { font-weight: 600; display: flex; flex-direction: column; }
.topbar-product { font-size: .78rem; font-weight: 400; opacity: .85; }
.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .9rem;
}
.user-name { opacity: .9; }
.inline-form { display: inline; margin: 0; }

.nav-toggle {
    display: none;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: var(--radius);
    padding: .35rem .7rem;
    font-size: .85rem;
    cursor: pointer;
}

/* ---------- Documentation shell ---------- */
.docs-shell {
    display: flex;
    align-items: flex-start;
    gap: 0;
    min-height: calc(100vh - 120px);
}
.sidebar-wrap {
    flex: 0 0 265px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    min-height: calc(100vh - 120px);
}
.sidebar { padding: 1.1rem 1rem; position: sticky; top: 0; }
.sidebar-search input[type="search"] {
    width: 100%;
    padding: .45rem .55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
}
.search-empty { font-size: .82rem; color: var(--text-muted); margin: .5rem 0 0; }

.nav-sections { list-style: none; margin: 1rem 0 0; padding: 0; }
.nav-sections ul { list-style: none; margin: 0; padding: 0; }
.nav-section { margin-bottom: 1.1rem; }
.nav-section-title {
    margin: 0 0 .35rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.nav-page {
    display: block;
    padding: .3rem .5rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: .92rem;
}
.nav-page:hover { background: var(--code-bg); }
.nav-page.is-active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.doc-content, .app-content {
    flex: 1 1 auto;
    max-width: var(--max-content);
    padding: 1.6rem 2rem 3rem;
    min-width: 0;
}
.app-content { margin: 0 auto; }

/* ---------- Cards / auth pages ---------- */
.page-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    min-height: 70vh;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.6rem;
    width: 100%;
}
.card-narrow { max-width: 460px; }
.card-wide { max-width: 100%; }
.auth-brand {
    margin: 0 0 .2rem;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.error-code { font-size: 2.6rem; font-weight: 700; color: var(--accent); margin: 0; }

/* ---------- Forms ---------- */
label {
    display: block;
    margin: .9rem 0 .25rem;
    font-size: .88rem;
    font-weight: 600;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"] {
    width: 100%;
    padding: .55rem .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, button:focus, a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.field-hint { font-size: .8rem; color: var(--text-muted); margin: .25rem 0 0; }
.field-error { color: var(--err-text); font-size: .85rem; margin: .3rem 0 0; }

.btn {
    display: inline-block;
    padding: .55rem 1.1rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: .92rem;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn-block { display: block; width: 100%; margin-top: 1.2rem; }
.btn-small { padding: .3rem .7rem; font-size: .82rem; }
.btn-secondary { background: #fff; color: var(--accent); }
.btn-secondary:hover { background: var(--code-bg); color: var(--accent-dark); }
.btn-danger { background: #a32020; border-color: #a32020; }
.btn-danger:hover { background: #831919; }
.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    padding: .2rem 0;
    font-size: .82rem;
    cursor: pointer;
    text-decoration: underline;
}

.captcha-box { margin-top: 1rem; }
.captcha-image {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.form-footer { margin-top: 1.2rem; font-size: .9rem; }

/* ---------- Alerts ---------- */
.alert {
    padding: .7rem .9rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: .92rem;
    margin: 0 0 1rem;
}
.alert-success { background: var(--ok-bg); border-color: #b8dfc2; color: var(--ok-text); }
.alert-error   { background: var(--err-bg); border-color: #f0c2c2; color: var(--err-text); }
.alert-info    { background: #e8effa; border-color: #c3d4ee; color: #1f4e79; }
.alert-warning { background: var(--warn-bg); border-color: #ecd9a4; color: var(--warn-text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 1.6rem; }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: .92rem;
}
th, td {
    border: 1px solid var(--border);
    padding: .5rem .65rem;
    text-align: left;
    vertical-align: top;
}
th { background: var(--code-bg); font-weight: 600; }
tbody tr:hover { background: #fafbfc; }
.table-empty { color: var(--text-muted); font-style: italic; }

.badge {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-pending  { background: var(--warn-bg); color: var(--warn-text); }
.badge-approved { background: var(--ok-bg); color: var(--ok-text); }
.badge-rejected { background: var(--err-bg); color: var(--err-text); }
.badge-inactive { background: #e9ebef; color: var(--text-muted); }

/* ---------- Code & documentation content ---------- */
code, pre, kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .88em;
}
code {
    background: var(--code-bg);
    padding: .1rem .3rem;
    border-radius: 3px;
}
pre {
    background: #1f2430;
    color: #e6e9ef;
    padding: .9rem 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.45;
}
pre code { background: none; padding: 0; color: inherit; }

blockquote {
    margin: 0 0 1rem;
    padding: .7rem 1rem;
    background: #e8effa;
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.note, .warning {
    padding: .8rem 1rem;
    border-radius: var(--radius);
    margin: 0 0 1.2rem;
    font-size: .93rem;
}
.note { background: #e8effa; border-left: 4px solid var(--accent); }
.warning { background: var(--warn-bg); border-left: 4px solid #d9a406; }

.doc-meta {
    font-size: .82rem;
    color: var(--text-muted);
    margin: -.5rem 0 1.5rem;
}
.doc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}
.doc-cards li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    margin: 0;
}
.doc-cards h3 { margin: 0 0 .3rem; font-size: 1rem; }
.doc-cards p { margin: 0; font-size: .88rem; color: var(--text-muted); }

.page-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: .9rem;
}

/* ---------- Footer ---------- */
.site-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .82rem;
}
.site-footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .docs-shell { flex-direction: column; }
    .nav-toggle { display: inline-block; }
    .sidebar-wrap {
        display: none;
        flex-basis: auto;
        width: 100%;
        min-height: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-wrap.is-open { display: block; }
    .sidebar { position: static; }
    .doc-content, .app-content { padding: 1.2rem 1.1rem 2.5rem; }
    .topbar-user { width: 100%; margin-left: 0; flex-wrap: wrap; gap: .75rem; }
}

@media print {
    .topbar, .sidebar-wrap, .site-footer, .page-nav { display: none; }
    .doc-content { max-width: none; padding: 0; }
    body { background: #fff; }
}
