/*
    Project: STP File Browser
    Title:   Main Stylesheet
    File:    assets/css/style.css
    Author:  Jacob Holes
    Date:    4/6/2026
*/

/* ── Design tokens ────────────────────────────────────────────── */
:root {
    --navy:         #1a2744;
    --navy-dark:    #111c36;
    --navy-border:  #2a3a5c;
    --blue:         #2563eb;
    --blue-hover:   #1d4ed8;
    --blue-light:   #dbeafe;
    --surface:      #f1f5f9;
    --card-bg:      #ffffff;
    --border:       #e2e8f0;
    --text:         #1e293b;
    --muted:        #363d46;
    --success:      #16a34a;
    --warning:      #d97706;
    --danger:       #dc2626;
    --font-sans:    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono:    "Consolas", "Menlo", "Monaco", "Courier New", monospace;
    --radius:       8px;
    --radius-sm:    4px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:    0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
    --transition:   150ms ease;
}

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-sans);
    background: var(--surface);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
mark { background: #fde68a; border-radius: 2px; padding: 0 2px; }

/* ── Top Bar ─────────────────────────────────────────────────── */
.topbar {
    background: var(--navy);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--navy-border);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.topbar-slim .topbar-inner { padding: 10px 24px; }
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    /*max-width: 1600px;*/
    margin: 0 auto;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
}
.topbar-brand:hover { color: #93c5fd; text-decoration: none; }
.brand-icon { width: 22px; height: 22px; stroke: #60a5fa; }

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: .9rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.topbar-breadcrumb a { color: #93c5fd; }
.topbar-breadcrumb a:hover { color: #fff; }
.bc-sep { color: #475569; }

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.topbar-nav a { color: white; font-size: .9rem; }
.topbar-nav a:hover, .topbar-nav a.active { color: #fff; text-decoration: none; }

/* ── Search ──────────────────────────────────────────────────── */
.search-form { flex: 1; max-width: 520px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon {
    position: absolute; left: 10px; width: 18px; height: 18px;
    stroke: #94a3b8; pointer-events: none;
}
.search-input {
    width: 100%;
    background: whitesmoke;
    color: #1e293b;
    border: 1px solid var(--navy-border);
    border-radius: var(--radius);
    padding: 7px 80px 7px 36px;
    font-size: .9rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition);
}
.search-input::placeholder { color: #475569; }
.search-input:focus { border-color: var(--blue); }
.search-btn {
    position: absolute; right: 7px;
    background: var(--blue); color: #fff;
    border: none; border-radius: 5px;
    padding: 4px 12px; font-size: .82rem; cursor: pointer;
    transition: background var(--transition);
}
.search-btn:hover { background: var(--blue-hover); }

/* ── Page wrap (sidebar + main) ──────────────────────────────── */
.page-wrap {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    flex: 1;
    /*max-width: 1600px;*/
    margin: 0 auto;
    width: 100%;
    padding: 0;
}
.page-wrap-full {
    display: block;        /* single column – no sidebar */
    flex: 1;
    width: 100%;
}
.page-wrap-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    min-height: 100%;
}
.sidebar-section { padding: 0 16px 24px; }
.sidebar-heading {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}
.cat-list { list-style: none; }
.cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .88rem;
    transition: background var(--transition);
    text-decoration: none;
}
.cat-link:hover { background: var(--surface); text-decoration: none; }
.cat-link.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.cat-count {
    background: var(--surface);
    color: var(--muted);
    font-size: .75rem;
    border-radius: 10px;
    padding: 1px 7px;
}
.cat-link.active .cat-count { background: #bfdbfe; color: var(--blue); }

/* Section links in sidebar */
.cat-link-label {
    display: flex;
    align-items: center;
    gap: 7px;
}
.cat-link-label svg { flex-shrink: 0; opacity: .7; }
.cat-link.active .cat-link-label svg { opacity: 1; }

/* Section result badges (live search dropdown + search.php headings) */
.lrs-badge {
    display: inline-flex;
    align-items: center;
    font-size: .65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
    line-height: 1.5;
}
.lrs-models     { background: #dbeafe; color: #1d4ed8; }
.lrs-bulletins  { background: #fef3c7; color: #92400e; }
.lrs-schematics { background: #dcfce7; color: #15803d; }

/* Universal search grouped results */
.search-group { margin-bottom: 40px; }
.search-group-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}
.search-group-more {
    display: inline-block;
    margin-top: 12px;
    font-size: .85rem;
    color: var(--blue);
    font-weight: 500;
}
.search-group-more:hover { text-decoration: underline; }

/* ── Main Content ────────────────────────────────────────────── */
.main-content { padding: 24px 28px; flex: 1; min-width: 0; }

/* ── Context Bar ─────────────────────────────────────────────── */
.context-bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.context-title {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.context-title em { font-style: normal; color: var(--blue); }

/* ── Badges ──────────────────────────────────────────────────── */
.result-count {
    font-size: .78rem;
    font-weight: 500;
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 9px;
}
.pn-badge {
    display: inline-block;
    background: var(--navy);
    color: #93c5fd;
    font-family: var(--font-mono);
    font-size: .8rem;
    border-radius: var(--radius-sm);
    padding: 2px 8px;
}
.pn-badge-lg {
    font-size: 1rem;
    padding: 4px 12px;
    border-radius: var(--radius);
}
.rev-badge {
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    font-size: .75rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 8px;
    white-space: nowrap;
}
.rev-badge-lg { font-size: .85rem; padding: 3px 10px; }
.rev-badge-sm { font-size: .7rem; padding: 1px 6px; }
.cat-pill {
    display: inline-block;
    background: var(--blue-light);
    color: var(--blue);
    font-size: .73rem;
    font-weight: 600;
    border-radius: 10px;
    padding: 2px 9px;
    text-decoration: none;
}
.cat-pill:hover { background: #bfdbfe; text-decoration: none; }

/* ── Part Cards ──────────────────────────────────────────────── */
.cards-grid {
    display: grid;
    /*grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));*/
    grid-template-columns: 1fr;
    gap: 18px;
}
.part-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition), transform var(--transition);
}
.part-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--border);
}
.ml-auto { margin-left: auto; }
.card-body { padding: 12px 14px; flex: 1; }
.card-pn {
    display: block;
    font-family: var(--font-mono);
    font-size: .95rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 4px;
    text-decoration: none;
}
.card-pn:hover { color: var(--blue); text-decoration: none; }
.card-title { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.card-desc { font-size: .82rem; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
    background: var(--surface);
    color: var(--muted);
    font-size: .72rem;
    border-radius: 4px;
    padding: 1px 6px;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.tag:hover { background: var(--blue-light); color: var(--blue); text-decoration: none; }
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 0 0 var(--radius) var(--radius);
    gap: 8px;
    flex-wrap: wrap;
}
.card-meta { display: flex; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); }
.rev-count {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: .72rem;
    font-weight: 600;
}
.file-size { font-family: var(--font-mono); font-size: .78rem; }
.card-actions { display: flex; gap: 6px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition);
}
.btn-primary:hover { background: var(--blue-hover); color: #fff; text-decoration: none; }
.btn-primary.btn-block { display: flex; justify-content: center; width: 100%; }
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: midnightblue;
    color: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: .85rem;
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--transition), color var(--transition);
}
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-xs { padding: 2px 7px; font-size: .73rem; }
.btn-view {
    display: inline-block;
    background: var(--navy);
    color: #93c5fd;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition);
}
.btn-view:hover { background: var(--blue); color: #fff; text-decoration: none; }
.btn-copy {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: .8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition);
}
.btn-copy:hover { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }
.btn-copy.copied { background: #dcfce7; border-color: #86efac; color: var(--success); }
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid var(--navy-border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: .82rem;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}
.btn-share:hover { color: #fff; border-color: #60a5fa; }
.btn-share svg { width: 15px; height: 15px; }
.topbar-share { margin-left: 8px; }

/* ── Revision Table (PN view) ────────────────────────────────── */
.rev-share-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: .85rem;
}
.share-hint { color: var(--muted); white-space: nowrap; }
.share-url {
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--blue);
    word-break: break-all;
    flex: 1;
    min-width: 0;
}
.rev-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: .88rem;
}
.rev-table th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    padding: 10px 14px;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}
.rev-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.rev-table tr:last-child td { border-bottom: none; }
.rev-table tr:hover td { background: #f8fafc; }
.desc-cell { color: var(--muted); max-width: 260px; }
.date-cell { white-space: nowrap; }
.action-cell { text-align: right; white-space: nowrap; }
.mono { font-family: var(--font-mono); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 32px;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    font-size: .88rem;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.page-link:hover { background: var(--blue-light); border-color: var(--blue); color: var(--blue); text-decoration: none; }
.page-link.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.page-gap { color: var(--muted); padding: 0 4px; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.empty-state svg { stroke: #cbd5e1; }
.empty-state p { font-size: 1rem; max-width: 360px; }

/* ── Live Search Dropdown ────────────────────────────────────── */
.live-results {
    position: fixed;
    top: 60px;
    left: 25%;
    transform: translateX(-50%);
    width: min(640px, 94vw);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
    max-height: 80svh;
    overflow-y: auto;
}
.live-results[hidden] { display: none; }
.live-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background var(--transition);
}
.live-result-item:last-child { border-bottom: none; }
.live-result-item:hover { background: var(--surface); text-decoration: none; }
.live-result-pn { font-family: var(--font-mono); font-size: .85rem; font-weight: 700; color: var(--navy); min-width: 100px; }
.live-result-title { font-size: .85rem; flex: 1; }
.live-result-rev { font-size: .75rem; }
.live-results-footer {
    padding: 8px 16px;
    text-align: center;
    font-size: .8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: #f8fafc;
}
.live-results-footer a { color: var(--blue); }

/* ── Share Toast ─────────────────────────────────────────────── */
.share-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--navy);
    color: #fff;
    border-radius: var(--radius);
    padding: 10px 18px;
    font-size: .88rem;
    box-shadow: var(--shadow-md);
    z-index: 300;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .25s, transform .25s;
    pointer-events: none;
}
.share-toast.show { opacity: 1; transform: translateY(0); }

/* ── Viewer Page ─────────────────────────────────────────────── */
body.viewer-page { overflow: hidden; height: 100vh; }
body.viewer-page .site-footer { display: none; }

.viewer-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    height: calc(100vh - 49px);   /* subtract topbar-slim height */
    overflow: hidden;
}

/* 3D Pane */
.viewer-pane {
    display: flex;
    flex-direction: column;
    background: #0f172a;
    position: relative;
    overflow: hidden;
}
.o3dv-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}
/* Force the o3dv canvas to fill the container */
.o3dv-wrap > div,
.o3dv-wrap canvas {
    width: 100%;
    height: 100%;
}
.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: var(--navy-dark);
    border-top: 1px solid var(--navy-border);
}
.viewer-filename { color: #94a3b8; font-size: .78rem; }

/* Loader overlay */
.viewer-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    color: #94a3b8;
    font-size: .88rem;
    gap: 16px;
    z-index: 10;
    pointer-events: none;
}
.viewer-loader[hidden] { display: none; }
.loader-msg {
    margin: 0;
    font-size: .85rem;
    color: #94a3b8;
    max-width: 340px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.progress-track {
    width: 280px;
    max-width: 80%;
    height: 6px;
    background: #1e2a3a;
    border-radius: 99px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--blue);
    border-radius: 99px;
    transition: width .25s ease;
}
.progress-fill.indeterminate {
    width: 100% !important;
    background: repeating-linear-gradient(
        90deg,
        var(--blue) 0%, #1e3a5f 40%, var(--blue) 100%
    );
    background-size: 200% 100%;
    animation: indeterminate-slide 1.4s linear infinite;
    transition: none;
}
@keyframes indeterminate-slide {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.progress-label {
    font-size: .78rem;
    color: #64748b;
    min-width: 4ch;
    text-align: center;
}

/* Face-view quick-orient controls */
.view-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    z-index: 5;
    pointer-events: auto;
    height: unset !important;
    width: unset !important;
}
.view-controls[hidden] { display: none !important; }
.view-btn {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid #1e3a5f;
    color: white;
    font-size: .72rem;
    font-family: inherit;
    padding: 4px 9px;
    border-radius: 4px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
    line-height: 1.4;
}
.view-btn:hover {
    background: rgba(30, 58, 95, 0.92);
    color: #e2e8f0;
    border-color: var(--blue);
}

