@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap");

:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --surface0: #313244;
  --text: #cdd6f4;
  --subtext0: #a6adc8;
  --subtext1: #bac2de;
  --green: #a6e3a1;
  --teal: #94e2d5;
  --sky: #89dceb;
  --mauve: #cba6f7;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  font-family: "JetBrains Mono", monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  color: var(--text);
  background-color: var(--base);
  overflow-x: hidden;
  background-image:
    linear-gradient(rgba(166, 227, 161, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(166, 227, 161, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  background-attachment: fixed;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.25;
  animation: float 25s infinite alternate ease-in-out;
  pointer-events: none;
}

body::before {
  width: 450px;
  height: 450px;
  background: var(--green);
  top: -150px;
  left: -150px;
}

body::after {
  width: 350px;
  height: 350px;
  background: var(--mauve);
  bottom: -100px;
  right: -100px;
  animation-delay: -7s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(120px, 80px) scale(1.1);
  }
  100% {
    transform: translate(-80px, 120px) scale(0.9);
  }
}

main {
  text-align: center;
  background: rgba(24, 24, 37, 0.75);
  backdrop-filter: blur(12px);
  padding: 2.5rem;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  border: 1px solid rgba(166, 227, 161, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: entry 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 10;
}

@keyframes entry {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Tab Navigation */
.tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 2rem;
  background: var(--mantle);
  padding: 6px;
  border-radius: 14px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--subtext0);
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: 0.2s ease;
  font-family: inherit;
}

.tab-btn.active {
  background: var(--surface0);
  color: var(--green);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.page {
  display: none;
}
.page.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Profile Elements */
.profile-pic {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px solid var(--green);
  object-fit: cover;
  margin-bottom: 1rem;
  box-shadow: 0 0 15px rgba(166, 227, 161, 0.2);
}

.avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--green);
  object-fit: cover;
  margin: 0;
}

/* Forum User Avatar Fix */
#user_info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1.5rem;
}

#user_avatar {
  width: 40px;
  height: 40px;
  margin-bottom: 0;
  border-width: 1px;
}

