/* ==========================================================================
   Base Styles - Clean Black & White with Sharp Angles
   ========================================================================== */

@font-face {
  font-family: 'VCR OSD Mono';
  src: url('/resources/vcr_osd_mono/VCR_OSD_MONO_1.001.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #666666;
  --border-color: #333333;
  --accent: #ffffff;
  --error: #ff3333;
  --success: #00ff66;
  --warning: #ffaa00;
}

*, *::before, *::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

/* Ensure all Bootstrap and custom elements have sharp squared angles */
.btn, .card, .modal, .modal-content, .modal-dialog, .modal-header, .modal-footer,
.form-control, .form-select, select, option, .input-group, .input-group-text,
.badge, .alert, .dropdown-menu, .dropdown-item, .dropdown-toggle, .popover, .tooltip,
.toast, .progress, .progress-bar, .nav-link, .page-link,
.thumbnail-box, .folder-item, .tree-node, .tree-node-content,
.search-result-item, .comment, .comment-box, .emoji-popup,
.profile-settings-menu, .profile-settings-item, .context-menu, .context-menu-item,
.profile-edit-btn, .color-picker-group, .color-picker-grid {
  border-radius: 0 !important;
  -webkit-border-radius: 0 !important;
  -moz-border-radius: 0 !important;
}


html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  max-width: 100vw;
}

body {
  font-family: 'VCR OSD Mono', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 54px; /* Space for fixed footer */
}

button, input, select, textarea {
  font-family: inherit;
}

a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration: none;
  opacity: 0.8;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 20px;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 16px 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

p {
  margin: 0 0 12px 0;
}

/* ==========================================================================
   Navigation - Topbar
   ========================================================================== */

.topbar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-bottom: 24px;
  margin-top: 0;
  position: relative;
  z-index: 50;
}

.topbtn {
  padding: 11px 24px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 51;
}

.topbtn:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.topbtn:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="color"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  height: 40px;
}

/* Custom file input styling */
input[type="file"] {
  width: 100%;
  padding: 4px 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  height: 40px;
  line-height: 30px;
  box-sizing: border-box;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button,
input[type="file"]::file-selector-button {
  height: 100%;
  padding: 0 16px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-right: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
  border-radius: 0 !important;
}

input[type="file"]::-webkit-file-upload-button:hover,
input[type="file"]::file-selector-button:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

input[type="file"]::-webkit-file-upload-button:active,
input[type="file"]::file-selector-button:active {
  transform: scale(0.98);
}

textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--text-primary);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: 1px solid var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
  height: 40px;
  white-space: nowrap;
}

