/* ═══════════════════════════════════════════
   Nordic Studios Dashboard — Dark Theme
   ═══════════════════════════════════════════ */

:root {
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-sidebar: #0d1117;
  --bg-input: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #5865F2;
  --accent-hover: #4752c4;
  --green: #57f287;
  --yellow: #fee75c;
  --red: #ed4245;
  --orange: #f0b232;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Login Page ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0b0e14 0%, #131a27 40%, #0d1117 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.login-logo {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 16px;
}

.login-header h1 { font-size: 28px; margin-bottom: 4px; }
.login-header p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

.login-features {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.login-feature {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-feature i { color: var(--accent); font-size: 14px; }

.login-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; line-height: 1.6; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
  color: #fff;
}

.btn i { font-size: 16px; }

.btn-discord { background: var(--accent); padding: 14px 32px; font-size: 16px; }
.btn-discord:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(88,101,242,.3); }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #c9373a; }
.btn-warning { background: var(--orange); color: #000; }
.btn-warning:hover { background: #d49a28; }
.btn-success { background: var(--green); color: #000; }
.btn-success:hover { background: #45d972; }
.btn-small { padding: 6px 14px; font-size: 13px; }
.btn-small i { font-size: 12px; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Layout ─── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}

.sidebar-header h2 { font-size: 18px; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.nav-links {
  list-style: none;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.nav-links::-webkit-scrollbar { width: 4px; }
.nav-links::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.nav-links::-webkit-scrollbar-track { background: transparent; }

.nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  border-left: 3px solid transparent;
}

.nav-links a i {
  width: 20px;
  text-align: center;
  font-size: 15px;
}

.nav-links a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.nav-links a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(88,101,242,.08);
}
.nav-links a.active i { color: var(--accent); }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.user-info img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

/* ─── Main Content ─── */
.content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title i { color: var(--accent); }

/* ─── Stat Cards Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}

.stat-card:hover { border-color: rgba(88,101,242,.3); }

.stat-card .stat-icon {
  font-size: 20px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
}

.stat-card .value.green { color: var(--green); }
.stat-card .value.accent { color: var(--accent); }
.stat-card .value.yellow { color: var(--yellow); }
.stat-card .value.red { color: var(--red); }

/* ─── Tables ─── */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* Member row */
.member-row { cursor: pointer; transition: background .15s; }
.member-row:hover td { background: rgba(88,101,242,.05); }
.member-row .member-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online { background: var(--green); }
.status-dot.idle { background: var(--yellow); }
.status-dot.dnd { background: var(--red); }
.status-dot.offline { background: var(--text-muted); }

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
  background: rgba(255,255,255,.04);
  white-space: nowrap;
}

.role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Search / Filters ─── */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

input[type="text"], input[type="number"], select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border .2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,101,242,.15);
}

.search-input {
  flex: 1;
  min-width: 200px;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all .2s;
}

.modal-close:hover { color: var(--text); background: rgba(255,255,255,.05); }

.modal h3 {
  font-size: 20px;
  margin-bottom: 16px;
}

.modal .member-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.modal .member-profile img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.modal .meta {
  color: var(--text-muted);
  font-size: 13px;
}

.modal .section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal .section-label i { font-size: 12px; }

.modal .roles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 16px;
}

.modal .action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal .action-group input {
  flex: 1;
}

/* ─── Warning list inside modal ─── */
.warning-list {
  margin: 8px 0 16px;
}

.warning-item {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  border-left: 3px solid var(--yellow);
}

.warning-item .warn-reason { font-weight: 600; }
.warning-item .warn-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ─── Settings Form ─── */
.settings-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.settings-form h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-form h3 i { color: var(--accent); font-size: 18px; }

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-group input, .form-group textarea {
  width: 100%;
}

textarea { resize: vertical; min-height: 80px; }

/* ─── Alerts ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert i { font-size: 16px; }

.alert-success { background: rgba(87,242,135,.1); border: 1px solid var(--green); color: var(--green); }
.alert-error { background: rgba(237,66,69,.1); border: 1px solid var(--red); color: var(--red); }

/* ─── Loading ─── */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* ─── Server info card ─── */
.server-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.server-info-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.server-info-card h2 { font-size: 22px; }
.server-info-card p { color: var(--text-muted); font-size: 13px; }

/* ─── Rules Editor ─── */
.rules-editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.rules-editor-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.rules-editor-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 16px;
}

.rules-editor-panel h3 i { color: var(--accent); }

.rules-textarea {
  width: 100%;
  min-height: 400px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 16px;
  border-radius: var(--radius);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border .2s;
}

.rules-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,101,242,.15);
}

.rules-preview {
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  background: #2b2d31;
  border: 1px solid #3f4147;
  border-radius: var(--radius);
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: #dbdee1;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Discord-style markdown rendering */
.rules-preview .bold { font-weight: 700; color: #fff; }
.rules-preview .italic { font-style: italic; }
.rules-preview .underline { text-decoration: underline; }
.rules-preview .mention { color: #c9cdfb; background: rgba(88,101,242,.15); padding: 0 2px; border-radius: 3px; }

.rules-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.rules-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.rules-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rules-meta .meta-item i { color: var(--accent); }

.char-count {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 6px;
}

.char-count.warning { color: var(--yellow); }
.char-count.danger { color: var(--red); }

.rules-templates {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.rules-templates h4 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.template-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .rules-editor-layout { grid-template-columns: 1fr; }
}

/* ─── Announcements & Polls ─── */
.announce-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .announce-layout { grid-template-columns: 1fr; }
}

.form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.form-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 16px;
}

.form-panel h3 i { color: var(--accent); }

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.form-row > * { flex: 1; }

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-wrap input[type="color"] {
  width: 40px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  cursor: pointer;
  padding: 2px;
}

.preview-embed {
  background: #2b2d31;
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #dbdee1;
}

.preview-embed .embed-title {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  margin-bottom: 8px;
}

.preview-embed .embed-desc {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.preview-embed .embed-footer {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 8px;
}

/* Poll options builder */
.poll-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.poll-option-row .option-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  flex-shrink: 0;
}

.poll-option-row input { flex: 1; }

.poll-option-row .remove-option {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: all .2s;
}

.poll-option-row .remove-option:hover { color: var(--red); }

.poll-preview-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 15px;
}

.poll-preview-option .poll-emoji { font-size: 20px; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2, .sidebar-footer .user-info span,
  .nav-links a span, .badge, .sidebar-logo { display: none; }
  .nav-links a { justify-content: center; padding: 14px; border-left: none; }
  .nav-links a i { font-size: 18px; }
  .content { margin-left: 60px; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .login-features { flex-direction: column; align-items: center; }
}
