/* =====================================================================
   Routing Playground - same look-and-feel as the map UI sidebar
   (light theme, Inter, blue accent, soft shadows, no gradients).
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-input-focus: #ffffff;
    --bg-elevated: #f1f5f9;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-focus: #93c5fd;
    --success: #10b981;
    --warn: #f59e0b;
    --err: #ef4444;
    --code-bg: #f1f5f9;
    --code-text: #1e293b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius-sm: 6px;
    --radius-md: 8px;
    --transition: 0.18s ease-in-out;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    overflow: hidden;
    font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code, .code-inline {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    background: var(--code-bg);
    color: var(--text-primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    border: 1px solid var(--border);
}

/* ───── Top-right page nav ───── */
.page-nav {
    position: fixed; top: 16px; right: 16px; z-index: 1000;
    display: flex; gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: var(--shadow-md);
}
.page-nav a {
    color: var(--text-secondary);
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 0.85rem; font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.page-nav a:hover { background: var(--bg-elevated); color: var(--text-primary); text-decoration: none; }
.page-nav a.active { background: var(--accent); color: white; }

/* ───── Layout ───── */
.layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
}

/* ───── Sidebar ───── */
.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 16px;
}
.brand {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.brand h1 { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); }
.brand .subtitle { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

/* ───── Sidebar cards ───── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex; flex-direction: column; gap: 8px;
}
.card-label {
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.card input[type=password],
.card input[type=text],
.card input[type=email] {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.85rem;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    width: 100%;
    transition: all var(--transition);
}
.card input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
}
.card .hint { font-size: 0.72rem; color: var(--text-muted); }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 0.92rem; font-weight: 600; }

.badge {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 2px 8px; border-radius: 4px;
    font-size: 0.7rem; font-family: monospace; font-weight: 500;
}

/* ───── Usage rows ───── */
.usage-row {
    display: flex; justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.usage-row:last-of-type { border-bottom: none; }
.usage-row span { color: var(--text-secondary); }
.usage-row strong { color: var(--text-primary); font-weight: 600; }
.key-info {
    font-size: 0.75rem; color: var(--text-muted);
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    line-height: 1.5;
}
.key-info code { font-size: 0.92em; }

/* ───── Quick links ───── */
.quick-links {
    display: flex; flex-direction: column; gap: 2px;
    margin-top: auto;
    padding-top: 12px; border-top: 1px solid var(--border);
}
.quick-links a {
    color: var(--text-secondary);
    padding: 6px 8px; border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: background var(--transition), color var(--transition);
}
.quick-links a:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    text-decoration: none;
}

/* ───── Buttons ───── */
.btn {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem; font-weight: 500;
    font-family: inherit;
    transition: all var(--transition);
}
.btn:hover { background: var(--border); }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--accent); color: white;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); }
.btn-block { width: 100%; }

/* ───── Postman section ───── */
.postman-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0 40px;
    padding-bottom: 12px;
}
/* <a class="btn"> is inline by default - padding doesn't push the
   following paragraph down. Force inline-flex so the buttons own a
   proper box and stay clear of neighbouring text. */
.postman-row .btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
    white-space: nowrap;
}
.postman-row .btn:hover { text-decoration: none; }

/* ───── Content area ───── */
.content {
    overflow-y: auto;
    padding: 32px 40px 64px;
    scroll-behavior: smooth;
}
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px 32px;
    margin-bottom: 16px;
    scroll-margin-top: 8px;
    box-shadow: var(--shadow-sm);
}
.content-card h2 {
    font-size: 1.25rem; font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.content-card h3 { font-size: 1rem; font-weight: 600; margin: 20px 0 8px; color: var(--text-primary); }
.content-card h4 { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.content-card h5 { font-size: 0.85rem; font-weight: 600; margin: 14px 0 6px; color: var(--text-primary); }
.content-card p { color: var(--text-secondary); margin-bottom: 8px; line-height: 1.6; font-size: 0.9rem; }
.steps { padding-left: 24px; color: var(--text-secondary); }
.steps li { margin-bottom: 6px; }
.steps strong { color: var(--text-primary); }

/* ───── Code blocks ───── */
.code-block {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 12px 0;
    overflow: hidden;
}
.code-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 12px;
    background: #e2e8f0;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem; color: var(--text-secondary);
    font-weight: 500;
}
.code-block pre {
    padding: 14px 16px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
    line-height: 1.55;
}
.btn-copy {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.btn-copy:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn-copy.copied { color: var(--success); border-color: var(--success); }

/* ───── Get-a-key form ───── */
.key-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }
.form-row input {
    background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition);
}
.form-row input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
}

.key-result {
    margin-top: 20px;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: var(--radius-md);
    padding: 16px;
}
.key-result-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
    color: #047857; font-weight: 600;
}
.key-result-header .check {
    background: var(--success); color: white;
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700;
}
.key-value-row {
    display: flex; gap: 8px; align-items: stretch;
    margin-bottom: 10px;
}
.key-value-row code {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    user-select: all;
    word-break: break-all;
}
.warning {
    color: #92400e !important;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem !important;
    margin: 6px 0;
}

/* ───── Card row (auth grid) ───── */
.card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-top: 12px;
}
.card-row > div {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

/* ───── Endpoint docs ───── */
.endpoint-doc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}
.endpoint-doc summary {
    cursor: pointer;
    padding: 10px 14px;
    display: flex; align-items: center; gap: 8px;
    font-size: 0.88rem;
    color: var(--text-primary);
    list-style: none;
}
.endpoint-doc summary::-webkit-details-marker { display: none; }
.endpoint-doc summary::before {
    content: '▸';
    color: var(--text-muted);
    transition: transform var(--transition);
    display: inline-block;
    width: 12px;
}
.endpoint-doc[open] summary::before { transform: rotate(90deg); }
.endpoint-doc summary:hover { background: var(--bg-elevated); }
.endpoint-doc[open] summary { border-bottom: 1px solid var(--border); }
.endpoint-body { padding: 14px 18px 18px; }

.method {
    font-family: monospace; font-weight: 700;
    padding: 2px 8px; border-radius: 4px;
    font-size: 0.72rem;
}
.method-get  { background: #dbeafe; color: #1d4ed8; }
.method-post { background: #d1fae5; color: #047857; }
.badge-public {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px; border-radius: 4px;
    font-size: 0.7rem; font-weight: 500;
    margin-left: auto;
}

/* ───── Tables ───── */
.param-table, .error-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 8px 0;
}
.param-table th, .error-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
}
.param-table td, .error-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.param-table tr:last-child td, .error-table tr:last-child td { border-bottom: none; }
.param-table td:first-child { color: var(--accent); font-family: monospace; }

/* ───── Toasts ───── */
.toast-container {
    position: fixed; top: 72px; right: 20px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    transition: opacity 0.3s, transform 0.3s;
    min-width: 240px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--err); }

/* ───── Responsive ───── */
@media (max-width: 900px) {
    html, body { overflow: auto; }
    .layout { grid-template-columns: 1fr; height: auto; }
    .sidebar { border-right: none; border-bottom: 1px solid var(--border); overflow-y: visible; }
    .content { padding: 20px; }
}