.btn:hover {
  background: transparent;
  color: var(--text-primary);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.btn-danger {
  background: var(--error);
  color: var(--bg-primary);
  border-color: var(--error);
}

.btn-danger:hover {
  background: transparent;
  color: var(--error);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

/* ==========================================================================
   Cards & Panels
   ========================================================================== */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  color: var(--text-muted);
}

/* ==========================================================================
   Tree Page Scoped Clean Layout (Strict Unscrollable Viewport at 100% Zoom)
   ========================================================================== */

html:has(body.tree-page),
body.tree-page {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.tree-page .card {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  overflow: visible !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

body.tree-page .card-header {
  display: none !important;
}

body.tree-page .tree-wrapper,
body.tree-page #tree-container {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  overflow: visible !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  width: 100%;
}

body.tree-page > .container {
  max-width: 2500px;
  width: 100%;
  height: calc(100vh - 54px) !important;
  max-height: calc(100vh - 54px) !important;
  padding-left: 16px;
  padding-right: 16px;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

body.tree-page .topbar {
  margin-bottom: 8px;
  padding: 12px 0;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

/* ==========================================================================
   Spiderweb Radial - the Web
   ========================================================================== */

:root {
  --spiderweb-color: var(--border-color, #333333);
  --spiderweb-glow: rgba(255, 255, 255, 0.12);
  --spiderweb-bg: var(--bg-primary, #0a0a0a);
}

.tree-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
  font-size: 12px;
  letter-spacing: 1px;
  flex-shrink: 0;
  position: relative;
  z-index: 30;
  width: 100%;
}

.tree-last-active {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tree-last-active-val {
  color: var(--text-primary);
}

.tree-nav-btn {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color) !important;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 6px 14px;
  transition: all 0.2s ease;
}

.tree-nav-btn:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  text-shadow: none;
}

/* Triptych layout: Left Preview - Main Web - Right Preview */
.spiderweb-triptych {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  position: relative;
  margin: 0 auto;
  overflow: visible;
}

.spiderweb-main-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 5;
  /* Shift central web vertically up by ~5% of its height */
  transform: translateY(-5%);
}

/* ==========================================================================
   DISTANCE FROM CENTER CONFIGURATION:
   Controls the spacing/overlap between the side preview webs and the central web.
   Side web width is 720px (scale 0.8 on 900px canvas).
   Roughly 20% of total width (720px * 0.20) = 144px.
   Negative margins pull the side webs symmetrically towards the center:
   - .spiderweb-side-left margin-right pulls the left preview web closer to center
   - .spiderweb-side-right margin-left pulls the right preview web closer to center
   Adjust the -144px values below to change their distance from the central web.
   ========================================================================== */
.spiderweb-side-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 4;
  opacity: 0.85;
  cursor: pointer;
  transition: opacity 0.25s ease, filter 0.25s ease, transform 0.25s ease;
}

.spiderweb-side-wrap.spiderweb-side-left {
  /* Distance from center (Left): pull 144px (~20% of 720px width) closer to center */
  margin-right: -144px;
  margin-left: 0;
}

.spiderweb-side-wrap.spiderweb-side-right {
  /* Distance from center (Right): pull 144px (~20% of 720px width) closer to center */
  margin-left: -144px;
  margin-right: 0;
}

.spiderweb-side-wrap:hover {
  opacity: 1;
  transform: scale(1.02);
  filter: drop-shadow(0 0 18px var(--spiderweb-glow, rgba(255, 255, 255, 0.25)));
}

.spiderweb-stage-main {
  position: relative;
  width: 960px;
  height: 853px;
  user-select: none;
  overflow: visible;
}

.spiderweb-stage-side {
  position: relative;
  width: 720px;
  height: 640px;
  user-select: none;
  overflow: visible;
  cursor: pointer;
}

.spiderweb-scale-inner {
  width: 900px;
  height: 800px;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.spiderweb-stage-main .spiderweb-scale-inner {
  transform: scale(1.067);
}

.spiderweb-stage-side .spiderweb-scale-inner {
  transform: scale(0.8);
}

.spiderweb-stage {
  position: relative;
  width: 100%;
  height: 100%;
  user-select: none;
  overflow: visible;
}

.spiderweb-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.spiderweb-spoke {
  stroke: var(--spiderweb-color);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0.55;
  transition: stroke 0.3s ease;
}

.spiderweb-thread {
  stroke: var(--spiderweb-color);
  stroke-width: 1.2;
  fill: none;
  opacity: 0.45;
  transition: stroke 0.3s ease, opacity 0.2s ease;
}

.spiderweb-thread.outer-ring {
  stroke-width: 1.8;
  opacity: 0.75;
}

.spiderweb-nodes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.spider-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  text-align: center;
  transition: transform 0.2s ease, filter 0.2s ease;
}

/* Center Node - Visually larger */
.spider-node-center {
  z-index: 10;
}

.spider-center-avatar-wrap {
  position: relative;
  display: inline-flex;
  padding: 4px;
  background: var(--bg-primary);
  box-shadow: 0 0 25px var(--spiderweb-glow, rgba(255, 255, 255, 0.25));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.spider-center-avatar-wrap:hover {
  transform: scale(1.06);
  box-shadow: 0 0 35px var(--spiderweb-glow, rgba(255, 255, 255, 0.4));
}

.spider-center-avatar-wrap .tree-node-pfp {
  width: 96px;
  height: 96px;
  border: 3px solid var(--text-primary);
  object-fit: cover;
  display: block;
}

.spider-center-avatar-wrap .tree-pfp-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  z-index: 6;
}

.spider-center-avatar-wrap .tree-pfp-status .user-status-dot {
  width: 15px;
  height: 15px;
  border: 2px solid var(--bg-primary);
}

.spider-center-info {
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.spider-center-name {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  line-height: 1.2;
}

.spider-center-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 1px 6px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  line-height: 1.3;
}

.spider-profile-link {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-top: 1px;
  line-height: 1.2;
  transition: color 0.15s ease;
}

.spider-profile-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Surrounding Radial Nodes */
.spider-radial-node {
  cursor: pointer;
  z-index: 5;
  padding: 6px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.spider-radial-node:hover {
  transform: translate(-50%, -50%) scale(1.15);
  z-index: 8;
}

.spider-node-avatar-wrap {
  position: relative;
  display: inline-flex;
  padding: 2px;
  background: var(--bg-primary);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.2s ease;
}

.spider-radial-node:hover .spider-node-avatar-wrap {
  box-shadow: 0 0 18px var(--spiderweb-glow, rgba(255, 255, 255, 0.3));
}

.spider-node-avatar-wrap .tree-node-pfp {
  width: 52px;
  height: 52px;
  border: 2px solid var(--text-primary);
  object-fit: cover;
  display: block;
}

.spider-node-avatar-wrap .tree-pfp-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  z-index: 6;
}

.spider-node-avatar-wrap .tree-pfp-status .user-status-dot {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--bg-primary);
}

.spider-node-tag {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
}

.spider-node-tag.parent-tag {
  color: var(--text-primary);
  letter-spacing: 1.5px;
}

.spider-node-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-top: 2px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Empty Radial Slot - Interactive Invite Copy (for own web) */
.spider-node-empty {
  cursor: pointer !important;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.spider-node-empty:hover {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1.12);
}

.spider-node-empty:hover .spider-empty-circle {
  border-color: var(--text-primary);
  color: var(--text-primary);
  box-shadow: 0 0 14px var(--spiderweb-glow, rgba(255, 255, 255, 0.35));
}

.spider-empty-circle {
  width: 48px;
  height: 48px;
  border: 1px dashed var(--spiderweb-color);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1;
  transition: all 0.2s ease;
}

.spider-empty-label {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
}

/* Unowned Empty Radial Slot - When viewing someone else's web */
.spider-node-unowned {
  cursor: default !important;
  pointer-events: none !important;
  opacity: 0.28 !important;
}

.spider-node-unowned:hover {
  transform: translate(-50%, -50%) !important;
  opacity: 0.28 !important;
}

.spider-empty-circle-disabled {
  border-style: dotted !important;
  border-color: var(--spiderweb-color) !important;
  cursor: default !important;
}

.spider-date-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 1px 6px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: none !important;
  white-space: nowrap;
}

/* Responsive Triptych adjustments */
@media (max-width: 1960px), (max-height: 900px) {
  .spiderweb-stage-main {
    width: 880px;
    height: 782px;
  }
  .spiderweb-stage-main .spiderweb-scale-inner {
    transform: scale(0.978);
  }
  .spiderweb-stage-side {
    width: 720px;
    height: 640px;
  }
  .spiderweb-stage-side .spiderweb-scale-inner {
    transform: scale(0.8);
  }
  .spiderweb-side-wrap.spiderweb-side-left {
    margin-right: -144px;
    margin-left: 0;
  }
  .spiderweb-side-wrap.spiderweb-side-right {
    margin-left: -144px;
    margin-right: 0;
  }
}

@media (max-width: 1650px), (max-height: 820px) {
  .spiderweb-stage-main {
    width: 736px;
    height: 653px;
  }
  .spiderweb-stage-main .spiderweb-scale-inner {
    transform: scale(0.818);
  }
  .spiderweb-stage-side {
    width: 574px;
    height: 510px;
  }
  .spiderweb-stage-side .spiderweb-scale-inner {
    transform: scale(0.638);
  }
}

@media (max-width: 1350px), (max-height: 720px) {
  .spiderweb-stage-main {
    width: 610px;
    height: 541px;
  }
  .spiderweb-stage-main .spiderweb-scale-inner {
    transform: scale(0.678);
  }
  .spiderweb-stage-side {
    width: 476px;
    height: 423px;
  }
  .spiderweb-stage-side .spiderweb-scale-inner {
    transform: scale(0.529);
  }
}

@media (max-width: 1100px) {
  .spiderweb-side-wrap {
    display: none !important;
  }
  .spiderweb-stage-main {
    width: 100%;
    max-width: 943px;
    height: 837px;
  }
  .spiderweb-stage-main .spiderweb-scale-inner {
    transform: scale(1.048);
  }
}

@media (min-width: 769px) and (max-height: 620px) {
  .spiderweb-stage-main {
    height: 550px;
  }
  .spiderweb-stage-main .spiderweb-scale-inner {
    transform: scale(0.63);
    transform-origin: center top;
  }
}

/* PFP & Status Dot defaults for Tree Nodes */
.tree-node-pfp {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 2px solid var(--text-primary);
  margin-bottom: 0;
}

.tree-pfp-status {
  position: absolute;
  bottom: -4px;
  right: -4px;
  z-index: 5;
  line-height: 1;
}

