* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  background: #0f1115;
  color: #f5f5f5;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 8%;
  background: #151821;
  border-bottom: 1px solid #2a2f3a;
}

.logo {
  font-size: 22px;
  font-weight: bold;
  color: #00e0ff;
}

nav a {
  color: #ddd;
  text-decoration: none;
  margin-left: 24px;
  font-size: 15px;
}

nav a:hover {
  color: #00e0ff;
}

/* Hero */
.hero {
  text-align: center;
  padding: 70px 8% 45px;
}

.hero h1 {
  font-size: 42px;
  margin-bottom: 15px;
}

.hero p {
  color: #b7bdc9;
  font-size: 18px;
  margin-bottom: 30px;
}

#searchInput {
  width: 100%;
  max-width: 650px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
  font-size: 16px;
  outline: none;
}

#searchInput:focus {
  border-color: #00e0ff;
}

/* Filters */
.filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 8% 35px;
}

.filters button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #303746;
  background: #191d27;
  color: #ddd;
  cursor: pointer;
}

.filters button:hover {
  background: #00e0ff;
  color: #0f1115;
}

/* Model cards */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  padding: 0 8% 60px;
}

.model-card {
  background: #171b24;
  border: 1px solid #2a2f3a;
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.model-card:hover {
  transform: translateY(-4px);
  border-color: #00e0ff;
}

.model-image {
  height: 170px;
  background: linear-gradient(135deg, #232a36, #11141b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6f7a8c;
  font-size: 42px;
}

.model-content {
  padding: 18px;
}

.model-content h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.model-content p {
  color: #b7bdc9;
  font-size: 14px;
  margin-bottom: 14px;
  line-height: 1.4;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tag {
  font-size: 12px;
  background: #242b38;
  color: #cfd6e4;
  padding: 5px 8px;
  border-radius: 999px;
}

.download-btn {
  /* display/text-align/text-decoration: no effect on a <button>
     (already its default rendering), needed so .download-btn
     behaves the same on the <a> link for
     "Download STL" (model.html). */
  display: inline-block;
  text-align: center;
  text-decoration: none;
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: #00e0ff;
  color: #0f1115;
  font-weight: bold;
  cursor: pointer;
  box-sizing: border-box;
}

.download-btn:hover {
  background: #5cecff;
}

.upload-section {
  max-width: 700px;
  margin: 20px auto 50px;
  padding: 24px;
  background: #171b24;
  border: 1px solid #2a2f3a;
  border-radius: 18px;
}

.upload-section h2 {
  margin-bottom: 18px;
}

.upload-section input,
.upload-section textarea,
.upload-section select {
  width: 100%;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
}

.upload-section textarea {
  min-height: 100px;
  resize: vertical;
}

#uploadButton {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #00e0ff;
  color: #0f1115;
  font-weight: bold;
  cursor: pointer;
}

#uploadMessage {
  margin-top: 12px;
  color: #b7bdc9;
}

.user-section {
  max-width: 700px;
  margin: 25px auto 0;
  padding: 18px;
  background: #171b24;
  border: 1px solid #2a2f3a;
  border-radius: 18px;
}

.user-section label {
  display: block;
  margin-bottom: 8px;
  color: #b7bdc9;
}

.user-section input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
  margin-bottom: 10px;
}

.user-section button {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: #00e0ff;
  color: #0f1115;
  font-weight: bold;
  cursor: pointer;
}

#usernameMessage {
  margin-top: 10px;
  color: #b7bdc9;
}

.model-img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
}

.upload-section label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  color: #f5f5f5;
}

.upload-hint {
  font-size: 13px;
  color: #9aa3b2;
  margin-bottom: 6px;
}

.image-preview {
  display: none;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  margin: 12px 0 18px;
  border-radius: 14px;
  border: 1px solid #333a48;
}

/* SELECT */
select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background-color: #191d27;
  color: #ffffff;
  font-size: 15px;
  margin-bottom: 10px;
}

/* OPTIONS */
select option {
  background-color: #191d27;
  color: #ffffff;
  padding: 10px;
}

.upload-section select {
  appearance: auto;
  cursor: pointer;
}

