/* ═══════════════════════════════════════════════
   Westline Panel — Unified CSS
   Design: Dark admin panel, Discord-adjacent aesthetic
   ═══════════════════════════════════════════════ */

:root {
  --bg:        #0e0f13;
  --surface:   #16181f;
  --surface2:  #1d2028;
  --border:    rgba(255,255,255,0.07);
  --border-s:  rgba(255,255,255,0.12);

  --brand:     #5865f2;
  --brand-h:   #4752d9;
  --green:     #57f287;
  --red:       #ed4245;
  --yellow:    #fee75c;

  --text:      #e3e5e8;
  --text-2:    #9da4b0;
  --text-3:    #5c6170;

  --nav-h:     56px;
  --radius:    8px;
  --radius-lg: 12px;

  font-family: 'Inter', system-ui, sans-serif;
  font-size:   15px;
  line-height: 1.5;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color:       var(--text);
  min-height:  100vh;
}

/* ─── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
  position:   fixed;
  top: 0; left: 0; right: 0;
  height:     var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display:    flex;
  align-items: center;
  padding:    0 24px;
  gap:        32px;
  z-index:    100;
}

.navbar-brand {
  display:     flex;
  align-items: center;
  gap:         8px;
  font-weight: 700;
  font-size:   15px;
  color:       var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
}

.navbar-links {
  display:    flex;
  gap:        4px;
  flex:       1;
}
.navbar-links a {
  color:       var(--text-2);
  text-decoration: none;
  font-size:   14px;
  font-weight: 500;
  padding:     6px 12px;
  border-radius: var(--radius);
  transition:  all .15s;
}
.navbar-links a:hover,
.navbar-links a.active {
  color:      var(--text);
  background: rgba(88,101,242,.15);
}
.navbar-links a.active { color: var(--brand); }

.navbar-user {
  display:     flex;
  align-items: center;
  gap:         10px;
  margin-left: auto;
}
.navbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-s);
}
.navbar-username {
  font-size:   14px;
  font-weight: 500;
  color:       var(--text-2);
}
.btn-logout {
  font-size:   13px;
  color:       var(--text-3);
  text-decoration: none;
  padding:     4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all .15s;
}
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* ─── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  margin-top: var(--nav-h);
  padding:    32px 28px 60px;
  max-width:  1280px;
  margin-left: auto;
  margin-right: auto;
  margin-top: calc(var(--nav-h) + 0px);
}

/* ─── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  display:     flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-title {
  font-size:   24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color:       var(--text);
}
.page-sub {
  font-size: 14px;
  color:     var(--text-2);
  margin-top: 2px;
}
.guild-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-s);
}

/* ─── Stats Grid ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border:     1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:    18px 20px;
  display:    flex;
  align-items: center;
  gap:        14px;
  transition: border-color .15s;
}
.stat-card:hover { border-color: var(--border-s); }
.stat-icon { font-size: 22px; }
.stat-value {
  font-size:   22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.stat-label {
  font-size: 12px;
  color:     var(--text-2);
  margin-top: 1px;
}

/* ─── Charts Row ──────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--surface);
  border:     1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:    20px;
}
.chart-card h3 {
  font-size: 14px; font-weight: 600;
  color: var(--text-2); margin-bottom: 14px;
}
.chart-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}
.chart-header h3 { margin: 0; }

/* ─── Leaderboard List ────────────────────────────────────────────────────── */
.leaderboard-list { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface2);
}
.lb-rank {
  font-size: 12px; font-weight: 700;
  color: var(--text-3); width: 20px; text-align: center;
  font-family: 'JetBrains Mono', monospace;
}
.lb-name { flex: 1; font-size: 13px; font-weight: 500; }
.lb-meta { font-size: 12px; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }
.empty-hint { font-size: 13px; color: var(--text-3); }

/* ─── Quick Nav ───────────────────────────────────────────────────────────── */
.quick-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 700px) { .quick-nav { grid-template-columns: 1fr; } }

.qnav-card {
  background: var(--surface);
  border:     1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:    18px 20px;
  display:    flex;
  align-items: center;
  gap:        14px;
  text-decoration: none;
  color:      var(--text);
  transition: all .15s;
}
.qnav-card:hover {
  border-color: var(--brand);
  background:   rgba(88,101,242,.06);
  transform:    translateY(-1px);
}
.qnav-icon { font-size: 24px; }
.qnav-title { font-size: 14px; font-weight: 600; }
.qnav-desc  { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background:  var(--brand);
  color:       #fff;
  border:      none;
  padding:     9px 18px;
  border-radius: var(--radius);
  font-size:   14px;
  font-weight: 600;
  cursor:      pointer;
  font-family: inherit;
  transition:  background .15s;
}
.btn-primary:hover { background: var(--brand-h); }

