/* === Root Theme Variables === */
:root {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --text: #f5f5f5;
  --accent: #7b5eff;
  --danger: #e74c3c;
  --muted: #888;
}

/* === Global Reset & Layout === */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(120deg, rgba(123, 94, 255, 0.75), rgba(18, 194, 183, 0.75), rgba(123, 94, 255, 0.75));
  background-size: 180% 180%;
  animation: gradientDrift 18s ease-in-out infinite;
  opacity: 0.75;
  z-index: -1;
  pointer-events: none;
}

@keyframes gradientDrift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* === Containers === */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding: 3rem 0 2rem;
}

/* === Header === */
.site-header {
  background: #111;
  border-bottom: 1px solid #222;
  padding: 0.8rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand .logo {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s, border-bottom 0.2s;
}

.nav-links a.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

.nav-links a:hover {
  color: var(--accent);
}

@media (max-width: 900px) {
  .nav-links {
    gap: 0.6rem 1.5rem;
  }
}

.icon-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  transition: transform 0.15s ease;
}

.icon-btn img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.icon-btn:hover {
  transform: translateY(-1px);
}

.icon-btn.danger img {
  filter: hue-rotate(-15deg) saturate(1.2);
}

.ticket-icons,
.helpdesk-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ticket-icons form,
.helpdesk-actions form {
  margin: 0;
}

.discord-login {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 0.6rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease-in-out, transform 0.1s;
}

.discord-login:hover {
  background: #6b4cff;
  transform: translateY(-1px);
}

.discord-icon {
  width: 20px;
  height: 20px;
}

.logout {
  color: var(--danger);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #333;
}

