@font-face {
  font-family: 'Monaspace Argon';
  src:
    url('./fonts/MonaspaceArgon.woff2') format('woff2'),
    url('./fonts/MonaspaceArgon.woff') format('woff'),
    url('./fonts/MonaspaceArgon.ttf') format('truetype');
  font-weight: 200 800;
  font-stretch: 100% 125%;
  font-style: oblique -11deg 0deg;
  font-display: swap;
}

@font-face {
  font-family: 'Monaspace Krypton';
  src:
    url('./fonts/MonaspaceKrypton.woff2') format('woff2'),
    url('./fonts/MonaspaceKrypton.woff') format('woff'),
    url('./fonts/MonaspaceKrypton.ttf') format('truetype');
  font-weight: 200 800;
  font-stretch: 100% 125%;
  font-style: oblique -11deg 0deg;
  font-display: swap;
}

@font-face {
  font-family: 'Monaspace Neon';
  src:
    url('./fonts/MonaspaceNeon.woff2') format('woff2'),
    url('./fonts/MonaspaceNeon.woff') format('woff'),
    url('./fonts/MonaspaceNeon.ttf') format('truetype');
  font-weight: 200 800;
  font-stretch: 100% 125%;
  font-style: oblique -11deg 0deg;
  font-display: swap;
}

@font-face {
  font-family: 'Monaspace Radon';
  src:
    url('./fonts/MonaspaceRadon.woff2') format('woff2'),
    url('./fonts/MonaspaceRadon.woff') format('woff'),
    url('./fonts/MonaspaceRadon.ttf') format('truetype');
  font-weight: 200 800;
  font-stretch: 100% 125%;
  font-style: oblique -11deg 0deg;
  font-display: swap;
}

@font-face {
  font-family: 'Monaspace Xenon';
  src:
    url('./fonts/MonaspaceXenon.woff2') format('woff2'),
    url('./fonts/MonaspaceXenon.woff') format('woff'),
    url('./fonts/MonaspaceXenon.ttf') format('truetype');
  font-weight: 200 800;
  font-stretch: 100% 125%;
  font-style: oblique -11deg 0deg;
  font-display: swap;
}

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

.hidden {
  display: none !important;
}

:root {
  --bg: #0a0a0a;
  --fg: #33ff99;
  --fg-dim: #1a9956;
  --accent: #5b9fc9;
  --card-bg: #111;
  --border: #222;
  --self-bg: #0d1a12;
  --other-bg: #0d1219;
  --font-primary: 'Monaspace Radon', ui-monospace, monospace;
  --font-weight-xlight: 200;
  --font-weight-light: 300;
  --font-weight-book: 350;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-xbold: 750;
  --font-weight-heavy: 800;
}

[data-theme='amber'] {
  --fg: #ffb000;
  --fg-dim: #996600;
  --accent: #c97f5b;
}

[data-theme='cyan'] {
  --fg: #33ccff;
  --fg-dim: #1a6699;
  --accent: #c95b9f;
}

[data-theme='pink'] {
  --fg: #ff66cc;
  --fg-dim: #99336b;
  --accent: #5bc9bf;
}

[data-theme='red'] {
  --fg: #ff4444;
  --fg-dim: #992626;
  --accent: #c9a05b;
}

[data-theme='paper'] {
  --fg: #e8e8e8;
  --fg-dim: #888888;
  --accent: #5b9fc9;
}

[data-theme='purple'] {
  --fg: #cc99ff;
  --fg-dim: #663d99;
  --accent: #5bc97f;
}

[data-font='argon'] {
  --font-primary: 'Monaspace Argon', ui-monospace, monospace;
}

[data-font='krypton'] {
  --font-primary: 'Monaspace Krypton', ui-monospace, monospace;
}

[data-font='neon'] {
  --font-primary: 'Monaspace Neon', ui-monospace, monospace;
}

[data-font='xenon'] {
  --font-primary: 'Monaspace Xenon', ui-monospace, monospace;
}

body {
  font-family: var(--font-primary);
  font-weight: 350;
  background: var(--bg);
  color: var(--fg);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Auth Screen --- */

#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

#auth-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

#auth-box h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 2px;
}

#auth-tabs {
  display: flex;
  gap: 4px;
  width: 280px;
}

#auth-tabs .tab {
  flex: 1;
  background: none;
  border: 1px solid var(--border);
  color: #555;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

#auth-tabs .tab.active {
  color: var(--fg);
  border-color: var(--fg-dim);
  background: var(--self-bg);
}

#auth-tabs .tab:hover:not(.active) {
  color: var(--fg-dim);
}