.btn-ghost {
  background:  transparent;
  color:       var(--text-2);
  border:      1px solid var(--border-s);
  padding:     8px 16px;
  border-radius: var(--radius);
  font-size:   14px;
  font-weight: 500;
  cursor:      pointer;
  font-family: inherit;
  text-decoration: none;
  display:     inline-block;
  transition:  all .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }

.btn-danger {
  background:  rgba(237,66,69,.12);
  color:       var(--red);
  border:      1px solid rgba(237,66,69,.3);
  padding:     8px 16px;
  border-radius: var(--radius);
  font-size:   14px;
  font-weight: 500;
  cursor:      pointer;
  font-family: inherit;
  transition:  all .15s;
}
.btn-danger:hover { background: rgba(237,66,69,.2); }

.btn-edit {
  background: rgba(88,101,242,.12);
  color:      var(--brand);
  border:     1px solid rgba(88,101,242,.3);
  padding:    5px 12px;
  border-radius: var(--radius);
  font-size:  13px;
  font-weight: 500;
  cursor:     pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn-edit:hover { background: rgba(88,101,242,.2); }

.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ─── Form Fields ─────────────────────────────────────────────────────────── */
.field-group { margin-bottom: 14px; }
.field-group label {
  display:     block;
  font-size:   12px;
  font-weight: 600;
  color:       var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.label-opt {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-3);
  font-size: 11px;
}

.field-input {
  width:        100%;
  background:   var(--surface2);
  border:       1px solid var(--border-s);
  border-radius: var(--radius);
  color:        var(--text);
  font-family:  inherit;
  font-size:    14px;
  padding:      9px 12px;
  outline:      none;
  transition:   border-color .15s;
}
.field-input:focus { border-color: var(--brand); }
.field-input::placeholder { color: var(--text-3); }

textarea.field-input { resize: vertical; min-height: 90px; }
select.field-input { cursor: pointer; }
.field-mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] {
  width: 40px; height: 40px;
  border: 1px solid var(--border-s);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer; padding: 2px;
}
.color-row .field-input { flex: 1; font-family: 'JetBrains Mono', monospace; }

.select-sm { padding: 5px 10px; font-size: 13px; width: auto; }

/* ─── Status Indicators ───────────────────────────────────────────────────── */
.status-inline {
  font-size: 13px; color: var(--text-2);
  transition: color .2s;
}
.status-inline.ok  { color: var(--green); }
.status-inline.err { color: var(--red); }

.status-line { font-size: 13px; color: var(--text-2); margin-top: 8px; min-height: 18px; }
.status-line.ok  { color: var(--green); }
.status-line.err { color: var(--red); }

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: rgba(237,66,69,.12); color: var(--red); border: 1px solid rgba(237,66,69,.3); }

/* ─── Search Form ─────────────────────────────────────────────────────────── */
.search-form {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 20px;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 14px;
  outline: none;
  flex: 1; max-width: 360px;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--brand); }
.search-input::placeholder { color: var(--text-3); }

/* ─── Data Table ──────────────────────────────────────────────────────────── */
.table-wrap {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow:      hidden;
  margin-bottom: 20px;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background:  var(--surface2);
  color:       var(--text-2);
  font-size:   12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding:     10px 16px;
  text-align:  left;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding:     12px 16px;
  font-size:   14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.015); }

