/* Bundled, not loaded from a CDN -- this is a local desktop app and shouldn't need internet
   access just to render its own UI. Single variable-font file covers every weight we use. */
@font-face {
    font-family: 'InterVariable';
    src: url('../../static/fonts/InterVariable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: rgba(0, 0, 0, 0.85);
    --page-bg: #000000;
    --bg-sidebar: transparent;
    --bg-header: transparent;
    --border: transparent;
    --text: #e4e4e7;
    --text-dim: #6f6f78;
    --text-mid: #9a9aa5;
    --row-hover: rgba(255, 255, 255, 0.05);
    --row-selected: rgba(255, 255, 255, 0.1);
    --accent: #0f8b88;
    --danger: #e5484d;
    --font-sans: "InterVariable", "Segoe UI Variable Text", "Segoe UI", sans-serif;
    --font-mono: "Cascadia Mono", Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    height: 100vh;
    /* This is the page canvas around the app card -- padding above leaves it exposed on every
     side. background-color is a fallback in case the image is ever missing/slow to load. */
    background: var(--page-bg) url('../../static/images/pop_2008_scene_bg.png') center / cover no-repeat;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    overflow: hidden;
    user-select: none;
    padding: 32px;
    padding-left: 100px;
    padding-right: 100px;
}

/* ---- app card ---- */
#app {
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    min-height: 0;
}

#sidebar {
    width: 260px;
    min-width: 260px;
    background: transparent;
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px 8px 16px;
}

#drop-zone {
    padding: 16px;
    border-bottom: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

#drop-zone.drag-over {
    background: rgba(26, 30, 44, 0.95);
    box-shadow: inset 0 0 0 2px var(--accent), 0 2px 8px rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(100, 100, 120, 0.3);
}

#btn-load {
    width: 100%;
    padding: 8px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 600;
    cursor: default;
}

#btn-load:hover {
    background: #14a09c;
}

#btn-load:active {
    background: #0c7572;
}

#drop-hint {
    margin: 8px 0 0 0;
    color: var(--text-dim);
    font-size: 11px;
    text-align: center;
}

#summary-section {
    flex: 1;
}

#summary-list {
    padding: 4px 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#summary-empty {
    color: var(--text-dim);
    font-size: 12px;
    margin: 4px 0 0 0;
}

.summary-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: rgba(24, 24, 28, 0.9);
    border: 1px solid rgba(100, 100, 120, 0.25);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.summary-label {
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.summary-value {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.seed-ring-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 4px 0 2px 0;
}

.seed-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    line-height: 1.1;
}

.seed-ring-text span {
    display: block;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
}

.plate-grid {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 6px;
}

.plate-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dim);
    opacity: 0.45;
}

.plate-chip.enabled {
    color: var(--text);
    opacity: 1;
}

.plate-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
}

#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#page-header {
    background: transparent;
    border-bottom: none;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#page-header-text {
    min-width: 0;
}

#page-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#page-subtitle {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* icon anchored on the right; the input grows out to its LEFT when expanded */
#search-box {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#btn-search-toggle {
    width: 30px;
    height: 30px;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(100, 100, 120, 0.3);
    background: rgba(28, 28, 33, 0.9);
    color: var(--text-mid);
    cursor: default;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#btn-search-toggle svg {
    display: block;
}

#btn-search-toggle:hover {
    background: #24242b;
    color: var(--text);
}

#search-box.expanded #btn-search-toggle {
    border-color: var(--accent);
    color: var(--text);
}

#search {
    width: 0;
    opacity: 0;
    padding: 6px 0;
    border: 1px solid rgba(100, 100, 120, 0.2);
    background: rgba(30, 30, 36, 0.9);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: width 0.18s ease, opacity 0.18s ease, padding 0.18s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#search-box.expanded #search {
    width: 220px;
    opacity: 1;
    padding: 6px 10px;
    border-color: rgba(100, 100, 120, 0.4);
}

#search-box.expanded #search:focus {
    border-color: var(--accent);
}

#tree-header {
    display: flex;
    padding: 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Must match FIELD_COLUMN_WIDTH in app.js so this label sits directly above the actual
   depth-0 field column. */
#tree-header span:first-child {
    flex: 0 0 600px;
}

#tree-header span:last-child {
    flex: 1;
    padding-left: 12px;
}

#tree {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px 20px 12px;
}

/* ---- tree nodes ---- */
.node summary {
    list-style: none;
    cursor: default;
}

.node summary::-webkit-details-marker {
    display: none;
}

.node-row {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 8px;
    border-radius: 4px;
    box-sizing: border-box;
}

.node-row:hover {
    background: var(--row-hover);
}

/* Every expanded section's own header row -- stays visible at the top of #tree (stacked by
   depth, see STICKY_ROW_HEIGHT in app.js) so it's always one click away to collapse, no matter
   how far you've scrolled into its content. */
.sticky-row {
    position: sticky;
    background: rgba(23, 23, 27, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(100, 100, 120, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sticky-row:hover {
    background: var(--row-hover);
}

.node-field {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    /* width set inline per-row by app.js, compensated for indent depth --
                       see FIELD_COLUMN_WIDTH -- so every row's value column starts at the
                       same x position no matter how deeply it's nested */
    gap: 6px;
    color: #d4d4d9;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-caret {
    width: 10px;
    color: var(--text-dim);
    font-size: 10px;
    flex-shrink: 0;
}

.leaf .node-row .node-caret {
    visibility: hidden;
}

.node-value {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 12px;
    border-left: 1px solid #202024;
    color: #d4d4d9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-value.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.node-children {
    margin-left: 13px;
    padding-left: 11px;
    border-left: 1px solid #29292f;
}

.node-children:hover {
    border-left-color: #38383f;
}

.hidden {
    display: none !important;
}

/* scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2e2e36;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d3d47;
}