.folder-path {
  color: #9aa3b2;
  font-size: 13px;
  margin: 8px 0;
}

/* Explorer folders */

.breadcrumb {
  margin: 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.breadcrumb button {
  background: #191d27;
  color: #00e0ff;
  border: 1px solid #333a48;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.breadcrumb span {
  color: #9aa3b2;
}

.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.folder-card {
  background: #171b24;
  border: 1px solid #2a2f3a;
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.folder-card:hover {
  transform: translateY(-3px);
  border-color: #00e0ff;
}

.folder-icon {
  font-size: 34px;
}

.folder-card h3 {
  margin-bottom: 4px;
}

.folder-card p {
  color: #9aa3b2;
  font-size: 14px;
}

.folder-search {
  width: 100%;
  max-width: 600px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
  font-size: 15px;
  margin-bottom: 28px;
}

.folder-search:focus {
  outline: none;
  border-color: #00e0ff;
}

.selected-folder-box {
  background: #171b24;
  border: 1px solid #00e0ff40;
  border-radius: 16px;
  padding: 18px;
  margin: 20px 0;
}

.selected-folder-label {
  color: #9aa3b2;
  font-size: 13px;
  margin-bottom: 8px;
}

.selected-folder-path {
  color: #00e0ff;
  font-size: 16px;
  font-weight: 600;
  word-break: break-word;
}

.active-folder {
  border-color: #00e0ff !important;
  background: #1b2433;
  box-shadow: 0 0 18px rgba(0, 224, 255, 0.18);
  transform: scale(1.02);
}

.active-folder .folder-icon {
  font-size: 42px;
}

.active-folder h3 {
  color: #00e0ff;
}

.current-folder-big {
  margin-bottom: 24px;
  max-width: 420px;
}

.model-page {
  padding: 40px 8%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.model-detail-image-wrapper,
.model-detail-content,
.model-info-panel,
.comments-section {
  background: #171b24;
  border: 1px solid #2a2f3a;
  border-radius: 18px;
  padding: 24px;
}

.model-detail-image {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: 16px;
}

.model-detail-placeholder {
  height: 360px;
  background: linear-gradient(135deg, #232a36, #11141b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  border-radius: 16px;
}

.model-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 24px 0;
  flex-wrap: wrap;
}

.model-actions button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
  cursor: pointer;
}

/* Report: stays discreet by default, stands out on hover so it
   doesn't permanently draw the eye next to Like/Save. */
.report-btn:hover {
  border-color: #ff5c5c;
  color: #ff8a8a;
}

/* Content already reported by the user — same visual logic as
   the hover state, but permanent until it's cancelled. */
.report-btn.reported {
  border-color: #ff5c5c;
  color: #ff8a8a;
}

.model-info-panel,
.comments-section {
  grid-column: span 2;
}

.comments-section textarea {
  width: 100%;
  min-height: 110px;
  margin: 16px 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
}

@media (max-width: 800px) {
  .model-page {
    grid-template-columns: 1fr;
  }

  .model-info-panel,
  .comments-section {
    grid-column: span 1;
  }
}

/* =======================
   COMMENTS - BUBBLES
   Turns comments into readable cards/bubbles
======================= */

.comment-bubble {
  background: #191d27;
  border: 1px solid #2a2f3a;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

/* Top of the bubble: username */
.comment-header {
  color: #00e0ff;
  margin-bottom: 8px;
  font-size: 14px;
}

/* Comment text */
.comment-text {
  color: #dce2ee;
  line-height: 1.5;
  margin-bottom: 12px;
}

/* Comment like/unlike button */
.comment-like-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #333a48;
  background: #171b24;
  color: #f5f5f5;
  cursor: pointer;
}

/* Hover effect on the like button */
.comment-like-btn:hover {
  border-color: #00e0ff;
  color: #00e0ff;
}

/* Like + report row under each comment */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-report-btn {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #333a48;
  background: #171b24;
  color: #9aa3b2;
  cursor: pointer;
}

.comment-report-btn:hover {
  border-color: #ff5c5c;
  color: #ff8a8a;
}

.comment-report-btn.reported {
  border-color: #ff5c5c;
  color: #ff8a8a;
}

/* Delete your own comment — only visible to its author */
.comment-delete-btn {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #333a48;
  background: #171b24;
  color: #9aa3b2;
  cursor: pointer;
}

.comment-delete-btn:hover {
  border-color: #ff5c5c;
  color: #ff8a8a;
}

/* =======================
   REPORT MODAL
   Overlay window, reused for the model and for comments
   (see #reportModal in model.html).
======================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: #171b24;
  border: 1px solid #2a2f3a;
  border-radius: 18px;
  padding: 24px;
  text-align: left;
}

.modal-card label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
}

.modal-card textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
  min-height: 70px;
  resize: vertical;
}

.modal-card .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Checkbox list: more specific than ".modal-card label" so it
   doesn't inherit its display:block (we want the checkbox and
   text aligned side by side, not stacked). */
.modal-card .report-reasons-list {
  margin: 10px 0 16px;
}

.modal-card .report-reasons-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-weight: normal;
  cursor: pointer;
}

.modal-card .report-reasons-list input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* =======================
   COMMENTS - SHOW MORE
   Button to show or hide additional comments
======================= */

.show-more-comments-btn {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #333a48;
  background: #191d27;
  color: #00e0ff;
  cursor: pointer;
}

.show-more-comments-btn:hover {
  border-color: #00e0ff;
}

/* =======================
   UPLOAD - MULTI-IMAGE PREVIEW
   Shows selected images before publishing
======================= */

.images-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}