.tree-pfp-status .user-status-dot {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.9);
  box-shadow: 0 0 8px #00ff66, 0 0 12px rgba(0, 255, 102, 0.5);
}

/* ==========================================================================
   File Tree - Folder Structure
   ========================================================================== */

.file-tree {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 16px;
}

.file-node {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  position: relative;
}

/* Tree connector lines for visual hierarchy */
.file-node:not(.root) {
  border-left: 2px solid var(--border-color);
  margin-left: 20px;
}

.file-node:not(.root)::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  width: 12px;
  height: 50%;
  border-bottom: 2px solid var(--border-color);
}

.file-node.root {
  margin-left: 0;
  border-left: none;
}

.file-node.root::before {
  display: none;
}

.file-node.drag-over {
  background: var(--bg-tertiary);
  border-left-color: var(--text-primary);
}

.tree-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 11px;
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 4px 0 0;
  line-height: 1;
  flex-shrink: 0;
  transform: translateY(-2px);
  transition: color 0.15s ease, transform 0.15s ease;
}

.tree-toggle:hover {
  color: var(--text-primary);
  filter: brightness(1.2);
}

.tree-toggle-spacer {
  display: inline-block;
  width: 15px;
  margin-right: 4px;
  flex-shrink: 0;
}

.file-icon {
  width: 20px;
  text-align: center;
  margin-right: 8px;
  font-size: 14px;
  flex-shrink: 0;
}

.file-name {
  font-size: 14px;
  text-align: left;
}

.file-name a {
  text-decoration: none;
}

.file-name a:hover {
  text-decoration: underline;
}

.file-size {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 16px;
}

.file-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
  opacity: 0;
  transition: opacity 0.15s;
}

.file-node:hover .file-actions {
  opacity: 1;
}

