/* Crakcode old UI cleanup patch
   Non-destructive overlay: keeps your previous UI and fixes visible leaks/glitches. */

:root {
  --cc-clean-bg: #2b2d31;
  --cc-clean-panel: #313338;
  --cc-clean-panel2: #383a40;
  --cc-clean-text: #f2f3f5;
  --cc-clean-muted: #b5bac1;
  --cc-clean-accent: #5865f2;
}

/* Stop ugly horizontal bars and outside overflow */
html,
body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
  background: var(--cc-clean-bg) !important;
}

/* Keep vertical scrolling inside app panels but make it cleaner */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(180, 188, 208, .45) transparent;
}

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

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(180, 188, 208, .35);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(220, 225, 238, .55);
}

/* Hide text leak containers created by broken escaped template strings */
.cc-clean-hidden,
[data-cc-clean-hidden="true"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Hide any old broken admin side panel unless explicitly re-opened by the CEO flow */
#adminPanelLeak,
#cc-admin-leak,
.cc-admin-leak,
.admin-panel-leak,
[data-admin-leak="true"] {
  display: none !important;
}

/* Fix viewport fit issues in the old UI without changing the design */
body > div:first-child,
#app,
.app,
.main-app,
.discord-app,
.crakcode-app {
  max-width: 100vw !important;
}

/* Remove accidental text columns at far left/right */
body > .stray-text,
body > .newline-leak,
body > .admin-text-leak {
  display: none !important;
}

/* Cleaner old panel look: only soft polish, not full redesign */
button,
[role="button"] {
  transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}

button:hover,
[role="button"]:hover {
  transform: translateY(-1px);
}

/* Prevent profile/admin modals from overflowing outside the screen */
[role="dialog"],
.modal,
.profile-modal,
.admin-modal,
.settings-modal {
  max-width: min(96vw, 1400px) !important;
  max-height: 92vh !important;
}

/* If the old app injected a visible admin text panel on the right, hide it for normal users */
body.cc-not-ceo .admin-panel,
body.cc-not-ceo #adminPanel,
body.cc-not-ceo [data-admin-panel],
body.cc-not-ceo .admin-modal:not(.cc-open-admin) {
  display: none !important;
}

/* CEO admin button can stay clean */
body.cc-is-ceo .cc-admin-shield {
  display: grid !important;
}

/* Hide broken literal backslash-n visual text if it became an element */
span:empty,
div:empty {
  /* no hard hide because old app may use empty icons */
}

/* Make old page more screen-size friendly */
@media (max-width: 900px) {
  .right-sidebar,
  .activity-panel,
  .members-panel {
    display: none !important;
  }

  .left-sidebar,
  .server-sidebar {
    max-width: 320px !important;
  }
}
