/* ============================================================================
   console.css, the developer console (console.realestatecopilot.com.au)
   ----------------------------------------------------------------------------
   Built entirely on tokens.css so light and dark come from one variable flip.
   Namespaced rcc- (RealestateCopilot Console). Layout: fixed left rail +
   scrolling content, the shape developers already know from other API
   consoles. Solid surfaces, one accent, no translucency.
   ========================================================================== */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--rc-font-body);
    background: var(--rc-bg-base);
    color: var(--rc-fg-base);
    min-height: 100vh;
}

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Inline code (base URLs, field names) must wrap rather than widen the page
   on narrow screens; block code scrolls inside its own box instead. */
p code, td code { overflow-wrap: anywhere; word-break: break-all; }

/* ---- Sign-in / gate ------------------------------------------------------- */

.rcc-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* The class display rules above would beat the hidden attribute's default
   display:none, leaving invisible full-height blocks in the layout. */
.rcc-auth[hidden], .rcc-shell[hidden] { display: none; }

.rcc-auth-card {
    width: min(420px, 100%);
    background: var(--rc-bg-raised);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-lg);
    box-shadow: var(--rc-shadow);
    padding: 32px;
}

.rcc-auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.rcc-logo-mark { height: 26px; width: auto; }
.rcc-wordmark { font-size: 17px; letter-spacing: -0.01em; }
.rcc-wordmark strong { font-weight: 700; }
.rcc-wordmark em { font-weight: 300; font-style: italic; }

.rcc-auth-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.01em; }
.rcc-auth-sub { color: var(--rc-fg-subtle); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.rcc-auth-note { color: var(--rc-fg-subtle); font-size: 12.5px; margin: 14px 0 0; }
.rcc-auth-note a { color: var(--rc-accent-text); }

.rcc-field-label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 5px; }

.rcc-auth-card input,
.rcc-modal-card input {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    color: var(--rc-fg-base);
    background: var(--rc-bg-base);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-sm);
}

.rcc-auth-card input:focus,
.rcc-modal-card input:focus,
.rcc-play textarea:focus {
    outline: 2px solid var(--rc-accent);
    outline-offset: 1px;
}

/* ---- Buttons --------------------------------------------------------------- */

.rcc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--rc-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

.rcc-btn-primary { background: var(--rc-accent); color: #fff; }
.rcc-btn-primary:hover { background: var(--rc-accent-hover); }
.rcc-btn-primary:disabled { opacity: 0.55; cursor: default; }
.rcc-btn-ghost { background: var(--rc-bg-raised); color: var(--rc-fg-base); border-color: var(--rc-line); }
.rcc-btn-ghost:hover { background: var(--rc-bg-sunken); }
.rcc-btn-block { width: 100%; margin-top: 18px; }
.rcc-btn-danger { color: var(--rc-crit); }

.rcc-link-btn {
    background: none; border: none; padding: 0;
    font: inherit; font-size: 13px; color: var(--rc-fg-subtle); cursor: pointer;
}
.rcc-link-btn:hover { color: var(--rc-crit); }

/* ---- Shell ----------------------------------------------------------------- */

.rcc-shell { display: flex; min-height: 100vh; }

.rcc-side {
    width: 230px;
    flex: none;
    display: flex;
    flex-direction: column;
    background: var(--rc-bg-raised);
    border-right: 1px solid var(--rc-line);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.rcc-side-brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 18px; }
.rcc-side-console { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rc-accent-text); }

.rcc-nav { display: flex; flex-direction: column; gap: 2px; }

.rcc-nav-item {
    text-align: left;
    padding: 9px 10px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--rc-fg-subtle);
    background: none;
    border: none;
    border-radius: var(--rc-radius-sm);
    cursor: pointer;
}

.rcc-nav-item:hover { color: var(--rc-fg-base); background: var(--rc-bg-sunken); }
.rcc-nav-item[aria-current="page"] { color: var(--rc-accent-text); background: var(--rc-accent-tint-15); font-weight: 600; }

.rcc-side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--rc-line); }
.rcc-side-account { font-size: 12.5px; color: var(--rc-fg-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 6px; }

.rcc-main {
    flex: 1;
    min-width: 0;
    padding: 34px 40px 60px;
    max-width: 1060px;
}

.rcc-title { font-size: 24px; letter-spacing: -0.01em; margin: 0 0 6px; }
.rcc-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.rcc-title-row h2 { margin: 0; }
.rcc-sub { color: var(--rc-fg-subtle); font-size: 14px; line-height: 1.55; margin: 0 0 20px; max-width: 68ch; }

/* ---- Cards / stats ---------------------------------------------------------- */

.rcc-card {
    background: var(--rc-bg-raised);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-md);
    padding: 20px;
    margin: 0 0 18px;
}

.rcc-card h2 { font-size: 16px; margin: 0 0 8px; }
.rcc-card h3 { font-size: 13.5px; margin: 16px 0 6px; }
.rcc-card p { font-size: 14px; line-height: 1.55; color: var(--rc-fg-subtle); margin: 0 0 12px; max-width: 72ch; }

.rcc-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 16px 0 18px;
}

.rcc-stat {
    background: var(--rc-bg-raised);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-md);
    padding: 14px 16px;
}