.file-action-btn {
  padding: 4px 8px;
  font-size: 11px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.file-action-btn:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.notif-dropdown {
  display: none;
  position: absolute;
  right: 20px;
  top: 60px;
  z-index: 1001;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  width: 340px;
  max-height: 450px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.notif-dropdown.active {
  display: block;
}

.notif-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.notif-header.dragging {
  cursor: grabbing;
}

.notif-close-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 0 !important;
  font-family: inherit;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notif-close-btn:hover {
  border-color: var(--border-color);
  background: var(--bg-tertiary);
  color: #ff4444;
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
}

.notif-item {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover {
  background: var(--bg-tertiary);
}

.notif-item.unread {
  border-left: 2px solid var(--text-primary);
}

.notif-message {
  font-size: 13px;
  line-height: 1.5;
}

.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--error);
  color: var(--bg-primary);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  min-width: 18px;
  text-align: center;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}

.modal-close {
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

/* ==========================================================================
   Login / Signup Pages
   ========================================================================== */

.auth-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 32px;
  font-weight: 300;
  letter-spacing: 2px;
}

.auth-link {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Messages & Alerts
   ========================================================================== */

.message {
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.message-error {
  border-color: var(--error);
  color: var(--error);
}

.message-success {
  border-color: var(--success);
  color: var(--success);
}

.message-warning {
  border-color: var(--warning);
  color: var(--warning);
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
}

/* ==========================================================================
   Profile Page
   ========================================================================== */

/* Profile Header V2 - New Layout */
.profile-header-v2 {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  padding-top: 19px;
  padding-bottom: 19px;
}

.profile-avatar-v2 {
  width: 80px;
  height: 80px;
  border: 1px solid var(--border-color);
  object-fit: cover;
  flex-shrink: 0;
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.profile-info-v2 {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.profile-name-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-name-wrapper h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.profile-edit-btn {
  opacity: 0.4;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  transition: all 0.2s;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-edit-btn svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
  shape-rendering: crispEdges;
  display: block;
}

.profile-name-wrapper:hover .profile-edit-btn {
  opacity: 0.7;
}

.profile-edit-btn:hover {
  opacity: 1 !important;
  color: var(--text-primary);
  background: transparent !important;
}

.profile-edit-btn:hover svg {
  fill: var(--text-primary);
  color: var(--text-primary);
}

/* Always show edit button on touch devices */
@media (hover: none) and (pointer: coarse) {
  .profile-edit-btn {
    opacity: 0.6;
    background: transparent;
  }
}

.profile-meta-v2 {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

.profile-showroom-link {
  font-size: 13px;
  margin-top: 4px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.profile-showroom-link:hover {
  text-decoration: underline;
}

/* Stats row */
.profile-stats-v2 {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 14px 0 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.profile-stat-v2 {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.profile-stat-v2 strong {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
}

.profile-stat-v2 a {
  text-decoration: none;
  color: inherit;
}

.profile-stat-v2 a:hover {
  text-decoration: underline;
}

.profile-invite-stat {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.profile-invite-stat code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  font-size: 11px;
}

/* Profile Settings Menu */
.profile-settings-menu {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  min-width: 200px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.profile-settings-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  transition: background 0.15s;
}

.profile-settings-item .badge-exp {
  margin-left: 6px;
  line-height: 1.2;
}

.profile-settings-item:hover {
  background: var(--bg-tertiary);
}

.profile-settings-separator {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Context Menu */
.context-menu {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  min-width: 150px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.context-menu-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.context-menu-item:hover {
  background: var(--bg-tertiary);
}

.context-menu-separator {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* File Tree with Depth - Nested structure */
.file-node.level-0 { margin-left: 0 !important; border-left: none !important; }
.file-node.level-0::before { display: none !important; }

/* Nested file tree structure - children properly indented inside parent folders */
.file-node-children {
  margin-left: 0;
  padding-left: 0;
}

/* First level children inside root */
.file-node-children > .file-node {
  margin-left: 24px;
}

/* Deeper nesting - each level adds more indent */
.file-node-children .file-node-children > .file-node {
  margin-left: 48px;
}

.file-node-children .file-node-children .file-node-children > .file-node {
  margin-left: 72px;
}

.file-node-children .file-node-children .file-node-children .file-node-children > .file-node {
  margin-left: 96px;
}

.file-node-children .file-node-children .file-node-children .file-node-children .file-node-children > .file-node {
  margin-left: 120px;
}

/* Ensure connector lines work with dynamic nesting */
.file-node-children .file-node:not(.root) {
  border-left: 2px solid var(--border-color);
}

/* Legacy level classes for compatibility */
.file-node.level-1 { margin-left: 24px !important; }
.file-node.level-2 { margin-left: 48px !important; }
.file-node.level-3 { margin-left: 72px !important; }
.file-node.level-4 { margin-left: 96px !important; }
.file-node.level-5 { margin-left: 120px !important; }

/* ==========================================================================
   Search Page
   ========================================================================== */

.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: stretch;
}

.search-input-wrapper {
  flex: 4;
  position: relative;
  min-width: 500px;
}

.search-input {
  width: 100%;
  padding-left: 12px;
}

.search-bar input,
.search-bar select {
  margin: 0;
}

.search-filters {
  display: flex;
  gap: 12px;
}

.search-results {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.result-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.result-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Comments
   ========================================================================== */

.comments-section {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

.comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

.comment-author {
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.comment-time {
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: normal;
}

.comment-text {
  line-height: 1.6;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
}

.comment-input {
  margin-top: 24px;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

.comment-input label,
.comment-input .form-group label {
  text-transform: none !important;
  letter-spacing: normal !important;
}

.comment-toolbar {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  align-items: center;
}

.comment-actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.comment-action {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.comment-action:hover {
  color: var(--text-primary);
}

.icon-svg,
.topbtn-icon {
  display: inline-block;
  width: 26px;
  height: 26px;
  vertical-align: middle;
}

.icon-svg svg,
.topbtn-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.vote-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.vote-btn:hover {
  color: var(--text-primary);
}

.vote-btn.voted {
  color: var(--text-primary);
}

.vote-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
}

.vote-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.vote-down {
  transform: scaleY(-1);
}

.vote-count {
  font-size: 12px;
  font-weight: bold;
  color: var(--text-primary);
  min-width: 20px;
  text-align: center;
}

.comment-input {
  margin-top: 24px;
}

.comment-toolbar {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   File Viewer
   ========================================================================== */

.file-viewer {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
}

.file-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.file-viewer-content {
  overflow: auto;
}

.file-viewer-content pre {
  margin: 0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.file-viewer-content img {
  max-width: 100%;
  display: block;
}

.file-viewer-content audio,
.file-viewer-content video {
  width: 100%;
}

/* ==========================================================================
   Settings
   ========================================================================== */

.settings-grid {
  display: grid;
  gap: 24px;
}

.settings-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.color-picker-group {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.color-picker-group label {
  min-width: 150px;
  font-size: 13px;
}

.color-picker-group input[type="color"] {
  width: 60px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

/* ==========================================================================
   Folder UI - Grid View for Folders
   ========================================================================== */

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.folder-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.folder-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  position: relative;
}

.folder-item:hover {
  border-color: var(--text-primary);
}

.folder-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.folder-item-preview {
  position: relative;
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.cycling-thumbnail {
  animation: none;
}

/* Thumbnail Grid for Modal */
.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.thumbnail-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thumbnail-grid-with-add {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.thumbnail-card {
  position: relative;
  width: 100px;
  height: 100px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  overflow: hidden;
}

.thumbnail-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-remove:hover {
  background: var(--error);
}

.thumbnail-add-card {
  width: 100px;
  height: 100px;
  border: 2px dashed var(--border-color);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  gap: 4px;
  transition: all 0.2s;
}

.thumbnail-add-card:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.thumbnail-add-icon {
  font-size: 24px;
  font-weight: 300;
}

/* Grid view add new item card */
.folder-item-add {
  min-height: 200px;
  cursor: pointer;
  border-style: dashed;
  background: transparent;
}

.folder-item-add:hover {
  background: var(--bg-secondary);
  border-style: solid;
}

.folder-item-add-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  width: 100%;
  height: 100%;
}

.folder-add-icon {
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
}

/* User List for Followers/Following */
.user-list {
  max-height: 400px;
  overflow-y: auto;
}

.user-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.user-list-item:hover {
  background: var(--bg-tertiary);
}

.user-list-item:last-child {
  border-bottom: none;
}

.user-list-pfp {
  width: 32px;
  height: 32px;
  border: 2px solid var(--text-primary);
  object-fit: cover;
}

.user-list-name {
  font-size: 14px;
  text-decoration: none;
}

.user-list-name:hover {
  text-decoration: underline;
}

.folder-item-icon {
  font-size: 48px;
  opacity: 0.6;
}

.folder-item-info {
  padding: 12px;
}

.folder-item-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.folder-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.folder-item-date {
  color: var(--text-muted);
  font-size: 11px;
}

.like-widget {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 32px;
  height: 32px;
  cursor: pointer;
  vertical-align: middle;
  color: var(--text-primary);
}

.like-heart {
  display: block;
  width: 100%;
  height: 100%;
}

.like-heart svg {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.like-number {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
  pointer-events: none;
  line-height: 1;
  color: var(--text-primary);
}

.like-widget.liked .like-number {
  color: var(--bg-primary);
}

.folder-item-likes {
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
  font-size: 12px;
}

/* Item actions for owner */
.folder-item-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.folder-item:hover .folder-item-actions {
  opacity: 1;
}

.btn-icon {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0 !important;
  margin: 0;
  background: rgba(18, 18, 18, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box;
  line-height: 1;
  text-decoration: none;
  border-radius: 0;
  transition: all 0.15s ease;
}

.btn-icon .icon-svg {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}

.btn-icon svg {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  fill: currentColor;
  shape-rendering: crispEdges;
  display: block !important;
}

.btn-icon:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.btn-icon-edit:hover {
  background: #007acc !important;
  border-color: #007acc !important;
  color: #ffffff !important;
}

.btn-icon-thumb:hover {
  background: #9b59b6 !important;
  border-color: #9b59b6 !important;
  color: #ffffff !important;
}

.btn-icon-danger {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.4);
}

.btn-icon-danger:hover {
  background: #e74c3c !important;
  color: #ffffff !important;
  border-color: #e74c3c !important;
}

.btn-icon-inline, .btn .icon-svg, .btn .btn-icon-inline, .btn > svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: currentColor;
  shape-rendering: crispEdges;
  vertical-align: -2px;
  line-height: 1;
}

.btn-icon-inline svg, .btn .icon-svg svg, .btn .btn-icon-inline svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
  shape-rendering: crispEdges;
}

/* Grid view add new item card */
.folder-add-icon {
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Cycling Footer
   ========================================================================== */

/* Fixed Footer Container - Anchored to bottom with no gap, full width */
.footer-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border-color);
}

.footer-container .container {
  max-width: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.footer {
  display: flex;
  width: 100%;
  height: 54px;
  overflow: hidden;
}

.footer-part {
  width: 33.33%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

.footer-part:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

.footer-line {
  font-size: 12px;
  color: var(--text-primary);
  height: 16px;
  line-height: 16px;
  white-space: pre;
  overflow: hidden;
  text-align: center;
  padding: 0 8px;
  box-sizing: border-box;
}

.footer-line-scroll {
  position: relative;
  text-align: left;
}

.footer-scroll-text {
  display: inline-block;
  white-space: pre;
  padding-left: 100%;
  animation: footer-scroll 15s linear infinite;
  will-change: transform;
}

@keyframes footer-scroll {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}



/* ==========================================================================
   Folder Grid Overlay Title Card
   ========================================================================== */

.folder-item {
  position: relative;
  overflow: hidden;
}

.folder-item-preview {
  height: 200px;
}

.folder-item-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
}

.folder-item-info .folder-item-name {
  color: #fff;
  margin-bottom: 4px;
}

.folder-item-info .folder-item-meta {
  color: rgba(255, 255, 255, 0.8);
}

.folder-item-info .like-widget {
  color: var(--text-primary);
}

.folder-item-info .folder-item-likes {
  color: rgba(255, 255, 255, 0.8);
}

.folder-item-info .folder-item-likes.liked,
.folder-item-info .folder-item-likes:hover {
  color: #ff6b6b;
}

.folder-item-date {
  color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   Emoji Picker
   ========================================================================== */

.emoji-picker-wrapper {
  position: relative;
  display: inline-block;
}

.emoji-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 8px;
  border-radius: 0 !important;
  z-index: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  width: 290px;
  max-width: 90vw;
  flex-direction: column;
  gap: 8px;
}

.emoji-popup.active {
  display: flex;
}

.emoji-popup-header {
  display: flex;
  gap: 6px;
  align-items: center;
}

.emoji-search-bar {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  border-radius: 0 !important;
  outline: none;
  height: 28px;
}

.emoji-search-bar:focus {
  border-color: var(--text-primary);
}

.emoji-grid-scroll {
  max-height: 180px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding-right: 2px;
}

.emoji-item-btn {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  font-size: 18px;
  border-radius: 0 !important;
  transition: all 0.12s ease;
}

.emoji-item-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  transform: scale(1.08);
}

.emoji-item-btn img {
  max-width: 26px;
  max-height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.emoji-popup-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  font-size: 10px;
}

/* Site-wide inline custom emojis */
.custom-inline-emoji {
  width: 22px;
  height: 22px;
  vertical-align: -4px;
  object-fit: contain;
  image-rendering: pixelated;
  display: inline-block;
  margin: 0 2px;
}

/* ==========================================================================
   Comment Threading & Replies
   ========================================================================== */

.comment-pfp-wrapper {
  position: relative;
  display: inline-flex;
  margin-right: 8px;
  flex-shrink: 0;
  vertical-align: middle;
}

.comment-pfp {
  width: 32px;
  height: 32px;
  border-radius: 0;
  object-fit: cover;
  border: 2px solid var(--text-primary);
  flex-shrink: 0;
}

.comment-pfp-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  z-index: 2;
  line-height: 1;
}

.comment-pfp-status .user-status-dot {
  width: 7px;
  height: 7px;
  border: 1px solid rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 5px #00ff66;
}

/* PFP wrapper with hat overlay */
.pfp-wrapper {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.pfp-wrapper .pfp-hat {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  object-fit: contain;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comment-header-left {
  display: flex;
  align-items: center;
}

.comment-replies {
  margin-left: 20px;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--border-color);
}

.comment-reply-form {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0;
}

.comment-reply-form textarea {
  width: 100%;
  min-height: 60px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px;
  border-radius: 0;
  resize: vertical;
  font-family: inherit;
}

.comment-reply-form .reply-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.comment-collapse-btn {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 8px;
}

.comment-collapse-btn:hover {
  color: var(--text-primary);
}

.comment-replies.hidden {
  display: none;
}


/* ==========================================================================
   Responsive Styles - Mobile Accessibility
   ========================================================================== */

/* Topbar mobile menu */
.topbar {
  flex-wrap: wrap;
}

.topbar-toggle {
  display: none;
  width: 100%;
  padding: 11px 24px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.topbar-menu {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
}

/* Tablet and below */
@media (max-width: 991px) {
  .container {
    padding: 0 16px 16px;
  }

  .tree-wrapper {
    padding: 20px;
  }

  .tree-children {
    gap: 20px;
  }

  .file-viewer {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }
}

/* Small tablets and large phones */
@media (max-width: 768px) {
  /* Hide footer completely on mobile */
  .footer-container {
    display: none !important;
  }

  body {
    padding-bottom: 0 !important;
  }

  body.tree-page > .container {
    height: 100vh !important;
    max-height: 100vh !important;
  }

  /* Mobile Tree Notice ("Not available on mobiel. Use a pc like a normal person") */
  .mobile-tree-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    min-height: 240px;
    padding: 24px 16px;
    box-sizing: border-box;
  }

  .mobile-tree-box {
    border: 1px solid var(--border-color);
    background: var(--bg-primary, #000000);
    padding: 28px 24px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  }

  .mobile-tree-text {
    color: var(--text-primary);
    font-family: var(--font-primary, monospace);
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: 0.5px;
  }

  .topbar-toggle {
    display: flex;
  }

  .topbar-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    padding: 8px 0;
  }

  .topbar-menu.open {
    display: flex;
  }

  .topbar-menu .topbtn {
    width: 100%;
    border: none;
    border-radius: 0;
    text-align: center;
    justify-content: center;
  }

  /* Compact Mobile App Style Search Bar */
  .search-bar {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "input btn"
      "cat order" !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    background: var(--card-bg, rgba(15, 15, 15, 0.95)) !important;
    border: 1px solid var(--border-color) !important;
    padding: 8px !important;
    box-sizing: border-box !important;
  }

  .search-input-wrapper {
    grid-area: input !important;
    min-width: 0 !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .search-input {
    width: 100% !important;
    height: 38px !important;
    font-size: 13px !important;
    padding: 6px 10px !important;
    background: var(--bg-primary, #000000) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }

  .search-bar > .btn {
    grid-area: btn !important;
    height: 38px !important;
    padding: 0 16px !important;
    font-size: 13px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }

  #categorySelect {
    grid-area: cat !important;
    height: 34px !important;
    font-size: 12px !important;
    padding: 4px 8px !important;
    background: var(--bg-primary, #000000) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    min-width: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }

  #orderSelect {
    grid-area: order !important;
    height: 34px !important;
    font-size: 12px !important;
    padding: 4px 8px !important;
    background: var(--bg-primary, #000000) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    min-width: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }

  .profile-header-v2 {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .profile-info-v2 {
    align-items: center;
  }

  .profile-stats-v2 {
    gap: 16px;
    justify-content: center;
  }

  .profile-invite-stat {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .file-viewer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .comment-toolbar {
    flex-wrap: wrap;
  }

  .notif-dropdown {
    left: 16px;
    right: 16px;
    width: auto;
    top: 56px;
  }

  .modal-content {
    width: 95%;
    max-width: none;
  }

  .auth-container {
    margin: 40px auto;
    padding: 24px;
    max-width: 90%;
  }

  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .context-menu,
  .profile-settings-menu {
    max-width: calc(100vw - 32px);
  }

  .emoji-popup {
    left: auto;
    right: 0;
    min-width: 200px;
  }
}

/* Phones */
@media (max-width: 575px) {
  body {
    font-size: 13px;
    padding-bottom: 0 !important;
  }

  .container {
    padding: 0 12px 12px;
  }

  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }

  .tree-wrapper {
    padding: 0;
  }

  .file-node-children > .file-node {
    margin-left: 12px !important;
  }

  .file-node-children .file-node-children > .file-node {
    margin-left: 24px !important;
  }

  .file-node-children .file-node-children .file-node-children > .file-node {
    margin-left: 36px !important;
  }

  .file-node-children .file-node-children .file-node-children .file-node-children > .file-node {
    margin-left: 48px !important;
  }

  .file-node-children .file-node-children .file-node-children .file-node-children .file-node-children > .file-node {
    margin-left: 60px !important;
  }

  .comment-replies {
    margin-left: 8px;
    padding-left: 8px;
  }

  .comment-pfp {
    width: 28px;
    height: 28px;
  }

  .notif-dropdown {
    max-height: 70vh;
  }

  .notif-list {
    max-height: calc(70vh - 50px);
  }

  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .btn {
    padding: 10px 16px;
  }

  .topbtn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .auth-container h1 {
    font-size: 20px;
  }
}

/* Very small phones */
@media (max-width: 359px) {
  .folder-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-stats-v2 {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}

/* ==========================================================================
   Range Sliders - Retro Squared Aesthetic & Theme Color
   ========================================================================== */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
  margin: 6px 0 12px 0;
}

input[type="range"]:focus {
  outline: none;
}

/* Track */
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0 !important;
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0 !important;
}

/* Thumb - Sharp square, themed with user's text-primary */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  width: 18px;
  background: var(--text-primary);
  border: 2px solid var(--bg-primary);
  border-radius: 0 !important;
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 0 0 1px var(--border-color);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

input[type="range"]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  background: var(--text-primary);
  border: 2px solid var(--bg-primary);
  border-radius: 0 !important;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-color);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--text-primary);
}

input[type="range"]:hover::-moz-range-thumb,
input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--text-primary);
}

/* ==========================================================================
   Color Picker 2x2 Arrangement
   ========================================================================== */

.color-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.color-picker-grid .color-picker-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 0;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0 !important;
}

.color-picker-grid .color-picker-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin: 0;
  min-width: unset;
}

.color-picker-grid .color-picker-group .color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.color-picker-grid .color-picker-group input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-color);
  background: none;
  cursor: pointer;
  border-radius: 0 !important;
  flex-shrink: 0;
}

.color-picker-grid .color-picker-group .color-hex-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0 10px;
  border-radius: 0 !important;
  box-sizing: border-box;
}

.color-picker-grid .color-picker-group .color-hex-input:focus {
  outline: none;
  border-color: var(--text-primary);
}

/* ==========================================================================
   Pixel Art File Icons - Sharp Crisp Vectors with User Colors
   ========================================================================== */

.pixel-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  color: inherit;
  flex-shrink: 0;
}

.pixel-file-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  shape-rendering: crispEdges;
  display: block;
}

.file-icon .pixel-file-icon {
  margin-right: 4px;
}

.folder-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-primary);
}

.folder-item-icon .pixel-file-icon,
.folder-item-icon .pixel-file-icon svg {
  width: 52px;
  height: 52px;
}

.folder-table .file-icon .pixel-file-icon,
.folder-table .file-icon .pixel-file-icon svg {
  width: 18px;
  height: 18px;
}

/* Clean Modal Action Buttons */
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 16px;
}

/* ==========================================================================
   MySpace-style Custom Profile HTML & CSS
   ========================================================================== */

.user-custom-profile-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.user-custom-profile-content {
  word-break: break-word;
  position: relative;
}

.user-custom-profile-content img {
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   Modular Custom Profile 3-Column Screen Layout:
   Left Flank Modules | Central Profile Container | Right Flank Modules
   ========================================================================== */
.profile-tri-container {
  display: flex;
  justify-content: center;
  align-items: stretch; /* allows flank columns to span full page height for sticky modules */
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  padding: 0;
  margin: 0 auto 30px;
  gap: 0;
}

.profile-center-main {
  /* Central profile column: exactly matches .container dimensions (1000px max, 20px padding) */
  width: 1000px;
  max-width: 1000px;
  flex: 0 0 1000px;
  padding: 0 20px 20px;
  box-sizing: border-box;
  min-width: 0;
}

.profile-side-modules {
  /* Side module columns: take up all available unused space outside central container, starting flush with topbar */
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 12px;
  position: relative;
}

.profile-side-left {
  padding-left: 16px;
  padding-right: 16px;
}

.profile-side-right {
  padding-left: 16px;
  padding-right: 16px;
}

.user-profile-module-item {
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
  word-break: break-word;
  border: none;
  background: transparent;
  padding: 0;
  margin-bottom: 16px;
  position: relative;
  transition: opacity 0.15s ease;
}

.user-profile-module-item:has(.module-profile-wrap) {
  margin-bottom: 8px;
}

.module-description-wrap {
  margin-top: 0;
  margin-bottom: 14px;
}

.profile-description-box {
  margin: 0;
  padding: 0;
}

.profile-side-modules .user-profile-module-item:has(.is-sticky),
.profile-side-modules .user-profile-module-item.is-sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 20px;
  z-index: 40;
}

.profile-side-modules .user-profile-module-item:has(.is-fixed),
.profile-side-modules .user-profile-module-item.is-fixed {
  position: fixed;
  z-index: 40;
}

/* Drag and Drop Module Reordering */
.module-drag-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.5px;
  cursor: grab;
  user-select: none;
  margin-bottom: 6px;
  opacity: 0.35;
  transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  pointer-events: auto !important;
  position: relative;
  z-index: 100;
}

.module-drag-bar:hover {
  opacity: 1;
  border-color: var(--text-secondary);
  background: var(--bg-secondary);
}

.module-drag-bar:active {
  cursor: grabbing;
}

.module-drag-handle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
}

.module-drag-icon {
  font-size: 13px;
  line-height: 1;
  color: var(--accent);
}

.module-drag-hint {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.user-profile-module-item.is-dragging {
  opacity: 0.35;
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.user-profile-module-item.drag-over-top {
  border-top: 2px solid var(--accent) !important;
}

.user-profile-module-item.drag-over-bottom {
  border-bottom: 2px solid var(--accent) !important;
}

@media (max-width: 1100px) {
  .profile-tri-container {
    flex-direction: column;
    align-items: center;
    padding: 0;
    gap: 0;
  }
  .profile-center-main {
    flex: 0 0 auto;
    width: 100%;
    max-width: 1000px;
    padding: 0 20px 20px;
  }
  .profile-side-modules {
    width: 100%;
    max-width: 1000px;
    padding: 0 20px 20px;
  }
  .profile-side-left,
  .profile-side-right {
    padding: 0 20px 20px;
  }
}

/* Custom Profile Editor Modal */
.editor-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.editor-tab {
  padding: 8px 16px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-bottom: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
  border-radius: 0 !important;
}

.editor-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.editor-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
  border-bottom: 1px solid var(--bg-primary);
  margin-bottom: -1px;
}

.code-editor-textarea {
  width: 100%;
  min-height: 240px;
  background: #050505;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px;
  font-family: 'VCR OSD Mono', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
  resize: vertical;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  border-radius: 0 !important;
}

.code-editor-textarea:focus {
  outline: none;
  border-color: var(--text-primary);
}

.editor-preview-box {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  min-height: 80px;
  max-height: 220px;
  overflow-y: auto;
}

/* Online status indicator dot */
.user-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  vertical-align: middle;
  flex-shrink: 0;
}

.user-status-dot.online {
  background: #00ff66;
  box-shadow: 0 0 6px #00ff66, 0 0 10px rgba(0, 255, 102, 0.4);
}

.user-status-dot.offline {
  display: none !important;
}

.profile-pfp-status .user-status-dot {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 8px #00ff66, 0 0 14px rgba(0, 255, 102, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.8);
}

/* GitHub-Style Code Viewer */
.github-code-container {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow: hidden;
  margin-top: 12px;
}

.github-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 12px;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.github-code-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.github-code-meta strong {
  color: var(--text-primary);
}

.github-lang-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.github-code-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.github-code-scroll {
  overflow-x: auto;
  max-height: 80vh;
  background: #181a1f;
}

.github-code-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  line-height: 20px;
}

.github-code-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.code-line-num {
  width: 1%;
  min-width: 44px;
  padding: 0 12px;
  text-align: right;
  color: var(--text-muted);
  opacity: 0.45;
  user-select: none;
  vertical-align: top;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.code-line-text {
  padding: 0 12px;
  white-space: pre;
  word-break: normal;
  vertical-align: top;
  color: #abb2bf;
}

/* Profile Avatar Online Indicator */
.profile-pfp-wrapper {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  line-height: 0;
}

.profile-pfp-status {
  position: absolute;
  bottom: -4px;
  right: -4px;
  z-index: 5;
  line-height: 1;
}

.profile-pfp-status .user-status-dot {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.9);
  box-shadow: 0 0 8px #00ff66, 0 0 12px rgba(0, 255, 102, 0.5);
}

/* Sleek GitHub-Style File Table */
.folder-list-container {
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
}

.gh-file-table {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: 0 !important;
  overflow-x: auto;
  margin-top: 12px;
}

.gh-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.gh-table thead tr {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.gh-table th {
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
  border: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-th-name {
  cursor: pointer;
  width: 36%;
}

.gh-th-desc {
  width: 26%;
}

.gh-th-date {
  cursor: pointer;
  white-space: nowrap;
  width: 16%;
}

.gh-th-size {
  cursor: pointer;
  white-space: nowrap;
  width: 10%;
}

.gh-th-actions {
  cursor: pointer;
  white-space: nowrap;
  width: 12%;
  text-align: right;
}

.gh-th-name:hover, .gh-th-date:hover, .gh-th-size:hover, .gh-th-actions:hover {
  color: var(--text-primary);
}

.gh-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.15s ease;
}

.gh-row:last-child {
  border-bottom: none;
}

.gh-row:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.gh-table td {
  padding: 8px 14px;
  vertical-align: middle !important;
  border: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-table td.gh-col-name {
  display: table-cell !important;
  vertical-align: middle !important;
  white-space: nowrap;
}

.gh-col-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  vertical-align: middle;
  line-height: normal;
  max-width: 100%;
  min-width: 0;
}

.gh-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
}

.gh-file-icon .pixel-file-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin: 0 !important;
}

.gh-file-icon .icon-svg, .gh-file-icon svg {
  width: 16px;
  height: 16px;
  margin: 0 !important;
  display: block;
}

.gh-name-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  line-height: normal;
}

.gh-name-link:hover {
  text-decoration: underline;
  color: var(--text-primary);
}

.gh-col-desc {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.gh-cat-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  padding: 1px 6px;
  border: none;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 !important;
  margin-right: 6px;
  letter-spacing: 0.5px;
  vertical-align: middle;
  line-height: normal;
  flex-shrink: 0;
}

.gh-col-date {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  vertical-align: middle;
}

.gh-col-size {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  font-family: monospace;
  vertical-align: middle;
}

.gh-col-actions {
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.gh-col-actions .like-widget {
  display: inline-flex;
  margin-right: 0;
  vertical-align: middle;
  flex-shrink: 0;
}

.gh-col-actions .gh-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  vertical-align: middle;
}

.gh-col-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  background: transparent;
  border: none;
  padding: 3px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  color: var(--text-primary);
}

.gh-col-actions .btn-icon:hover {
  opacity: 1;
}

/* Folder Header Breadcrumbs */
.folder-header-left {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.folder-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'VCR OSD Mono', monospace !important;
  font-size: 18px;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.folder-breadcrumb-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.folder-breadcrumb-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.folder-breadcrumb-sep {
  color: var(--text-muted);
  user-select: none;
  font-size: 16px;
}

.folder-breadcrumb-current {
  color: var(--text-primary);
  font-weight: bold;
}

.gh-row-parent {
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
}

.gh-row-parent:hover {
  background: rgba(255, 255, 255, 0.04);
}

.gh-row-parent .gh-col-name {
  font-weight: 600;
}

/* Modular Profile Code Editor */
.module-code-editor {
  width: 100%;
  height: 480px;
  min-height: 320px;
  border: 1px solid var(--border-color);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  border-radius: 0 !important;
  background: #1d1f21;
}

.code-editor-textarea {
  width: 100%;
  height: 480px;
  background: #1d1f21;
  color: #abb2bf;
  border: 1px solid var(--border-color);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  border-radius: 0 !important;
}

/* ==========================================================================
   GitHub Sync & onlygitbot Automation Styles
   ========================================================================== */

.badge-exp {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  background: var(--text-primary);
  color: var(--bg-primary);
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-left: 4px;
  border-radius: 0 !important;
}

.btn-github-sync {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 3px 10px;
  font-size: 12px;
  transition: all 0.15s ease;
}

.btn-github-sync:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.btn-github-sync:hover .badge-exp {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.alert-warning-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 14px;
}

.github-bot-guide {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  margin-bottom: 14px;
}

.badge-bot {
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  font-family: monospace;
}

.badge-status-online {
  font-size: 10px;
  font-weight: bold;
  color: #00ff66;
  border: 1px solid #00ff66;
  padding: 1px 5px;
  margin-left: auto;
  letter-spacing: 0.5px;
}

.github-toggle-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  margin-bottom: 14px;
}

/* Cyber Square Switch */
.cyber-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  flex-shrink: 0;
  margin: 0;
}