h1 {
  font-size: 1.7rem;
  margin-bottom: 0.4rem;
  background: linear-gradient(
    90deg,
    var(--teal),
    var(--green),
    var(--mauve),
    var(--teal)
  );
  background-size: 300%;
  animation: gradientShift 6s linear infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

@keyframes gradientShift {
  from {
    background-position: 0%;
  }
  to {
    background-position: 300%;
  }
}

h2 {
  color: var(--green);
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}

.tagline {
  color: var(--subtext0);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Layout Grids */
main nav,
.grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.link-card,
.item-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface0);
  color: var(--text);
  text-decoration: none;
  padding: 1rem;
  border-radius: 12px;
  font-weight: 600;
  transition: 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.link-card:hover,
.item-card:hover {
  background: rgba(166, 227, 161, 0.1);
  border-color: var(--green);
  color: var(--green);
  transform: translateX(6px);
  box-shadow: 0 0 20px rgba(166, 227, 161, 0.25);
}

/* Messaging/Toasts */
.toast {
  font-size: 0.85rem;
  color: var(--green);
  opacity: 0;
  transform: translateY(-10px);
  transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

.toast.show {
  opacity: 1;
  height: 40px;
  margin-top: 15px;
  transform: translateY(0);
}

/* Header Nav */
.top-nav {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  z-index: 1000;
}

.nav-link {
  text-decoration: none;
  color: var(--subtext0);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 8px;
  transition: 0.3s ease;
}

.nav-link:hover {
  color: var(--text);
  background-color: var(--surface0);
}

.nav-link.active {
  color: var(--green);
  font-weight: 600;
}

/* Shared Utilities */
.alias-text {
  font-size: 0.8rem;
  opacity: 0.7;
}

.copy-text {
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: left;
  color: var(--subtext0);
}

.no-underline {
  text-decoration: none;
}

.auth-title {
  margin-bottom: 0.5rem;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.main-wide {
  max-width: 600px !important;
}

.section-gap {
  margin-bottom: 1.5rem;
}

.hub-user-name {
  color: var(--green);
  font-weight: 600;
}

.hub-action-link {
  text-decoration: none;
  padding: 4px 8px;
}

.hub-action-login {
  color: var(--sky);
}

.hub-action-chat {
  color: var(--teal);
}

.hub-action-logout {
  color: var(--mauve);
  padding: 4px 8px;
}

.editor-block {
  margin-bottom: 2rem;
}

.field-thread {
  min-height: 120px;
  margin-top: 0.75rem;
}

.field-bug {
  min-height: 80px;
}

.row-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.icon-gap {
  margin-right: 8px;
}

.author-name-thread {
  color: var(--sky);
}

.author-name-reply {
  color: var(--teal);
}

.meta-time {
  margin-left: auto;
  color: var(--subtext0);
}

.reply-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

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

.bug-title {
  margin: 10px 0 5px;
  font-size: 1rem;
  color: var(--text);
}

.bug-desc {
  font-size: 0.85rem;
  color: var(--subtext0);
}

@media (max-width: 640px) {
  body {
    padding-top: 4.25rem;
  }

  .top-nav {
    left: 50%;
    right: auto;
    top: 10px;
    transform: translateX(-50%);
    gap: 8px;
    justify-content: center;
  }

  .nav-link {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
}

/* Form Styling */
input,
textarea {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background-color: var(--mantle);
  color: var(--text);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  appearance: none;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(166, 227, 161, 0.15);
}

input::placeholder {
  color: var(--subtext0);
  opacity: 0.5;
}

/* Post Cards */
.post-card {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.post-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--surface0);
  padding-bottom: 0.5rem;
}

.post-content {
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-wrap;
  text-align: left;
}

.thread-root {
  text-align: left;
}

.thread-clickable {
  cursor: pointer;
}

.thread-title {
  margin: 0 0 0.6rem;
  color: var(--green);
  font-size: 1rem;
}

.thread-meta {
  margin-top: 1rem;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  color: var(--subtext0);
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.thread-replies {
  margin-top: 1rem;
  border-top: 1px solid var(--surface0);
  padding-top: 0.75rem;
}

.thread-reply {
  border: 1px solid var(--surface0);
  border-radius: 10px;
  background: rgba(137, 180, 250, 0.05);
  padding: 0.75rem;
  margin-top: 0.6rem;
}

.thread-reply-header {
  margin-bottom: 0.5rem;
  border-bottom: 0;
  padding-bottom: 0;
}

.reply-editor {
  margin-top: 0.9rem;
  border-top: 1px dashed var(--surface0);
  padding-top: 0.9rem;
}

.thread-reply-input {
  min-height: 80px;
}

.thread-view-header {
  margin-bottom: 0.75rem;
  text-align: left;
}

.thread-back-link {
  color: var(--sky);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
}

.thread-back-link:hover {
  color: var(--green);
  text-decoration: underline;
}

/* Forum Utilities */
.search-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-wrapper i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtext0);
  z-index: 5;
}

#global_search {
  padding-left: 45px;
  margin-bottom: 0;
  text-align: left;
}

.post-card.bug {
  border-left: 4px solid var(--mauve);
  text-align: left;
}

.bug-id {
  color: var(--mauve);
  font-weight: bold;
  font-size: 0.8rem;
}

.status-badge {
  background: var(--surface0);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--green);
}

#submit_thread,
#submit_bug,
.thread-reply-submit,
.thread-reply-toggle {
  background: var(--surface0);
  color: var(--green);
  border: 1px solid var(--green);
  padding: 10px 24px;
  border-radius: 10px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

#submit_thread:hover,
#submit_bug:hover,
.thread-reply-submit:hover,
.thread-reply-toggle:hover {
  background: var(--green);
  color: var(--base);
  box-shadow: 0 0 20px rgba(166, 227, 161, 0.4);
  transform: translateY(-2px);
}

#submit_thread:active,
#submit_bug:active,
.thread-reply-submit:active,
.thread-reply-toggle:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 10px rgba(166, 227, 161, 0.2);
}

#submit_thread:hover::after,
#submit_bug:hover::after,
.thread-reply-submit:hover::after,
.thread-reply-toggle:hover::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shine 1.5s infinite;
}

.thread-reply-toggle {
  padding: 6px 14px;
  font-size: 0.75rem;
}

@keyframes shine {
  to {
    left: 100%;
  }
}

#posts_list,
#bugs_list {
  margin-top: 1rem;
}

/* Apps Page */
#apps .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  width: 100%;
  max-width: 800px;
}

#apps h1 {
  margin-top: 1rem;
}

#apps .item-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  transition:
    transform 0.2s,
    background 0.2s;
  font-family: inherit;
}

