/* Shared layout for the PintSize Cloud pages. Same look as the Cloud Client portal (PintSizeCloudClient styles/portal.css);
   the cloud-only additions are at the bottom. */
:root {
    --bg: #0d0e10;
    --panel: #17191c;
    --panel-2: #202328;
    --border: #2d3138;
    --text: #e9e9e9;
    --muted: #9aa0a8;
    --accent: #deab04;
    --accent-hover: #f0bd12;
    --accent-text: #141414;
    --danger: #c0392b;
    --danger-hover: #d64535;
    --nav-width: 230px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a { color: #7cc4ff; }

/* ---------- Layout ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidenav {
    width: var(--nav-width);
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidenav .brand {
    padding: 18px 18px 14px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .3px;
    border-bottom: 1px solid var(--border);
}

.sidenav .brand span { color: var(--accent); }

.sidenav .group { padding: 10px 0 4px; }

.sidenav .group-title {
    padding: 6px 18px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.sidenav a {
    display: block;
    padding: 8px 18px 8px 26px;
    color: var(--text);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidenav a:hover { background: var(--panel-2); }

.sidenav a.active {
    background: var(--panel-2);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.sidenav a.external::after {
    content: " \2197";
    color: var(--muted);
    font-size: 12px;
}

.sidenav .nav-footer {
    margin-top: auto;
    padding: 12px 18px 18px;
    border-top: 1px solid var(--border);
}

.sidenav .nav-footer a {
    padding: 6px 0;
    border: none;
    color: var(--muted);
}

.sidenav .nav-footer a:hover { background: none; color: var(--text); }

.main {
    flex: 1;
    min-width: 0;
    padding: 24px 32px 48px;
    max-width: 1100px;
}

.page-title {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 600;
}

.page-title .crumb { color: var(--muted); font-weight: 400; }

.topbar { display: none; }

/* Hash-selected sub pages inside one html file. */
.page { display: none; }
.page.active { display: block; }

/* ---------- Cards & fields ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 18px;
}

.card h2 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
}

.card h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.help {
    color: var(--muted);
    font-size: 13.5px;
    margin: 0 0 12px;
}

.field {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 10px;
}

.field > label { color: var(--muted); }

.field .value { font-weight: 600; }

input[type=text], input[type=password], input[type=number], select, textarea {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 7px 9px;
    font: inherit;
    max-width: 100%;
}

input[type=text], input[type=password], select { width: 320px; }
input[type=number] { width: 110px; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.button, .buttonsmall {
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 5px;
    padding: 8px 16px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.buttonsmall { padding: 4px 10px; font-size: 13px; }

.button:hover, .buttonsmall:hover { background: var(--accent-hover); }

.button.secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.button.secondary:hover { background: var(--panel-2); }

.button.danger { background: var(--danger); color: #fff; }
.button.danger:hover { background: var(--danger-hover); }

.button:disabled, .button[disabled], .buttonsmall:disabled {
    background: #555;
    color: #aaa;
    border-color: #555;
    cursor: default;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 18px;
}

.grid-2 .subpanel {
    background: var(--panel-2);
    border-radius: 6px;
    padding: 14px 16px;
}

.grid-2 .subpanel .field { grid-template-columns: 120px minmax(0, 1fr); }
.grid-2 > .card .field { grid-template-columns: 150px minmax(0, 1fr); }
.grid-2 .subpanel input[type=password], .grid-2 .subpanel select { width: 100%; }

.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    font-weight: 600;
}

.warning-box {
    color: #fff0f0;
    background: #4d0000;
    padding: 12px 14px;
    border: 1px solid #ff4d4d;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 18px;
}

.log-output {
    width: 100%;
    min-height: 420px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px;
    margin-top: 14px;
    white-space: pre;
}

table.datatable {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
}

table.datatable th, table.datatable td {
    border: 1px solid var(--border);
    padding: 6px 8px;
    text-align: left;
}

table.datatable thead th { background: var(--panel-2); }

.table-scroll { overflow-x: auto; }

/* Cloud sync result log */
.syncdetails summary { cursor: pointer; }

.syncerror summary {
    color: #ff8a80;
    font-weight: bold;
}

.syncdetails pre {
    margin: .25em 0 .5em 1.25em;
    padding: .5em;
    background-color: var(--bg);
    border-left: 3px solid #555;
    font-size: .8em;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 20em;
    overflow-y: auto;
}

/* ---------- Narrow screens: nav becomes a slide-out drawer ---------- */
@media (max-width: 800px) {
    .topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 20;
        background: var(--panel);
        border-bottom: 1px solid var(--border);
        padding: 10px 16px;
        font-weight: 700;
    }

    .topbar button {
        background: none;
        border: 1px solid var(--border);
        color: var(--text);
        border-radius: 5px;
        font-size: 18px;
        padding: 2px 10px;
        cursor: pointer;
    }

    .layout { display: block; }

    .sidenav {
        position: fixed;
        z-index: 30;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    body.nav-open .sidenav { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.6); }

    .main { padding: 16px; }

    .card { padding: 14px; }

    .field, .grid-2 .subpanel .field, .grid-2 > .card .field { grid-template-columns: 1fr; gap: 4px; }

    input[type=text], input[type=password], select { width: 100%; }
}

/* ==================== Cloud additions ==================== */

input:disabled, select:disabled { color: var(--muted); opacity: .8; }

/* Inline checkbox + label, used for option lists. */
.checks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 16px;
    margin-bottom: 10px;
}