.username {
  font-size: 0.9rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* === Cards === */
.card {
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  margin-bottom: 2rem;
}

/* === Quick Actions === */
.quick-actions-form input {
  margin-bottom: 0.75rem;
}

.quick-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.quick-action-buttons button {
  flex: 1 1 200px;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  border: none;
  background: #333;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.quick-action-buttons button.danger {
  background: var(--danger);
  color: #fff;
}

/* === Online Users === */
.online-users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.online-count {
  color: var(--muted);
  font-weight: 600;
}

.online-users-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.online-users-empty {
  color: var(--muted);
  margin: 0;
}

.online-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #111;
  padding: 0.6rem 0.9rem;
  border-radius: 0.75rem;
  min-width: 220px;
  flex: 1 1 220px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-online { background: #43b581; }
.status-idle { background: #faa61a; }
.status-dnd { background: #f04747; }
.status-offline { background: #e74c3c; }
.status-issue { background: #faa61a; }

.online-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #222;
}

.online-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.online-user-name {
  font-weight: 600;
}

.online-user-status {
  font-size: 0.85rem;
  color: var(--muted);
}

/* === Dashboard Panels === */
.dashboard-top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.dashboard-top-row .card {
  flex: 1 1 300px;
}

.dashboard-top-row .quick-actions {
  flex: 2 1 520px;
}

.staff-availability-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.staff-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.staff-select-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.staff-select-row select {
  margin-bottom: 0;
  flex: 1;
}

.staff-helper-text {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.staff-helper-text .staff-name {
  font-weight: 600;
  color: var(--text);
}

.staff-helper-text .staff-state {
  font-size: 0.85rem;
}

/* === Helpdesk === */
.stacked-form label {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.stacked-form input,
.stacked-form textarea {
  margin-bottom: 1rem;
}

.question-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.question-input-row textarea {
  flex: 1;
}

.emoji-picker {
  position: relative;
  min-width: 56px;
}

.emoji-picker button {
  width: 56px;
  height: 56px;
  border-radius: 0.75rem;
  border: 1px solid #333;
  background: #111;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.emoji-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 0.75rem;
  padding: 0.4rem;
  display: none;
  grid-template-columns: repeat(5, 40px);
  gap: 0.3rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 20;
}

.emoji-menu button {
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: #252525;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.emoji-menu button:hover {
  border-color: var(--accent);
  background: #2e2e2e;
}

.emoji-menu.open {
  display: grid;
}

.helpdesk-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.helpdesk-actions form {
  margin: 0;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: capitalize;
  font-size: 0.85rem;
}

.status-new { background: rgba(123, 94, 255, 0.2); color: #c7b8ff; }
.status_in_progress,
.status-in_progress { background: rgba(255, 196, 86, 0.2); color: #ffd18a; }
.status-solved { background: rgba(76, 175, 80, 0.2); color: #8de48f; }

h1, h2, h3 {
  color: var(--text);
  margin-top: 0;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.secondary {
  background: #333;
  color: var(--text);
}

.btn.danger {
  background: var(--danger);
  color: white;
}

.btn.small {
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
}

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.responsive-table {
  width: 100%;
  overflow-x: auto;
}

.logs-table table {
  min-width: 720px;
}

.logs-table table td,
.logs-table table th {
  vertical-align: top;
}

.logs-table pre {
  background: #0f0f0f;
  border-radius: 0.5rem;
  padding: 0.6rem;
  margin: 0;
  max-width: 420px;
  overflow-x: auto;
  font-size: 0.85rem;
}

table th, table td {
  padding: 0.75rem 1rem;
  text-align: left;
}

table thead {
  background: #222;
  font-weight: 600;
}

table tr:nth-child(even) {
  background: #181818;
}

/* === Forms === */
input, textarea, select {
  width: 100%;
  padding: 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid #333;
  background: #111;
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.transcript-block {
  min-height: 280px;
  resize: vertical;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  line-height: 1.4;
  white-space: pre-wrap;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.3rem;
}

.event-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row > div {
  flex: 1;
  min-width: 220px;
}

.location-fieldset {
  border: 1px solid #333;
  border-radius: 0.6rem;
  padding: 1rem;
}

.location-fieldset legend {
  padding: 0 0.5rem;
  color: var(--muted);
}

.location-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.location-options label {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.location-field select,
.location-field input {
  margin-bottom: 0;
}

.card-actions {
  margin-bottom: 1rem;
}

.small-text {
  font-size: 0.85rem;
}

.event-launcher {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn.plus-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1rem;
}

.btn.plus-btn span {
  font-size: 1.2rem;
  line-height: 1;
}

body.modal-open {
  overflow: hidden;
}

.event-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.event-modal.active {
  display: flex;
}

.event-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.event-modal__dialog {
  position: relative;
  max-width: 620px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
}

.event-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.event-modal__close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* === Pagination === */
.pagination {
  text-align: center;
  margin-top: 1.5rem;
}

.pagination a {
  display: inline-block;
  margin: 0 0.3rem;
  padding: 0.4rem 0.8rem;
  border-radius: 0.4rem;
  background: #222;
  color: #ddd;
  text-decoration: none;
  transition: background 0.2s;
}

.pagination a.active {
  background: var(--accent);
  color: #fff;
}

.pagination a:hover {
  background: #444;
}

/* === Error + Login Cards === */
.login-card, .error-card {
  text-align: center;
  max-width: 450px;
  margin: 5rem auto;
}

.error-box {
  background: #2a0c0c;
  color: #ff6b6b;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.warning-box {
  background: #2a2310;
  color: #ffd769;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.success-box {
  background: #102a16;
  color: #7dffb0;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* === Logs === */
pre {
  background: #111;
  padding: 0.5rem;
  border-radius: 0.4rem;
  overflow-x: auto;
  font-size: 0.8rem;
  color: #ccc;
}

/* === Footer === */
.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem 0;
  margin-top: auto;
  background: #0d0d0d;
}

.footer-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.bot-status-dot {
  width: 12px;
  height: 12px;
}

.bot-status-copy {
  text-align: left;
}

.bot-status-copy span {
  font-weight: 600;
  color: var(--text);
}

.bot-status-detail {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer hr {
  border: 0;
  border-top: 1px solid #333;
  width: 90%;
  margin: 1rem auto;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.attributions-card ul {
  list-style: disc;
  padding-left: 1.2rem;
}

.attributions-card li {
  margin-bottom: 0.35rem;
}

.contribution-cta {
  margin-top: 1.5rem;
  border: 1px solid #333;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  background: #0d0d0d;
}

.contribution-cta summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.contribution-cta textarea {
  margin: 0;
}

.contribution-cta .contribution-input {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.contribution-cta .contribution-submit {
  align-self: flex-end;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

/* === Responsive Design === */
@media (max-width: 768px) {
  .header-flex {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    display: flex;
    flex-wrap: wrap;
    margin-top: 0.5rem;
  }

  .nav-links a {
    margin: 0.4rem 0.6rem;
  }

  .user-info {
    margin-top: 0.5rem;
  }

  .card {
    padding: 1rem;
  }

  .dashboard-top-row {
    flex-direction: column;
  }

  table th, table td {
    padding: 0.5rem 0.6rem;
  }
}

/* === Utility Classes === */
.header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.stat {
  background: #151515;
  border-radius: 0.8rem;
  padding: 1rem;
  text-align: center;
}

.stat .label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.stat .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.small-text {
  font-size: 0.8rem;
}

/* === Hover Animations === */
a, button {
  transition: all 0.2s ease-in-out;
}

a:hover, button:hover {
  filter: brightness(1.2);
}

/* === Smooth Scroll === */
html {
  scroll-behavior: smooth;
}