.cyber-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cyber-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: 0.2s;
}

.cyber-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  transition: 0.2s;
}

.cyber-switch input:checked + .cyber-slider {
  background: rgba(0, 255, 102, 0.15);
  border-color: #00ff66;
}

.cyber-switch input:checked + .cyber-slider:before {
  transform: translateX(22px);
  background: #00ff66;
  box-shadow: 0 0 6px #00ff66;
}

/* Actions Grid */
.github-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 600px) {
  .github-actions-grid {
    grid-template-columns: 1fr;
  }
}

.btn-github-action {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  text-align: left !important;
  padding: 14px 16px !important;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  transition: all 0.15s ease !important;
  cursor: pointer;
  border-radius: 0 !important;
  height: auto !important;
  min-height: 80px !important;
  white-space: normal !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-sizing: border-box;
}

.btn-github-action:hover:not(:disabled) {
  background: var(--bg-tertiary) !important;
  border-color: var(--text-primary) !important;
  color: var(--text-primary) !important;
  transform: translateY(-1px);
}

.btn-github-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-action-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.btn-action-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: normal;
  text-transform: none;
}

.github-status-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  font-size: 12px;
}

.status-badge {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  letter-spacing: 0.5px;
}

.status-badge.status-idle {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.status-badge.status-syncing {
  background: var(--text-primary);
  color: var(--bg-primary);
  animation: pulse 1.2s infinite;
}

.status-badge.status-success {
  background: #00ff66;
  color: #000;
}

.status-badge.status-error {
  background: #ff3344;
  color: #fff;
}

/* GitHub Verification Check on Profile (Borderless, No Hover Change) */
.profile-github-synced-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background: transparent !important;
  border: none !important;
  padding: 0;
  margin-left: 0;
  text-decoration: none;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
  border-radius: 0;
}