.checks label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.card ul { margin: 6px 0 12px; padding-left: 22px; }
.card li { margin-bottom: 4px; }

code {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}

/* Wider content for the generator dashboard, whose panels are fixed size. */
.main.wide { max-width: none; }

/* Expand/collapse sections: FAQ entries and the generator dashboard (built by generator.js). */
.collapsible {
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: left;
    outline: none;
    font: inherit;
    font-size: 15px;
    line-height: normal;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.collapsible:hover, .collapsible.active { background: var(--panel-2); }
.collapsible.active { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.collapsible:after {
    content: '\002B';
    color: var(--accent);
    font-weight: bold;
}

.collapsible.active:after { content: "\2212"; }

.content {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    background: var(--panel);
    border: 0 solid var(--border);
    border-radius: 0 0 8px 8px;
}

/* Padding only while open: max-height 0 can't hide padding. scrollHeight is read after the class is set. */
.collapsible.active + .content, div:has(> .collapsible.active) + .content { border-width: 0 1px 1px; padding-top: 14px; padding-bottom: 14px; }
.content hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* FAQ: one question per row. */
.faq .collapsible { margin-top: 8px; }

/* Generator dashboard: the colored status strip beside each generator's header. */
#theform > br { display: none; }
#theform > div:has(> div[id^="stsdiv-"]) { display: flex; margin-top: 12px; }
#theform div[id^="stsdiv-"] {
    float: none !important;
    height: auto !important;
    flex-shrink: 0;
    border-radius: 8px 0 0 8px;
}
#theform div:has(> div[id^="stsdiv-"]) > .collapsible { width: auto !important; flex: 1; min-width: 0; border-radius: 0 8px 8px 0; }
#theform div:has(> div[id^="stsdiv-"]) > .collapsible.active { border-bottom-right-radius: 0; }
#theform div:has(> div[id^="stsdiv-"]) + .content { margin-left: 20px; }
#theform .content table td { padding: 2px 8px 2px 0; }

.label-wrapper {
    width: 280px;
    text-align: center;
    border-radius: 5px;
    padding: 20px;
}

.label-wrapper select, .label-wrapper input[type=text] { width: 100%; margin: 4px 0 8px; }
.label-wrapper .button { width: 100%; margin-top: 6px; }

.label1 {
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.label2 {
    font-size: 26px;
    font-weight: 600;
}

/* Toast notification */
.gen-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    max-width: 90%;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.gen-notification.error {
    background-color: var(--danger);
    border: 1px solid #a93226;
}
.gen-notification.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(10px);
}

/* Site announcements (generators.html) */
.page-notice {
    background: #2a2410;
    border: 1px solid #5a4a14;
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 14px;
}
.page-notice p { margin: 0 0 0.75em 0; }
.page-notice p:last-child { margin-bottom: 0; }
.page-notice-highlight { font-size: 15px; }
.page-notice-highlight:not(:last-child) {
    padding-bottom: 0.75em;
    border-bottom: 1px solid #5a4a14;
}
.page-notice-label {
    background: var(--accent);
    color: var(--accent-text);
    font-weight: bold;
    padding: 1px 6px;
    margin-right: 4px;
    border-radius: 3px;
}

/* Login page */
.login-wrap { max-width: 560px; margin: 0 auto; padding-top: 48px; }
.login-wrap .field { grid-template-columns: 170px minmax(0, 1fr); }
.login-wrap input[type=text], .login-wrap input[type=password] { width: 100%; }

@media (max-width: 800px) {
    .login-wrap { padding-top: 16px; }
    .login-wrap .field { grid-template-columns: 1fr; }
    #theform div:has(> div[id^="stsdiv-"]) + .content { margin-left: 0; }
}