#login-form,
#signup-form,
#forgot-form,
#reset-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 280px;
}

#login-form input,
#signup-form input,
#forgot-form input,
#reset-form input {
  background: #151515;
  border: 2px solid var(--border);
  color: var(--fg);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 6px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

#login-form input:focus,
#signup-form input:focus,
#forgot-form input:focus,
#reset-form input:focus {
  border-color: var(--fg-dim);
  box-shadow: 0 0 0 3px rgba(51, 255, 153, 0.1);
}

#login-form input::placeholder,
#signup-form input::placeholder,
#forgot-form input::placeholder,
#reset-form input::placeholder {
  color: #383838;
}

#login-form button,
#signup-form button,
#forgot-form button,
#reset-form button {
  background: var(--fg-dim);
  color: var(--bg);
  border: none;
  padding: 12px 22px;
  font-family: inherit;
  font-weight: 550;
  font-size: 0.85rem;
  letter-spacing: 1px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

#login-form button:hover,
#signup-form button:hover,
#forgot-form button:hover,
#reset-form button:hover {
  background: var(--fg);
}

#forgot-link,
#forgot-back-link {
  color: var(--fg-dim);
  font-size: 0.75rem;
  text-align: center;
  text-decoration: none;
  transition: color 0.15s;
  margin-top: 4px;
}

#forgot-link:hover,
#forgot-back-link:hover {
  color: var(--fg);
}

#forgot-description,
#reset-description {
  color: #777;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.4;
}

#auth-error {
  color: #ff5555;
  font-size: 0.8rem;
  max-width: 280px;
}

#auth-error.success {
  color: #50c878;
}

#auth-screen {
  position: relative;
}

#auth-footer {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
}

#auth-footer a {
  color: #444;
  text-decoration: none;
  transition: color 0.15s;
}

#auth-footer a:hover {
  color: var(--fg-dim);
}

#font-picker {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  justify-content: center;
}

#font-picker .font-btn {
  width: 40px;
  height: 35px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: none;
  color: var(--fg-dim);
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s,
    transform 0.15s;
}

#font-picker .font-btn:hover {
  color: var(--fg);
  transform: scale(1.05);
}

#font-picker .font-btn.active {
  color: var(--fg);
  border-color: var(--fg-dim);
  box-shadow: 0 0 0 1px var(--fg-dim);
}

#theme-picker {
  display: flex;
  gap: 7px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  justify-content: center;
}

#theme-picker .swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--swatch);
  cursor: pointer;
  opacity: 0.55;
  transition:
    opacity 0.15s,
    transform 0.15s,
    border-color 0.15s;
}

#theme-picker .swatch:hover {
  opacity: 1;
  transform: scale(1.1);
}

#theme-picker .swatch.active {
  opacity: 1;
  border-color: var(--swatch);
  box-shadow: 0 0 0 1px var(--swatch);
}

#sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #2a2a2a;
  background: none;
}

#sidebar-footer a {
  color: #444;
  text-decoration: none;
  transition: color 0.15s;
}

#sidebar-footer a:hover {
  color: var(--fg-dim);
}

/* --- App Container (sidebar + chat) --- */

#app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */

#sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0d0d0d;
}

#user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 60px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

#logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

#logout-btn:hover {
  border-color: var(--fg-dim);
  color: var(--fg);
}

/* Add contact */

#add-contact {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

#add-contact-form {
  display: flex;
  gap: 6px;
}

#add-contact-form input {
  flex: 1;
  background: #151515;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.8rem;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

#add-contact-form input:focus {
  border-color: var(--fg-dim);
}

#add-contact-form input::placeholder {
  color: #383838;
}

#add-contact-form button {
  background: var(--fg-dim);
  color: var(--bg);
  border: none;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 550;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

#add-contact-form button:hover {
  background: var(--fg);
}

#contact-search-result {
  font-size: 0.75rem;
  margin-top: 8px;
  color: var(--fg-dim);
}

/* Contacts & pending sections */

#contacts-section,
#pending-requests {
  padding: 12px 16px;
}

#contacts-section h3,
#pending-requests h3 {
  font-size: 0.7rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

#contacts-section {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.contact-item {
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.contact-item:hover {
  background: #1a1a1a;
}

.contact-item.active {
  background: var(--self-bg);
  border-left-color: var(--fg);
}

.contact-item.outgoing {
  color: #555;
  font-style: italic;
  cursor: default;
}

.pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 0.8rem;
}

.pending-item span {
  flex: 1;
}

.accept-btn {
  background: var(--fg-dim);
  color: var(--bg);
  border: none;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}

.accept-btn:hover {
  background: var(--fg);
}

