/* ===== 3D model library (/models/) =====
   Loaded after /styles.css and reuses its palette variables. Everything is
   scoped under .mv / .mv-main so it can't affect the rest of the site. */

[hidden] { display: none !important; }

.content.mv-main {
    align-items: flex-start;
    padding: 36px 20px 60px;
}

.mv {
    width: 100%;
    max-width: 1200px;
    color: var(--accent);
}

.mv.fade-in { animation: fadeIn 0.35s ease; }

.mv a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
.mv a:hover { color: var(--accent-light); }
.mv .muted { color: var(--text-muted); font-weight: 400; }
.mv em { color: var(--text-muted); font-style: normal; text-transform: none; letter-spacing: 0; }
.mv-inline { display: inline; }

.mv h1, .mv-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.6em;
    letter-spacing: 1px;
    color: var(--accent);
    margin: 0 0 18px;
}

/* ---------- section bar */
.mv-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    margin-bottom: 28px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
}

.mv .mv-bar-title {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-weight: 700;
    font-size: 1.05em;
    color: var(--accent-light);
    white-space: nowrap;
}
.mv .mv-bar-title::before { content: "~/"; color: var(--text-muted); font-weight: 500; }

.mv-search { flex: 1; min-width: 180px; max-width: 460px; }
.mv-bar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* ---------- controls */
.mv input[type=text],
.mv input[type=search],
.mv input[type=password],
.mv select,
.mv textarea {
    width: 100%;
    background-color: var(--bg-panel-light);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 9px 12px;
    color: var(--accent);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9em;
}
.mv textarea { font-family: 'Inter', sans-serif; resize: vertical; line-height: 1.5; }
.mv select { width: auto; cursor: pointer; }
.mv input:focus, .mv select:focus, .mv textarea:focus { outline: none; border-color: var(--accent); }
.mv ::placeholder { color: #6f7680; }

.mv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 16px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.78em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.mv a.mv-btn:hover, .mv-btn:hover { background-color: var(--accent); color: var(--bg-deep); }
.mv .mv-btn-primary { background-color: var(--accent); color: var(--bg-deep); }
.mv a.mv-btn-primary:hover, .mv-btn-primary:hover { background-color: var(--accent-light); border-color: var(--accent-light); color: var(--bg-deep); }
.mv-btn-ghost { border-color: var(--border-soft); color: var(--text-muted); }
.mv-btn-danger { border-color: rgba(214, 69, 50, 0.6); color: #e0604c; }
.mv-btn-danger:hover { background-color: #c0392b; border-color: #c0392b; color: #fff; }
.mv-btn-lg { padding: 11px 22px; font-size: 0.85em; }
.mv-btn-sm { padding: 5px 10px; font-size: 0.7em; }
.mv-btn:disabled { opacity: 0.6; cursor: progress; }

.mv-flash {
    border-left: 3px solid;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 0.9em;
    font-weight: 600;
}
.mv-flash ul { margin: 0; padding-left: 18px; }
.mv-flash-ok { border-color: var(--accent); background-color: rgba(204, 102, 0, 0.12); color: var(--accent-light); }
.mv-flash-err { border-color: #e0604c; background-color: rgba(224, 96, 76, 0.1); color: #f08a78; }

/* ---------- browse layout */
.mv .layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; }
.mv .sidebar section { margin-bottom: 28px; }
.mv .sidebar h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px;
}
.mv .catlist { list-style: none; margin: 0; padding: 0; }
.mv .catlist a {
    display: flex;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 5px;
    font-size: 0.9em;
}
.mv .catlist a:hover { background-color: rgba(204, 102, 0, 0.1); }
.mv .catlist a.active { background-color: rgba(204, 102, 0, 0.18); color: var(--accent-light); }
.mv .count { color: var(--text-muted); font-size: 0.85em; font-family: 'JetBrains Mono', monospace; }

.mv .tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.mv .tag {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75em;
    color: var(--text-muted);
}
.mv a.tag:hover, .mv .tag.active { background-color: var(--accent); border-color: var(--accent); color: var(--bg-deep); }

.mv .toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.mv .toolbar h1 { margin: 0; }
.mv .filters { display: flex; gap: 8px; }
.mv .active-filters { color: var(--text-muted); margin: -6px 0 16px; font-size: 0.9em; }

.mv .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.mv .card {
    display: block;
    background-color: var(--bg-panel-light);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.mv a.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(204, 102, 0, 0.15); }
.mv .thumb { position: relative; aspect-ratio: 4 / 3; background-color: var(--bg-deep); }
.mv .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mv .nothumb {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(204, 102, 0, 0.35);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.8em;
    font-weight: 700;
    letter-spacing: 3px;
    background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(204, 102, 0, 0.04) 10px 20px);
}
.mv .nothumb.big { font-size: 3.5em; }
.mv .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68em;
    font-weight: 700;
    background-color: rgba(20, 24, 31, 0.88);
    color: var(--accent-light);
    border: 1px solid var(--border-soft);
    padding: 2px 6px;
    border-radius: 4px;
}
.mv .badge.inline { position: static; }
.mv .card-body { padding: 12px 14px 14px; }
.mv .card-body h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 6px;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.mv .meta { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 0.78em; }