/* Thumbnail for each uploaded image */
.image-preview-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #333a48;
}

/* Removable thumbnail (model.js edit form): wraps a thumbnail with
   a small "✕" button so an existing or just-added image can be
   dropped before saving. */
.edit-image-thumb-wrapper {
  position: relative;
}

.edit-image-thumb-wrapper .image-preview-thumb {
  display: block;
}

.remove-image-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 17, 21, 0.85);
  color: #ff8a8a;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.remove-image-btn:hover {
  background: #ff5c5c;
  color: white;
}

/* =======================
   MODEL PAGE - IMAGE GALLERY
   Large image + clickable thumbnails
======================= */

.model-thumbnails {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Thumbnail on the model page */
.model-thumbnail {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #333a48;
  cursor: pointer;
  opacity: 0.65;
}

/* Selected thumbnail */
.active-thumbnail {
  border-color: #00e0ff;
  opacity: 1;
}

/* =======================
   MODEL PAGE - CREATOR ACTIONS
   Area visible only to the model's creator
======================= */

.creator-actions {
  margin-top: 22px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #333a48;
  background: #191d27;
}

.creator-actions h3 {
  margin-bottom: 12px;
}

.creator-actions button {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #171b24;
  color: white;
  cursor: pointer;
}

.creator-actions button:hover {
  border-color: #00e0ff;
  color: #00e0ff;
}

/* =======================
   "CURRENT VERSION" BADGE (top of page)
   Shown only when a model has more than one version — for most
   models (a single version), it would just be noise. The full
   history stays further down the page.
======================= */

.current-version-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 16px;
  color: #9aa3b2;
}

.current-version-badge strong {
  color: #f5f5f5;
}

/* =======================
   VERSION HISTORY
   Visible to everyone (not just the creator), in the
   "Technical information" section of the model page.
======================= */

.version-history {
  margin-top: 10px;
}

.version-entry {
  padding: 10px 0;
  border-bottom: 1px solid #2a2f3a;
}

.version-entry:last-child {
  border-bottom: none;
}

.version-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-entry .version-number {
  color: #00e0ff;
  font-weight: bold;
}

.version-entry .version-date {
  color: #9aa3b2;
  font-size: 13px;
}

.version-entry .version-changelog {
  margin-top: 4px;
  color: #ccc;
}