.reject-btn {
  background: none;
  border: 1px solid #555;
  color: #555;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.reject-btn:hover {
  border-color: #ff5555;
  color: #ff5555;
}

/* --- Chat Area --- */

#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#chat-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 0.9rem;
}

#chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#chat-header {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 60px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
}

#chat-header h2 {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 1px;
}

#chat-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}

/* --- Board (messages) --- */

#board {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  animation: slideIn 0.25s ease-out;
  position: relative;
}

.item.self {
  background: var(--self-bg);
  border-left: 3px solid var(--fg);
}

.item.other {
  background: var(--other-bg);
  border-left: 3px solid var(--accent);
}

.dismiss-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  color: #555;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.dismiss-btn:hover {
  color: var(--fg);
}

.item .meta {
  font-size: 0.65rem;
  color: #555;
  margin-bottom: 4px;
}

.item .content {
  font-size: 0.85rem;
  word-break: break-word;
}

.item .content a {
  color: var(--accent);
  text-decoration: underline;
}

/* File items */

.item.file-item .file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.item.file-item .file-icon {
  font-size: 1.4rem;
}

.item.file-item .file-size {
  color: #555;
  font-size: 0.7rem;
}

.item.file-item .download-btn {
  color: var(--fg);
  background: none;
  border: 1px solid var(--fg-dim);
  padding: 3px 10px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.75rem;
  margin-left: auto;
  cursor: pointer;
  transition: background 0.15s;
}

.item.file-item .download-btn:hover {
  background: var(--fg-dim);
  color: var(--bg);
}

/* --- Drop Zone (compact) --- */

#drop-zone {
  border: 2px dashed var(--border);
  padding: 80px 20px;
  margin: auto 64px;
  text-align: center;
  font-size: 0.8rem;
  color: #444;
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s;
  cursor: pointer;
}

#drop-zone-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#drop-zone .drop-icon {
  font-size: 1.2rem;
  color: #333;
  transition: color 0.2s;
}

#drop-zone.drag-over {
  border-color: var(--fg);
  color: var(--fg);
  background: rgba(51, 255, 153, 0.03);
}

#drop-zone.drag-over .drop-icon {
  color: var(--fg);
}

.file-label {
  color: var(--fg);
  cursor: pointer;
  text-decoration: underline;
}

/* --- Footer / Input Bar --- */

footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  background: #0e0e0e;
}

#text-form {
  display: flex;
  gap: 10px;
}

#text-input {
  flex: 1;
  background: #151515;
  border: 2px solid var(--border);
  color: var(--fg);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 6px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

#text-input:focus {
  border-color: var(--fg-dim);
  box-shadow: 0 0 0 3px rgba(51, 255, 153, 0.1);
}

#text-input::placeholder {
  color: #383838;
}

#text-form button {
  background: var(--fg-dim);
  color: var(--bg);
  border: none;
  padding: 12px 22px;
  font-family: inherit;
  font-weight: 550;
  font-size: 0.85rem;
  letter-spacing: 1px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

#text-form button:hover {
  background: var(--fg);
}

/* --- Animations --- */

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

@keyframes pingFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(51, 255, 153, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(51, 255, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(51, 255, 153, 0);
  }
}

.item.ping {
  animation:
    slideIn 0.25s ease-out,
    pingFlash 0.6s ease-out;
}

.item.fade-out {
  animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* --- Scrollbar --- */

#chat-main::-webkit-scrollbar,
#contacts-section::-webkit-scrollbar {
  width: 6px;
}

#chat-main::-webkit-scrollbar-track,
#contacts-section::-webkit-scrollbar-track {
  background: var(--bg);
}

#chat-main::-webkit-scrollbar-thumb,
#contacts-section::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* --- Mobile --- */

@media (max-width: 600px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    min-width: unset;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: auto;
  }

  #chat-header {
    padding: 10px 14px;
  }

  #chat-main {
    padding: 12px 14px;
  }

  #drop-zone {
    padding: 10px 14px;
  }

  .item {
    padding: 10px 12px;
  }

  .item.file-item .file-info {
    flex-wrap: wrap;
  }

  .item.file-item .download-btn {
    padding: 6px 14px;
    margin-left: 0;
  }

  footer {
    padding: 10px 14px;
  }

  #text-input {
    font-size: 16px;
    padding: 10px 12px;
  }

  #text-form button {
    padding: 10px 16px;
  }

  #login-form,
  #signup-form,
  #forgot-form,
  #reset-form {
    width: 100%;
    padding: 0 20px;
  }

  #login-form input,
  #signup-form input,
  #forgot-form input,
  #reset-form input {
    font-size: 16px;
  }
}
