/* Authored by arg (argtoms.net) — Discord Desktop Client Theme for Owner Bot View */
:root {
  --bg-tertiary: #1e1f22;
  --bg-secondary: #2b2d31;
  --bg-primary: #313338;
  --bg-floating: #111214;
  --bg-modifier-hover: rgba(79, 84, 92, 0.32);
  --bg-modifier-active: rgba(79, 84, 92, 0.48);
  --brand: #5865f2;
  --brand-hover: #4752c4;
  --green: #23a55a;
  --yellow: #f0b232;
  --red: #f23f43;
  --text-normal: #dbdee1;
  --text-Header: #f2f3f5;
  --text-muted: #949ba4;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --input-bg: #383a40;
}

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

body {
  font-family: "gg sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-normal);
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* Auth Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, #2b3052 0%, #111214 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-subtle);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.discord-glyph {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-logo h1 {
  color: var(--text-Header);
  font-size: 22px;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.auth-error {
  background: rgba(242, 63, 67, 0.15);
  border: 1px solid var(--red);
  color: #ff9c9e;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}

.divider-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 18px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* Main App Shell */
.app-shell {
  display: grid;
  grid-template-columns: 72px 240px 1fr;
  height: 100vh;
  width: 100vw;
}

/* 1. Guild Rail */
.guild-rail {
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  overflow-y: auto;
}

.guild-separator {
  width: 32px;
  height: 2px;
  background: #35363c;
  border-radius: 1px;
  margin: 2px 0;
}

.guild-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.guild-icon {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 24px;
  background: var(--bg-primary);
  color: var(--text-normal);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  transition: border-radius 0.18s ease, background 0.18s ease, color 0.18s ease;
  overflow: hidden;
}

.guild-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guild-icon:hover,
.guild-icon.active {
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
}

.guild-icon.active::before {
  content: "";
  position: absolute;
  left: -12px;
  width: 4px;
  height: 36px;
  background: #fff;
  border-radius: 0 4px 4px 0;
}

.guild-action {
  color: var(--green);
  font-size: 20px;
}
.guild-action:hover {
  background: var(--green);
  color: #fff;
}

/* 2. Channel Sidebar */
.channel-sidebar {
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--border-subtle);
}

.server-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.28);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.server-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-Header);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}

.empty-sidebar-hint {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 16px 8px;
}

.channel-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 14px 8px 4px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
}

.channel-item:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-normal);
}

.channel-item.active {
  background: var(--bg-modifier-active);
  color: #fff;
}

.channel-item .ch-symbol {
  font-size: 16px;
  width: 18px;
  text-align: center;
  opacity: 0.75;
}

.voice-occupants {
  padding-left: 28px;
  margin-bottom: 6px;
}

.voice-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-normal);
  padding: 3px 6px;
  border-radius: 4px;
}

.voice-user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

/* Bottom Bot User Bar */
.bot-user-bar {
  height: 54px;
  background: #232428;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bot-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.bot-identity:hover {
  background: var(--bg-modifier-hover);
}

.avatar-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.avatar-wrapper img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #232428;
  background: #80848e;
}
.status-dot.online { background: var(--green); }
.status-dot.idle { background: var(--yellow); }
.status-dot.dnd { background: var(--red); }

.bot-names {
  min-width: 0;
}

.bot-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-Header);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-subtext {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-bar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

/* 3. Main Viewport */
.main-viewport {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-primary);
  min-width: 0;
}

.topbar {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.channel-hash {
  color: var(--text-muted);
  font-size: 22px;
  font-weight: 500;
}

.topbar-title {
  color: var(--text-Header);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.topbar-topic {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mode-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.mode-tab:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-normal);
}

.mode-tab.active {
  background: var(--bg-modifier-active);
  color: #fff;
}

/* View Panes */
.view-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 240px;
  min-height: 0;
}

.messages-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.messages-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  user-select: text;
}

.welcome-empty {
  padding: 48px 32px;
  max-width: 560px;
}

.welcome-empty h3 {
  font-size: 24px;
  color: var(--text-Header);
  margin-bottom: 8px;
}

.welcome-empty p {
  color: var(--text-muted);
  line-height: 1.5;
}

/* Message Item */
.msg-row {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 6px 20px;
  margin-top: 6px;
}