.version-entry .version-files {
  margin-top: 4px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

/* One link per file — a version can contain several */
.version-file-link {
  color: #00e0ff;
  text-decoration: none;
}

.version-file-link:hover {
  text-decoration: underline;
}

/* File published before real storage: shown but not clickable,
   rather than silently disappearing. */
.version-file-unavailable {
  color: #9aa3b2;
  cursor: not-allowed;
}

/* =======================
   "NEW VERSION" FORM
   Nested inside .creator-actions: we deliberately cancel the
   "width:100%" on buttons inherited from .creator-actions button
   so Publish/Cancel stay side by side instead of stacking.
======================= */

.new-version-form {
  margin-top: 14px;
  margin-bottom: 10px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #333a48;
  background: #12151d;
  text-align: left;
}

.new-version-form label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
}

.new-version-form input,
.new-version-form textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
}

.new-version-form textarea {
  min-height: 80px;
  resize: vertical;
}

.new-version-form .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.new-version-form .form-actions button {
  width: auto;
  flex: 1;
}

/* Warning shown when a model is archived */
.archived-warning {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #ffb020;
  background: rgba(255, 176, 32, 0.12);
  color: #ffcf70;
}

/* =======================
   LOGIN STATUS (HEADER)
   The "👤 username" link already inherits the "nav a" style;
   only the logout button needs its own style, to stay discreet
   next to the menu links.
======================= */

.auth-status {
  /* inline-flex, not flex: "nav" is not a flex container, its
     children (the <a> tags) flow inline. A plain "flex" here
     would blockify the <span> and push it onto its own line,
     breaking the alignment with the other menu links. */
  display: inline-flex;
  align-items: center;
  margin-left: 24px;
  gap: 12px;
  vertical-align: middle;
}

.auth-logout-btn {
  background: none;
  border: 1px solid #333a48;
  border-radius: 8px;
  color: #ddd;
  font-size: 13px;
  padding: 5px 10px;
  cursor: pointer;
}

.auth-logout-btn:hover {
  border-color: #00e0ff;
  color: #00e0ff;
}

/* =======================
   LOGIN PAGE — CARD + TABS
   .login-card frames the tabs/message/form at the same width as
   .upload-section (700px centered), so the whole block stays
   consistent instead of the tabs stretching across the full
   screen width while the form below stays narrow.
======================= */

.login-card {
  max-width: 700px;
  margin: 0 auto;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #171b24;
  color: #ddd;
  cursor: pointer;
  font-size: 15px;
}

.auth-tab.active {
  border-color: #00e0ff;
  color: #00e0ff;
}

/* Inline text link inside a message (e.g. suggestion to create
   an account next to a login error). */
.auth-inline-link {
  background: none;
  border: none;
  color: #00e0ff;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}

/* =======================
   MODERATION — REPORT CARDS
======================= */

.report-card {
  background: #191d27;
  border: 1px solid #2a2f3a;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}

.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.report-date {
  color: #9aa3b2;
  font-size: 13px;
}

.report-card .form-actions {
  margin-top: 14px;
}

.report-card .form-actions button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #333a48;
  background: #171b24;
  color: white;
  cursor: pointer;
  flex: 1;
}

.report-card .remove-content-btn {
  border-color: #ff5c5c;
  color: #ff8a8a;
}

.report-card .remove-content-btn:hover {
  background: #ff5c5c;
  color: white;
}

/* Floating panel shown on a model page when arriving from a
   moderation link (see initModerationPanel() in model.js) — stays
   fixed on screen while scrolling so the actions are always
   reachable without a trip back to the moderation queue. */
.mod-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 280px;
  background: #171b24;
  border: 1px solid #ff5c5c;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 999;
}

.mod-panel p {
  color: #ffcf70;
  margin-bottom: 10px;
}

.mod-panel-actions {
  display: flex;
  gap: 10px;
}

.mod-panel-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #333a48;
  background: #191d27;
  color: white;
  cursor: pointer;
}

#modRemoveButton {
  border-color: #ff5c5c;
  color: #ff8a8a;
}

#modRemoveButton:hover {
  background: #ff5c5c;
  color: white;
}

/* Points a moderator straight at the reported comment among
   possibly many others on the page. */
.mod-highlighted-comment {
  border-color: #ffb020 !important;
  box-shadow: 0 0 0 2px rgba(255, 176, 32, 0.4);
}