.mv .pager { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 30px; color: var(--text-muted); font-size: 0.9em; }
.mv .empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    border: 1px dashed var(--border-soft);
    border-radius: 10px;
}
.mv .empty p + p { margin-top: 14px; }

/* ---------- model page */
.mv .crumbs { color: var(--text-muted); font-size: 0.85em; margin: 0 0 18px; }
.mv .detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 32px; align-items: start; }
.mv .stage {
    position: relative;
    aspect-ratio: 4 / 3;
    background-color: var(--bg-deep);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    overflow: hidden;
}
.mv .stage > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mv .viewer { position: absolute; inset: 0; }
.mv .viewer canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.mv .viewer canvas:active { cursor: grabbing; }
.mv .viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'JetBrains Mono', monospace; }
.mv .viewer-msg.err { color: #f08a78; padding: 16px; text-align: center; }
.mv .viewer-hud {
    position: absolute;
    left: 10px;
    bottom: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72em;
    color: var(--text-muted);
    background-color: rgba(20, 24, 31, 0.75);
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}
.mv .thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mv .thumbbtn {
    width: 84px;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background-color: var(--bg-panel-light);
    cursor: pointer;
    overflow: hidden;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}
.mv .thumbbtn img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.7; transition: opacity 0.15s ease; }
.mv .thumbbtn:hover img, .mv .thumbbtn.active img { opacity: 1; }
.mv .thumbbtn.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mv .view3d { line-height: 1.15; }
.mv .view3d small { font-weight: 500; color: var(--text-muted); }

.mv .info h1 { font-size: 1.8em; overflow-wrap: anywhere; }
.mv .specs {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 7px 18px;
    margin: 0 0 18px;
    font-size: 0.9em;
}
.mv .specs dt { color: var(--text-muted); text-transform: uppercase; font-size: 0.8em; letter-spacing: 0.6px; padding-top: 2px; }
.mv .specs dd { margin: 0; color: var(--accent); }
.mv .mono-break { overflow-wrap: anywhere; font-family: 'JetBrains Mono', monospace; font-size: 0.92em; }
.mv .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 22px 0; }
.mv .description {
    border-top: 1px solid var(--border-soft);
    padding-top: 18px;
    color: var(--text-muted);
    line-height: 1.65;
    overflow-wrap: anywhere;
}

/* ---------- forms */
.mv .panel { background-color: var(--bg-panel); border: 1px solid var(--border-soft); border-radius: 10px; padding: 26px; }
.mv .form { max-width: 820px; }
.mv .field { display: block; margin-bottom: 18px; }
.mv .field > span {
    display: block;
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}
.mv .row { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.mv .row select { width: 100%; }

.mv .dropzone {
    position: relative;
    border: 1px dashed rgba(204, 102, 0, 0.45);
    border-radius: 8px;
    padding: 26px 16px;
    text-align: center;
    color: var(--text-muted);
    background-color: var(--bg-panel-light);
    font-size: 0.9em;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.mv .dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.mv .dropzone.over, .mv .dropzone:hover { border-color: var(--accent); background-color: rgba(204, 102, 0, 0.08); }
.mv .dropzone.has-file { border-style: solid; border-color: var(--accent); color: var(--accent-light); }
.mv .dropzone u { color: var(--accent); }
.mv .previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mv .previews img { width: 96px; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--border-soft); border-radius: 6px; }

.mv .imgedit { display: flex; flex-wrap: wrap; gap: 14px; }
.mv .imgedit-item { width: 140px; font-size: 0.8em; color: var(--text-muted); }
.mv .imgedit-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--border-soft); border-radius: 6px; display: block; margin-bottom: 6px; }
.mv .imgedit-item label { display: block; cursor: pointer; text-transform: none; letter-spacing: 0; }
.mv input[type=radio], .mv input[type=checkbox] { accent-color: var(--accent); }

