/* Unilink Communities — Discord-inspired layout */

.sp-body {
  margin: 0;
  min-height: 100vh;
  background: #1e1f22;
  color: #f2f3f5;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
}

.sp-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: #111214;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sp-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.sp-link-back {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
}
.sp-link-back:hover {
  color: #fff;
}
.sp-topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.sp-dot {
  color: var(--red);
}
.sp-user-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-shell {
  flex: 1;
  display: flex;
  min-height: 0;
  min-height: calc(100vh - 52px);
}

/* Server rail */
.sp-rail {
  width: 72px;
  flex-shrink: 0;
  background: #111214;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  overflow-y: auto;
}
.sp-rail-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: #313338;
  transition: background 0.15s, border-radius 0.15s;
}
.sp-rail-btn:hover {
  background: var(--red);
  border-radius: 35%;
}
.sp-rail-btn.is-active {
  background: var(--red);
  border-radius: 35%;
}

/* Channels column */
.sp-channels-col {
  width: 260px;
  flex-shrink: 0;
  background: #2b2d31;
  border-right: 1px solid rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sp-space-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 2.5rem;
}
.sp-placeholder {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.4;
}
.sp-channel-list {
  flex: 0 1 auto;
  max-height: 40vh;
  overflow-y: auto;
  padding: 0.5rem 0.35rem;
}
.sp-channel-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.15rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
}
.sp-channel-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.sp-channel-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.sp-hash {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.sp-browse {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0.65rem;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}
.sp-browse-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  margin: 0 0 0.5rem;
}
.sp-browse-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sp-browse-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.25rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.sp-browse-name {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}
.sp-browse-meta {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
}
.sp-browse-join {
  flex-shrink: 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  font-family: inherit;
}
.sp-browse-join:hover {
  filter: brightness(1.08);
}
.sp-browse-join:disabled {
  opacity: 0.5;
  cursor: default;
}

.sp-create {
  padding: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}

/* Main chat */
.sp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #313338;
}
.sp-main-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
}
.sp-main-empty-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 0.5rem;
}
.sp-main-empty-sub {
  margin: 0;
  max-width: 28ch;
  font-size: 0.9rem;
  line-height: 1.5;
}

.sp-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sp-chat-head {
  flex-shrink: 0;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.sp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.sp-msg {
  font-size: 0.9375rem;
  line-height: 1.45;
}
.sp-msg-author {
  font-weight: 700;
  color: #fff;
  margin-right: 0.5rem;
  font-size: 0.875rem;
}
.sp-msg-author.is-me {
  color: #faa61a;
}
.sp-msg-time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.25);
  font-weight: 500;
}
.sp-msg-body {
  margin-top: 0.2rem;
  color: #dcddde;
  word-break: break-word;
}

.sp-compose {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  background: #313338;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}
.sp-compose-input {
  flex: 1;
  background: #383a40;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}
.sp-compose-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
.sp-compose-input:focus {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* Modal */
.sp-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.sp-modal[hidden] {
  display: none;
}
.sp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}
.sp-modal-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.sp-modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
}
.sp-modal-desc {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
}
.sp-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
}
.sp-field input,
.sp-field textarea {
  text-transform: none;
  font-weight: 500;
  letter-spacing: normal;
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
}
.sp-field textarea {
  resize: vertical;
  min-height: 72px;
}
.sp-modal-err {
  color: #f87171;
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}
.sp-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 900px) {
  .sp-shell {
    flex-direction: column;
  }
  .sp-rail {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .sp-channels-col {
    width: 100%;
    max-height: 45vh;
  }
}