.viewer-missing {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #94a3b8;
    font-size: .88rem;
    text-align: center;
    padding: 24px;
    background: #0f172a;
}
.viewer-missing svg { stroke: #334155; }

/* Fullscreen */
.viewer-pane:-webkit-full-screen { width: 100vw; height: 100vh; }
.viewer-pane:-moz-full-screen    { width: 100vw; height: 100vh; }
.viewer-pane:fullscreen          { width: 100vw; height: 100vh; }

/* Info Panel */
.info-panel {
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.info-section {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.info-section:last-child { border-bottom: none; }
.info-identity { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.info-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.info-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}
.info-desc { font-size: .875rem; color: var(--muted); line-height: 1.6; padding: 3px; overflow-y:auto; max-height: 200px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.info-notes { font-size: .82rem; color: var(--muted); line-height: 1.6; font-style: italic; }

/* Metadata grid */
.meta-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    font-size: .82rem;
}
.meta-grid dt { color: var(--muted); white-space: nowrap; }
.meta-grid dd { color: var(--text); word-break: break-word; }

/* Share section */
.share-row { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; }
.share-label { color: var(--muted); }
.share-copy-row { display: flex; gap: 6px; align-items: center; }
.share-input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: .75rem;
    color: var(--blue);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    min-width: 0;
}
.mt-8 { margin-top: 8px; }

/* Revision list */
.rev-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rev-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    flex-wrap: wrap;
}
.rev-item.rev-current { background: #f0fdf4; border: 1px solid #bbf7d0; }
.rev-meta { display: flex; gap: 8px; align-items: center; flex: 1; flex-wrap: wrap; }
.rev-date { color: var(--muted); font-family: var(--font-mono); }
.rev-by  { color: var(--muted); }
.rev-size { color: var(--muted); font-family: var(--font-mono); margin-left: auto; }
.badge-current {
    font-size: .7rem;
    font-weight: 700;
    background: #dcfce7;
    color: var(--success);
    border-radius: 10px;
    padding: 1px 7px;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 12px 24px;
    font-size: .78rem;
    color: var(--muted);
}
.site-footer code { font-size: .78rem; color: var(--blue); }

/* ── PDF embed (used by view_bulletin.php / view_schematic.php) ── */
.pdf-embed {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
    background: #fff;
    min-height: 0;       /* needed inside a flex column */
}

/* ── Card extras (bulletins & schematics cards) ─────────────── */
.card-date  { font-size: .78rem; color: var(--muted); font-family: var(--font-mono); }
.card-author { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* File-type badge (PDF / DWG) */
.file-type-badge {
    display: inline-flex;
    align-items: center;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 1px 6px;
    border-radius: 3px;
    background: #fee2e2;
    color: #b91c1c;
    text-transform: uppercase;
}
.file-type-dwg {
    background: #fef3c7;
    color: #92400e;
}

#search-share-container { display: flex; min-width: 450px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .page-wrap { grid-template-columns: 1fr; }
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;
    }
    .sidebar-section { padding: 0; padding-bottom: 4px; }
    .cat-list { display: flex; flex-wrap: wrap; gap: 6px; }
    .cat-link { padding: 4px 10px; }

    .viewer-layout { grid-template-columns: 1fr; height: auto; overflow: visible; }
    body.viewer-page { overflow: auto; height: auto; }
    .viewer-pane { height: 60vmin; min-height: 300px; }
    .info-panel { max-height: none; }

    .topbar-inner{ justify-content: space-between;} 
    .live-results { left: 50%;}
}
@media (max-width: 600px) {
    .topbar-inner { gap: 8px; padding: 8px 14px; display: grid;}
    .search-form { max-width: none; }
    .topbar-brand span { display: none; }
    .main-content { padding: 16px; }
    .cards-grid { grid-template-columns: 1fr; }
    .rev-table { font-size: .8rem; }
    .rev-table th, .rev-table td { padding: 8px 10px; }
    .desc-cell { display: none; }
    .live-results { top: 90px; left: 50%;}
    #search-share-container { min-width: unset; }
}