.profile-github-synced-badge:hover {
  background: transparent !important;
  border: none !important;
  color: var(--text-primary) !important;
  opacity: 1 !important;
}

.profile-github-synced-badge .icon-svg,
.profile-github-synced-badge svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  display: block;
}

/* Tree GitHub Badge */
.tree-github-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: var(--text-muted);
  vertical-align: middle;
}

.tree-github-badge svg,
.tree-github-badge .icon-svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  display: block;
}

/* Settings UI Layout Refinements */
.settings-container {
  max-width: 820px;
  margin: 0 auto;
}

.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
}

.settings-card-header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0;
}

.settings-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.settings-field-group {
  margin-bottom: 20px;
}

.settings-field-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.settings-field-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ==========================================================================
   File Viewer: Video Player
   Preserves original aspect ratio tightly without horizontal letterbox bars
   ========================================================================== */
.file-video-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0 auto;
  background: transparent;
  border: none;
}

.file-video-player {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border-color);
  background: #000000;
  outline: none;
  box-sizing: border-box;
}

/* ==========================================================================
   Folder View: Blog Mode
   Sequential display of folder file entries as a single stream / blog feed
   ========================================================================== */

.folder-blog-container {
  width: 100%;
  padding: 12px 0 32px 0;
}

.blog-feed {
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.blog-entry {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  position: relative;
  box-sizing: border-box;
}

.blog-entry-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 6px 0;
}