.rank-cell  { color: var(--text-3); font-family: 'JetBrains Mono', monospace; width: 50px; }
.user-cell  { display: flex; flex-direction: column; gap: 2px; }
.user-tag   { font-weight: 500; }
.user-id    { font-size: 11px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; }
.action-cell { display: flex; gap: 6px; }
.empty-cell { text-align: center; color: var(--text-3); padding: 32px; }
.badge-level {
  background: rgba(88,101,242,.15);
  color: var(--brand);
  font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 12px;
  justify-content: center; margin-top: 16px;
}
.page-btn {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  transition: all .15s;
}
.page-btn:hover { border-color: var(--brand); color: var(--text); }
.page-info { font-size: 13px; color: var(--text-3); }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.modal-sub   { font-size: 13px; color: var(--text-2); margin-bottom: 18px; font-family: 'JetBrains Mono', monospace; }
.modal-warn  { font-size: 13px; color: var(--red); margin-bottom: 12px; padding: 10px 12px; background: rgba(237,66,69,.08); border-radius: var(--radius); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ─── Notifications Layout ────────────────────────────────────────────────── */
.notif-layout {
  display: grid;
  grid-template-columns: 180px 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1000px) { .notif-layout { grid-template-columns: 1fr; } }

.notif-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.notif-tab {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: all .15s;
  width: 100%;
}
.notif-tab:hover { background: var(--surface2); color: var(--text); }
.notif-tab.active { background: rgba(88,101,242,.15); color: var(--brand); }

.notif-form-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.notif-form-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.notif-form-header h2 { font-size: 16px; font-weight: 600; }

.ph-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 16px;
}
.ph-chip {
  background: rgba(88,101,242,.12);
  color: var(--brand);
  border: 1px solid rgba(88,101,242,.25);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 8px;
  border-radius: 100px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.ph-chip:hover { background: rgba(88,101,242,.25); }

.notif-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 18px;
}

.notif-preview-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.notif-preview-area h3 {
  font-size: 14px; font-weight: 600; margin-bottom: 4px;
}
.preview-hint { font-size: 12px; color: var(--text-3); margin-bottom: 14px; }

/* ─── Embed Builder Layout ────────────────────────────────────────────────── */
.eb-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .eb-layout { grid-template-columns: 1fr; } }

.eb-form-col { display: flex; flex-direction: column; gap: 14px; }
.eb-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.eb-section-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-2); text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 14px;
}

.template-header {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.template-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

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

.eb-preview-col {
  position: sticky; top: calc(var(--nav-h) + 16px);
}
.eb-preview-col h3 {
  font-size: 14px; font-weight: 600; margin-bottom: 14px;
}

/* ─── Discord Mock Preview ────────────────────────────────────────────────── */
.discord-chat-mock {
  background: #36393f;
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 200px;
}
.bot-row { display: flex; gap: 12px; }
.bot-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
  flex-shrink: 0;
}
.bot-body { flex: 1; }
.bot-name  { font-weight: 600; font-size: 15px; color: #fff; }
.bot-badge {
  background: var(--brand);
  color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 3px;
  margin-left: 6px; vertical-align: middle;
}
.embed-mock-wrap { margin-top: 8px; }

.discord-mock {
  background: #36393f;
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 80px;
}

.embed-mock {
  background: #2f3136;
  border-radius: 0 6px 6px 0;
  padding: 12px 14px 12px 12px;
  position: relative;
  display: flex;
  gap: 12px;
  max-width: 520px;
}
.embed-body  { flex: 1; }
.embed-thumb {
  width: 72px; height: 72px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.embed-image {
  width: 100%; border-radius: 4px;
  margin-top: 8px;
  object-fit: cover;
  max-height: 160px;
}
.embed-author { font-size: 12px; font-weight: 600; color: #dcddde; margin-bottom: 4px; }
.embed-title  { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.embed-desc   { font-size: 13px; color: #dcddde; line-height: 1.4; margin-bottom: 4px; }
.embed-desc strong { color: #fff; }
.embed-desc code   { background: rgba(255,255,255,.1); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.embed-footer { font-size: 11px; color: #a3a6aa; margin-top: 8px; }
.ph-val { color: #00b0f4; font-weight: 500; }

/* ─── Login Page ──────────────────────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center; justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-bg {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%; max-width: 400px;
  text-align: center;
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  margin-bottom: 24px;
  text-transform: uppercase; letter-spacing: .08em;
}
.login-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 8px var(--brand);
}
.login-title {
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.03em; margin-bottom: 10px;
}
.login-desc {
  font-size: 14px; color: var(--text-2);
  line-height: 1.6; margin-bottom: 28px;
}
.login-alert {
  background: rgba(237,66,69,.1);
  color: var(--red);
  border: 1px solid rgba(237,66,69,.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}
.btn-discord {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #5865f2;
  color: #fff;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600; font-size: 15px;
  transition: background .15s;
  width: 100%;
}
.btn-discord:hover { background: #4752d9; }
.login-note {
  font-size: 12px; color: var(--text-3);
  margin-top: 18px;
}

/* ─── Error Page ──────────────────────────────────────────────────────────── */
.error-page {
  text-align: center; padding: 80px 24px;
}
.error-code {
  font-size: 80px; font-weight: 800;
  letter-spacing: -0.04em; color: var(--text-3);
  margin-bottom: 12px;
}
.error-msg { font-size: 16px; color: var(--text-2); margin-bottom: 24px; }