.msg-row:hover {
  background: rgba(4, 4, 5, 0.07);
}

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
}

.msg-main {
  flex: 1;
  min-width: 0;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.msg-author {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-Header);
  cursor: pointer;
}

.bot-tag {
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-content {
  font-size: 15px;
  line-height: 1.38;
  color: var(--text-normal);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg-reply-context {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Discord Embed Rendering */
.discord-embed,
.discord-embed-preview {
  margin-top: 6px;
  max-width: 520px;
  background: var(--bg-secondary);
  border-left: 4px solid var(--brand);
  border-radius: 4px;
  padding: 12px 16px;
}

.embed-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-Header);
  margin-bottom: 4px;
}

.embed-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-Header);
  margin-bottom: 6px;
}

.embed-desc {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-normal);
  white-space: pre-wrap;
}

.embed-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.embed-field-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-Header);
}

.embed-field-val {
  font-size: 13px;
  color: var(--text-normal);
}

.embed-image {
  max-width: 100%;
  max-height: 280px;
  border-radius: 4px;
  margin-top: 10px;
}

.embed-footer {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.msg-attachment-img {
  max-width: 360px;
  max-height: 260px;
  border-radius: 6px;
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.reaction-pill {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.reaction-pill:hover {
  border-color: var(--brand);
}

/* Message Hover Action Toolbar */
.msg-actions {
  position: absolute;
  right: 20px;
  top: -12px;
  background: var(--bg-primary);
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  display: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.msg-row:hover .msg-actions {
  display: flex;
}

.msg-act-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 8px;
  cursor: pointer;
  font-size: 13px;
}

.msg-act-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-Header);
}

/* Composer */
.reply-banner {
  background: var(--bg-secondary);
  padding: 6px 16px;
  margin: 0 16px;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-composer {
  margin: 0 16px 20px;
  background: var(--input-bg);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer-plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #b5bac1;
  color: var(--bg-primary);
  border: none;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-composer input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-Header);
  font-size: 15px;
  outline: none;
}

/* Member Sidebar */
.member-sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.member-sidebar-header {
  padding: 14px 16px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.member-list {
  padding: 4px 8px 16px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.member-row:hover {
  background: var(--bg-modifier-hover);
}

.member-row img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.member-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Panels & Forms */
.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
}

.card h3 {
  color: var(--text-Header);
  font-size: 16px;
  margin-bottom: 14px;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.field {
  margin-bottom: 14px;
  flex: 1;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  text-transform: none !important;
  cursor: pointer;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-Header);
  padding: 9px 12px;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

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

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  border: none;
  border-radius: 4px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-hover);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: #4e5058;
  color: #fff;
}
.btn-secondary:hover {
  background: #6d6f78;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.full-width {
  width: 100%;
}

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.muted { color: var(--text-muted); font-size: 13px; margin-bottom: 10px; }
.sep { border: none; border-top: 1px solid var(--border-subtle); margin: 16px 0; }
.badge { background: var(--bg-tertiary); padding: 2px 8px; border-radius: 10px; font-size: 11px; }

/* Data Tables */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
}

.templates-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-item {
  background: var(--bg-tertiary);
  padding: 10px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--border-subtle);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.member-modal-id {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-modal-id img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.role-pill {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.role-pill button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--bg-floating);
  color: #fff;
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 4px solid var(--brand);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}

/* Discord OAuth2 Login & Server Cards */
.auth-card-centered {
  text-align: center;
  max-width: 420px;
}

.discord-hero-badge {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
}

.auth-card-centered h1 {
  color: var(--text-Header);
  font-size: 24px;
  margin-bottom: 10px;
}

.auth-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.btn-discord-oauth {
  width: 100%;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-discord-oauth:hover {
  background: var(--brand-hover);
}

.section-heading {
  color: var(--text-Header);
  font-size: 18px;
  margin-bottom: 4px;
}

.mb-20 { margin-bottom: 20px; }
.mt-24 { margin-top: 24px; }

.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.server-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.server-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.server-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--bg-tertiary);
  color: var(--text-Header);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

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

.server-card-meta {
  min-width: 0;
}

.server-card-name {
  color: var(--text-Header);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-card-role {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.presence-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.presence-inline-form select,
.presence-inline-form input {
  width: auto;
  min-width: 130px;
}