.rcc-stat-label { font-size: 12px; color: var(--rc-fg-subtle); margin-bottom: 4px; }
.rcc-stat-value { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.rcc-stat-value.rcc-ok { color: var(--rc-accent-text); }

/* ---- Code blocks ------------------------------------------------------------ */

.rcc-code {
    background: var(--rc-bg-sunken);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-sm);
    padding: 13px 14px;
    font-size: 12.5px;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre;
    margin: 10px 0;
}

.rcc-reveal { font-size: 13px; user-select: all; }

.rcc-method {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--rc-accent-text);
    background: var(--rc-accent-tint-15);
    border-radius: var(--rc-radius-sm);
    padding: 2px 7px;
    margin-right: 7px;
    vertical-align: 2px;
}

/* ---- Tables ----------------------------------------------------------------- */

.rcc-table-wrap { overflow-x: auto; }

.rcc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rcc-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--rc-fg-subtle);
    padding: 8px 12px;
    border-bottom: 1px solid var(--rc-line);
    white-space: nowrap;
}
.rcc-table td { padding: 10px 12px; border-bottom: 1px solid var(--rc-line); vertical-align: middle; }
.rcc-table tr:last-child td { border-bottom: none; }
.rcc-table code { font-size: 12px; }

.rcc-key-revoked { color: var(--rc-fg-subtle); text-decoration: line-through; }
.rcc-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--rc-radius-full);
    border: 1px solid var(--rc-line);
}
.rcc-badge-active { color: var(--rc-accent-text); border-color: var(--rc-accent-text); }
.rcc-badge-revoked { color: var(--rc-fg-subtle); }

.rcc-empty { color: var(--rc-fg-subtle); font-size: 14px; padding: 18px 0; }

/* ---- Playground ------------------------------------------------------------- */

.rcc-play textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    font-size: 14px;
    color: var(--rc-fg-base);
    background: var(--rc-bg-raised);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-md);
    resize: vertical;
}

.rcc-play-actions { display: flex; gap: 10px; margin: 12px 0 18px; }
.rcc-play-meta { font-size: 12.5px; color: var(--rc-fg-subtle); margin-bottom: 10px; }
.rcc-play-answer { font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.rcc-play-citations { margin-top: 14px; font-size: 12.5px; color: var(--rc-fg-subtle); }
.rcc-play-citations div { padding: 3px 0; }

/* ---- Usage chart ------------------------------------------------------------ */

.rcc-range { display: inline-flex; border: 1px solid var(--rc-line); border-radius: var(--rc-radius-sm); overflow: hidden; }
.rcc-range-btn {
    font: inherit; font-size: 12.5px; font-weight: 600;
    padding: 6px 12px; border: none; background: var(--rc-bg-raised);
    color: var(--rc-fg-subtle); cursor: pointer;
}
.rcc-range-btn + .rcc-range-btn { border-left: 1px solid var(--rc-line); }
.rcc-range-on { color: var(--rc-accent-text); background: var(--rc-accent-tint-15); }

.rcc-chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 10px; }
.rcc-chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 3px; }
.rcc-chart-bar { background: var(--rc-accent); border-radius: 2px 2px 0 0; min-height: 2px; }
.rcc-chart-bar.rcc-chart-failed { background: var(--rc-crit); border-radius: 0; }
.rcc-chart-empty { color: var(--rc-fg-subtle); font-size: 13.5px; align-self: center; margin: 0 auto; }

/* ---- Modals ----------------------------------------------------------------- */

.rcc-modal {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(9, 20, 15, 0.55);
    padding: 24px;
    z-index: 100;
}

.rcc-modal[hidden] { display: none; }

.rcc-modal-card {
    width: min(460px, 100%);
    background: var(--rc-bg-raised);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-lg);
    box-shadow: var(--rc-shadow);
    padding: 26px;
}

.rcc-modal-card h2 { font-size: 17px; margin: 0 0 8px; }
.rcc-modal-card p { font-size: 13.5px; line-height: 1.5; color: var(--rc-fg-subtle); margin: 0 0 8px; }
.rcc-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- Toasts (same pattern as the main app) ---------------------------------- */

.rcc-toasts {
    position: fixed; top: 16px; right: 16px; z-index: 500;
    display: flex; flex-direction: column; gap: 10px;
    max-width: min(400px, calc(100vw - 32px));
}

.rcc-toast {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 14px 14px 16px;
    font-size: 14px; line-height: 1.45;
    color: var(--rc-crit);
    background: var(--rc-bg-raised);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius-lg);
    box-shadow: var(--rc-shadow);
}

.rcc-toast-ok { color: var(--rc-accent-text); }

.rcc-toast button {
    background: none; border: none; padding: 0 2px;
    font-size: 18px; line-height: 1; color: var(--rc-fg-subtle); cursor: pointer;
}

/* ---- Responsive -------------------------------------------------------------- */

@media (max-width: 860px) {
    .rcc-shell { flex-direction: column; }
    .rcc-side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
    .rcc-side-brand { padding: 0; }
    .rcc-nav { flex-direction: row; flex-wrap: wrap; }
    .rcc-side-foot { margin: 0 0 0 auto; border: none; padding: 0; }
    .rcc-main { padding: 20px 16px 40px; }
}