.mv .progress { display: inline-flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 0.85em; }
.mv .progress .bar { width: 180px; height: 8px; border: 1px solid var(--border-soft); border-radius: 4px; overflow: hidden; }
.mv .progress .bar span { display: block; height: 100%; width: 0; background-color: var(--accent); transition: width 0.15s ease; }

.mv .catadd { display: flex; gap: 10px; margin-bottom: 22px; max-width: 480px; }
.mv .cattable { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.mv .cattable th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border-soft);
    padding: 8px;
}
.mv .cattable td { border-bottom: 1px solid var(--border-soft); padding: 10px 8px; vertical-align: middle; }
.mv .catrename { display: flex; gap: 8px; max-width: 420px; }

/* Sign-in page reuses the site's .login-form styling */
.mv .hero { margin: 30px auto 0; }
.mv .mv-login .form-error { margin: 0; }

/* ---------- responsive */
@media (max-width: 900px) {
    .mv .layout, .mv .detail { grid-template-columns: 1fr; }
    .mv .sidebar { order: 2; }
    .mv .row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .content.mv-main { padding: 20px 16px 40px; }
    .mv-search { order: 3; flex-basis: 100%; max-width: none; }
    .mv-bar-actions { margin-left: 0; }
    .mv .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .mv .panel { padding: 18px; }
}

/* ---------- generated preview renders */
.mv .render-opt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 10px; font-size: 0.85em; color: var(--text-muted); }
.mv .render-opt label { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.mv .render-status { font-family: 'JetBrains Mono', monospace; font-size: 0.9em; }
.mv .render-status.busy { color: var(--accent); }
.mv .render-status.busy::before { content: "◌ "; display: inline-block; animation: mv-spin 1s linear infinite; }
.mv .render-status.ok { color: var(--accent-light); }
.mv .render-status.err { color: #f08a78; }
@keyframes mv-spin { to { transform: rotate(360deg); } }
.mv .imgedit-item { position: relative; }
.mv .render-tag {
    position: absolute; top: 6px; left: 6px;
    font-family: 'JetBrains Mono', monospace; font-size: 0.75em;
    background-color: rgba(20, 24, 31, 0.85); color: var(--accent-light);
    border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 6px;
}
.mv .regen { margin-top: 10px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- multi-part models */
.mv .btn-note { font-family: 'Inter', sans-serif; font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.75; font-size: 0.85em; }

.mv .parts { border-top: 1px solid var(--border-soft); padding-top: 16px; margin-bottom: 22px; }
.mv .parts-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.mv .parts-head h2 { font-family: 'Poppins', sans-serif; font-size: 1em; letter-spacing: 0.5px; color: var(--accent-light); margin: 0; }
.mv .partrows { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.mv .partrows li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
    border-bottom: 1px solid rgba(204, 102, 0, 0.12);
    font-size: 0.88em;
}
.mv .partrows li:last-child { border-bottom: 0; }
.mv .part-size { color: var(--text-muted); font-size: 0.9em; white-space: nowrap; }
.mv .part-actions { display: inline-flex; gap: 6px; }
.mv .part-view.active { background-color: var(--accent); border-color: var(--accent); color: var(--bg-deep); }

.mv .partlist { width: 100%; border-collapse: collapse; font-size: 0.88em; margin-bottom: 12px; }
.mv .partlist th {
    text-align: left; color: var(--text-muted); font-weight: 400; font-size: 0.8em;
    text-transform: uppercase; letter-spacing: 0.6px; padding: 6px 8px; border-bottom: 1px solid var(--border-soft);
}
.mv .partlist th:last-child, .mv .partlist td:last-child { text-align: center; width: 70px; }
.mv .partlist td { padding: 7px 8px; border-bottom: 1px solid rgba(204, 102, 0, 0.12); }
.mv .partlist tr.removing td { opacity: 0.45; text-decoration: line-through; }
.mv .partlist tr.removing td:last-child { opacity: 1; text-decoration: none; }

@media (max-width: 640px) {
    .mv .partrows li { grid-template-columns: auto minmax(0, 1fr) auto; }
    .mv .part-size { display: none; }
}