.blog-entry-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.blog-entry-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.blog-entry-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.blog-entry-title a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

.blog-download-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: underline;
  white-space: nowrap;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: color 0.15s ease;
  font-family: inherit;
}

.blog-download-link:hover {
  color: var(--text-primary);
}

.blog-entry-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 4px 0 10px 0;
}

.blog-entry-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 10px 0 18px 0;
  width: 100%;
}

.blog-entry-body {
  margin: 0;
  line-height: 1.7;
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-word;
}

/* Media wrappers */
.blog-media-wrap {
  text-align: center;
  margin: 12px 0;
}

.blog-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border: 1px solid var(--border-color);
  display: inline-block;
  background: #000;
}

.blog-video-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 12px 0;
}

.blog-video {
  max-width: 100%;
  max-height: 70vh;
  border: 1px solid var(--border-color);
  background: #000;
  outline: none;
}

.blog-audio-wrap audio {
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  outline: none;
}

.blog-pdf-wrap {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border-color);
  margin: 12px 0;
}

.blog-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.blog-subfolder-box {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  font-size: 14px;
}

.blog-file-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  text-align: center;
}

/* Blog Markdown & Prose content */
.blog-prose-content {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 14px;
}

.blog-markdown-content {
  line-height: 1.7;
}

.blog-h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 20px 0 10px 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
  color: var(--text-primary);
}

.blog-h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 16px 0 8px 0;
  color: var(--text-primary);
}

.blog-h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 14px 0 6px 0;
  color: var(--text-secondary);
}

.blog-p {
  margin: 0 0 14px 0;
}

.blog-quote {
  margin: 14px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--text-secondary);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-style: italic;
}

.blog-hr {
  border: none;
  border-top: 1px dashed var(--border-color);
  margin: 20px 0;
}

.blog-md-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  margin: 10px 0;
}

.blog-link {
  color: var(--text-primary);
  text-decoration: underline;
}

.blog-link:hover {
  color: var(--text-secondary);
}

.blog-ul {
  margin: 8px 0 14px 20px;
  padding: 0;
}

.blog-li {
  margin-bottom: 4px;
}

.blog-code-block {
  background: #0d0d0d;
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}

.blog-code-content {
  background: #0d0d0d;
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}

.blog-docx-doc {
  background: #ffffff;
  color: #000000;
  padding: 24px;
  border: 1px solid var(--border-color);
  max-height: 80vh;
  overflow-y: auto;
}



/* Rendered HTML Site mode in folder view */
.folder-rendered-html-container {
  width: 100%;
  margin: 12px 0 24px 0;
}


