/* BaseBox — additive styles on top of BaseNote's assets/style.css tokens */

body.app-shell { overflow: hidden; }

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bn-bg);
}

#appFooter {
    flex-shrink: 0;
    height: 28px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.6875rem;
    color: var(--bn-text-faint);
    border-top: 1px solid var(--bn-border);
    background: var(--bn-surface);
}

#topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bn-border);
    background: var(--bn-surface);
}

#topbar .brand {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-right: 4px;
}

#sharedByBanner, #conflictBanner {
    margin: 8px 12px 0;
}

.script-row .shared-badge {
    font-size: 0.6875rem;
    color: var(--bn-text-faint);
}

#titleInput {
    height: 32px;
    border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius);
    padding: 0 8px;
    width: 220px;
    font-size: 0.8125rem;
    font-family: inherit;
}

#saveStatus { font-size: 0.6875rem; color: var(--bn-text-faint); min-width: 46px; }

.spacer { flex: 1; }

.autolabel { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--bn-text-muted); }

.topbar-btn {
    background: none;
    border: none;
    color: var(--bn-text-muted);
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.topbar-btn:hover { background: var(--bn-bg); color: var(--bn-text); }

#workarea { flex: 1; position: relative; overflow: hidden; }

#sidePanel {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    background: var(--bn-surface);
    border-right: 1px solid var(--bn-border);
    box-shadow: 2px 0 10px rgba(0,0,0,0.08);
    z-index: 5;
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transform: translateX(0);
    transition: transform 0.15s ease;
}
#sidePanel.hidden { transform: translateX(-100%); }

#searchInput {
    flex-shrink: 0;
    width: 100%;
    height: 30px;
    border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius);
    padding: 0 8px;
    font-size: 0.75rem;
    margin-bottom: 8px;
    font-family: inherit;
}

#scriptList {
    flex: 1;
    min-height: 0; /* required for a flex child to actually scroll instead of growing past its parent */
    overflow-y: auto;
}

.script-row { padding: 6px 8px; border-radius: var(--bn-radius); cursor: pointer; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.script-row:hover { background: var(--bn-bg); }
.script-row .rtext { flex: 1; min-width: 0; }
.script-row .rtitle { font-size: 0.75rem; font-weight: 500; color: var(--bn-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.script-row .rmeta { font-size: 0.6875rem; color: var(--bn-text-faint); }
.row-delete-btn {
    background: none; border: none; color: var(--bn-text-faint);
    font-size: 0.8125rem; width: 20px; height: 20px; border-radius: 4px;
    cursor: pointer; flex-shrink: 0;
}
.row-delete-btn:hover { background: var(--bn-border); color: var(--bn-danger); }

#splitPane { display: flex; height: 100%; }
#editorPane { flex: 1; overflow: hidden; }
#previewPane { flex: 1; overflow: hidden; }
#divider { width: 6px; cursor: col-resize; background: var(--bn-border); }
#divider:hover { background: var(--bn-border-strong); }

.CodeMirror { height: 100% !important; font-size: 0.8125rem; font-family: "JetBrains Mono", Menlo, Monaco, Consolas, monospace; }
#previewFrame, .share-preview-frame { width: 100%; height: 100%; border: none; background: #fff; }
.share-preview-wrap {
    display: flex;
    justify-content: center;
    max-width: 100%;
    margin: 0 auto;
    overflow: auto;
}
.share-preview-frame { height: calc(100vh - 60px); width: 100%; }

#shareLink {
    width: 100%; height: 32px; border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius); padding: 0 8px; font-size: 0.75rem;
    margin-bottom: 10px; font-family: inherit;
}
.shareActions { display: flex; gap: 8px; }
.shareActions button {
    border: 1px solid var(--bn-border); background: var(--bn-bg);
    border-radius: var(--bn-radius); padding: 6px 10px; font-size: 0.75rem;
}
.shareActions button:hover { background: var(--bn-border); }

.mobile-warning {
    display: none;
    font-size: 0.75rem;
    color: #a33;
    background: #fdecec;
    border: 1px solid #f3c9c9;
    border-radius: var(--bn-radius);
    padding: 8px 10px;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .mobile-warning { display: block; }
}

/* Admin panel */
.admin-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px;
}

.admin-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-message {
    background: #eaf7ea;
    border: 1px solid #b9e3b9;
    color: #2a6b2a;
    border-radius: var(--bn-radius);
    padding: 8px 10px;
    font-size: 0.8125rem;
    margin-bottom: 16px;
}

.admin-summary {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    font-size: 0.8125rem;
    color: var(--bn-text-muted);
}
.admin-summary strong { color: var(--bn-text); font-size: 1rem; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--bn-border);
}
.admin-table th {
    color: var(--bn-text-faint);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-reset-btn {
    border: 1px solid var(--bn-border);
    background: var(--bn-bg);
    border-radius: var(--bn-radius);
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
}
.admin-reset-btn:hover { background: var(--bn-border); }

.panel-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 2px;
    background: var(--bn-bg);
    border-radius: var(--bn-radius);
    padding: 2px;
    margin-bottom: 8px;
}
.panel-tab {
    flex: 1;
    border: none;
    background: none;
    padding: 5px 0;
    border-radius: 5px;
    font-size: 0.75rem;
    color: var(--bn-text-muted);
    cursor: pointer;
}
.panel-tab.active {
    background: var(--bn-surface);
    color: var(--bn-text);
    font-weight: 500;
    box-shadow: 0 0 0 1px var(--bn-border);
}

.trash-hint {
    flex-shrink: 0;
    font-size: 0.6875rem;
    color: var(--bn-text-faint);
    margin: 0 0 6px;
}

.trash-hint-row {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 8px;
}

.trash-empty-btn {
    flex-shrink: 0;
    width: 100%;
    border: 1px solid var(--bn-border);
    background: var(--bn-bg);
    border-radius: var(--bn-radius);
    padding: 5px 8px;
    font-size: 0.6875rem;
    color: var(--bn-danger);
    cursor: pointer;
}
.trash-empty-btn:hover { background: var(--bn-border); }

.script-row .row-restore-btn, .script-row .row-purge-btn {
    background: none;
    border: 1px solid var(--bn-border);
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
}
.script-row .row-restore-btn:hover { background: var(--bn-border); }
.script-row .row-purge-btn:hover { background: var(--bn-border); color: var(--bn-danger); }