#apps .item-card:hover {
  transform: translateY(-5px);
  background: var(--mantle);
  border-color: var(--mauve);
}

#apps .item-card i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--sky);
}

.apps-card-desc {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  color: var(--subtext0);
}

/* Downloads Page */
#downloads .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 30px;
  width: 100%;
  max-width: 800px;
}

#downloads .item-card {
  background: var(--base);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s;
}

#downloads .item-card:hover {
  transform: translateY(-5px);
  border-color: var(--mauve);
}

#downloads .item-card h3 {
  margin: 15px 0 5px 0;
}

.download-file-icon {
  font-size: 2rem;
  color: #fab387;
}

.download-item-desc {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 15px;
}

/* Dot Dat Plotter Page */
.plotter-card {
  max-width: 950px;
  margin-top: 80px;
}

.drop-zone {
  margin: 2rem 0;
  padding: 2.5rem;
  border: 2px dashed var(--surface0);
  border-radius: 15px;
  background: var(--mantle);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--subtext0);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--green);
  background: var(--mantle);
  color: var(--green);
}

.drop-zone i {
  font-size: 2.5rem;
}

.controls {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn {
  background: var(--surface0);
  color: var(--text);
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: 0.2s;
}

.btn:hover {
  background: var(--green);
  color: #111;
}

.chart-container {
  position: relative;
  height: 450px;
  width: 100%;
  margin-top: 1.5rem;
  background: var(--base);
  padding: 1rem;
  border-radius: 12px;
}

/* Oxide Chat Frontend Page */
.chat-card {
  max-width: 900px;
  margin-top: 80px;
}

.chat-card .btn {
  border: 1px solid transparent;
}

.chat-action-row .btn {
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

#connectBtn {
  border-color: rgba(166, 227, 161, 0.55);
  background: rgba(166, 227, 161, 0.1);
}

#connectBtn:hover:not(:disabled) {
  background: rgba(166, 227, 161, 0.2);
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-1px);
}

#connectBtn.is-connected {
  border-color: rgba(137, 220, 235, 0.55);
  background: rgba(137, 220, 235, 0.12);
  color: var(--sky);
}

#connectBtn.is-connected:hover:not(:disabled) {
  border-color: var(--sky);
  background: rgba(137, 220, 235, 0.2);
}

#disconnectBtn {
  border-color: rgba(203, 166, 247, 0.55);
  background: rgba(203, 166, 247, 0.1);
}

#disconnectBtn:hover:not(:disabled) {
  background: rgba(203, 166, 247, 0.2);
  border-color: var(--mauve);
  color: var(--mauve);
  transform: translateY(-1px);
}

.chat-card .btn:disabled {
  opacity: 0.5;
  box-shadow: none;
  transform: none;
  filter: grayscale(0.2);
  cursor: not-allowed;
}

.chat-card .btn.row {
  width: 100%;
}

.chat-shell.hidden,
#authPanel.hidden {
  display: none;
}

.chat-controls {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.chat-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 0.75rem;
}

.chat-status {
  text-align: left;
  color: var(--subtext0);
  font-size: 0.85rem;
}

.messages {
  margin-top: 1rem;
  text-align: left;
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  min-height: 280px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 0.75rem;
}

.messages li {
  list-style: none;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(137, 180, 250, 0.32);
  background: rgba(17, 17, 27, 0.75);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.6rem;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(205, 214, 244, 0.35);
  object-fit: cover;
  flex-shrink: 0;
}

.message-content {
  min-width: 0;
  flex: 1;
}

.message.me {
  border-color: rgba(166, 227, 161, 0.45);
}

.message .meta {
  font-size: 0.72rem;
  color: var(--subtext0);
}

.message .body {
  margin-top: 0.25rem;
  word-break: break-word;
  color: var(--text);
}

.chat-composer {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.chat-headline {
  margin-bottom: 1rem;
}

.chat-alt-link {
  margin-top: 0.75rem;
}

.chat-link-sky {
  color: var(--sky);
}

.chat-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.profile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(137, 180, 250, 0.45);
  object-fit: cover;
  flex-shrink: 0;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.profile-meta p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-user-chip {
  color: var(--subtext0);
  font-size: 0.78rem;
  word-break: break-word;
}

.chat-user-id {
  color: var(--subtext1);
  font-size: 0.72rem;
  word-break: break-all;
  opacity: 0.9;
}

@media (max-width: 720px) {
  .chat-action-row {
    grid-template-columns: 1fr;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }
}
