/*
  Server Name - simple Minecraft Java server website
  Shared styles for all pages.
*/

:root {
  color-scheme: light;
  --page-background: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f2fbf7;
  --border: #e1eaf2;
  --text: #142a55;
  --muted: #7790b5;
  --green: #1ba466;
  --green-dark: #087b49;
  --green-soft: #e9f8f0;
  --red: #de4545;
  --red-soft: #fff0f0;
  --amber: #b7791f;
  --amber-soft: #fff7e8;
  --blue-soft: #edf4ff;
  --radius: 7px;
  --content-width: 940px;
}

* {
  box-sizing: border-box;
}

/* Make sure anything marked "hidden" stays hidden, even links styled with display rules. */
[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--page-background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: #2358a5;
}

button,
input,
textarea {
  font: inherit;
}

button,
.button {
  display: inline-block;
  border: 1px solid #cbd7e5;
  border-radius: 4px;
  padding: 8px 13px;
  background: #ffffff;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: #f1f5fa;
}

button:focus-visible,
.button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #5186d8;
  outline-offset: 2px;
}

button.primary,
.button.primary {
  border-color: var(--green-dark);
  background: var(--green-dark);
  color: #ffffff;
}

button.primary:hover,
.button.primary:hover {
  background: #066b40;
}

button.danger {
  border-color: #efc7c7;
  color: #b72b2b;
}

button.danger:hover {
  background: var(--red-soft);
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid #cbd7e5;
  border-radius: 4px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: #90a0b7;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.navbar {
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(100% - 36px, var(--content-width));
  min-height: 66px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #cfe4d8;
  border-radius: 4px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 15px;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 4px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-bottom: 3px solid transparent;
  color: #526889;
  text-decoration: none;
}

.nav-links a:hover {
  background: #f8fafc;
  color: var(--text);
}

.nav-links a[aria-current="page"] {
  border-bottom-color: var(--green);
  color: var(--green-dark);
  font-weight: 700;
}

.account-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  white-space: nowrap;
}

.account-name {
  color: #526889;
  font-size: 14px;
}

.logout-link {
  padding: 6px 10px;
  font-size: 13px;
}

.page-content {
  width: min(100% - 36px, var(--content-width));
  margin: 22px auto 38px;
}

.page-heading {
  margin: 0 0 5px;
  font-size: 24px;
  line-height: 1.25;
}

.page-intro {
  margin: 0 0 20px;
  color: var(--muted);
}

.panel {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2,
.panel-body h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
}

.panel-body {
  padding: 18px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Main page: server status */
.status-panel {
  padding: 20px;
  border-color: #dcefe7;
  background: linear-gradient(110deg, #f4fffa 0%, #ffffff 100%);
}

.status-heading-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.status-indicator {
  width: 16px;
  height: 16px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.status-indicator.maintenance {
  background: #e6a23c;
}

.status-indicator.offline {
  background: var(--red);
}

.status-title {
  margin: 0;
  color: var(--green-dark);
  font-size: 21px;
  line-height: 1.3;
}

.status-title.maintenance-text {
  color: var(--amber);
}

.status-title.offline-text {
  color: #b72b2b;
}

.status-message {
  margin: 4px 0 0;
  color: #438b68;
}

.status-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 23px;
}

.metric {
  min-width: 0;
  padding: 0 18px;
  border-right: 1px solid #e0eee7;
}

.metric:first-child {
  padding-left: 0;
}

.metric:last-child {
  padding-right: 0;
  border-right: 0;
}

.metric-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
}

.players-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.player-list {
  padding: 4px 18px 12px;
}

.player-group + .player-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 43px;
  padding: 5px 0;
}

.player-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid #d6dfeb;
  border-radius: 3px;
  background: #edf2f7;
  color: #7086a5;
  font-size: 13px;
  font-weight: 700;
}

.player-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 600;
}

.player-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.player-dot.offline {
  background: var(--red);
}

/* Main page: status states set by js/main.js */
.status-panel.loading .status-indicator,
.status-panel.unknown .status-indicator {
  background: #b8c4d4;
}

.status-panel.loading .status-title,
.status-panel.unknown .status-title {
  color: var(--text);
}

.status-panel.loading .status-message,
.status-panel.unknown .status-message {
  color: var(--muted);
}

.status-panel.maintenance {
  border-color: #f1e0bf;
  background: linear-gradient(110deg, var(--amber-soft) 0%, #ffffff 100%);
}

.status-panel.maintenance .status-message {
  color: var(--amber);
}

.status-panel.offline {
  border-color: #f2d4d4;
  background: linear-gradient(110deg, var(--red-soft) 0%, #ffffff 100%);
}

.status-panel.offline .status-message {
  color: #b72b2b;
}

.status-updated {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-updated:empty {
  display: none;
}

.empty-note {
  margin: 10px 0;
  color: var(--muted);
}

.last-seen {
  color: #a3b1c4;
}

/* Forms page */
.request-list {
  display: grid;
  gap: 10px;
}

.request-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
}

.request-content {
  flex: 1;
  min-width: 0;
}

.request-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.request-text {
  margin: 0;
  color: #526889;
  overflow-wrap: anywhere;
  white-space: pre-line; /* show the line breaks people typed */
}

.request-date {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.request-limit {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.composer {
  max-width: 680px;
  margin: 28px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.composer h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.composer-help {
  margin: 0 auto 14px;
  color: var(--muted);
  font-size: 13px;
}

.composer-form {
  display: flex;
  /* flex-end keeps the Submit button at the bottom as the text box grows */
  align-items: flex-end;
  gap: 8px;
}

.composer-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 200px; /* after this, it scrolls instead of growing */
  overflow-y: hidden; /* forms.js turns scrolling on once it hits max-height */
  resize: none; /* the box sizes itself, so hide the drag handle */
  line-height: 1.5;
}

.composer-form button {
  height: 46px;
}

.demo-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #dbe6f5;
  border-radius: 4px;
  background: var(--blue-soft);
  color: #4d6384;
  font-size: 12px;
  text-align: left;
}

/* Forms page: messages and disabled states set by js/forms.js */
.form-message {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 4px;
  font-size: 13px;
  text-align: left;
}

.form-message.success {
  border: 1px solid #cfe4d8;
  background: var(--green-soft);
  color: var(--green-dark);
}

.form-message.error {
  border: 1px solid #efc7c7;
  background: var(--red-soft);
  color: #b72b2b;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Admin page */
.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.small-button {
  padding: 5px 10px;
  font-size: 13px;
}

#admin-message {
  margin: 0 0 12px;
}

/* Info page */
.info-copy {
  margin: 9px 0 0;
  color: #526889;
}

.download-row {
  display: flex;
  margin-top: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.file-description {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #f7f9fc;
  color: #526889;
  font-size: 12px;
  font-weight: 700;
}

.file-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.file-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.rules-list {
  margin: 14px 0 0;
  padding-left: 22px;
  color: #526889;
}

.rules-list li {
  padding-left: 4px;
  margin-bottom: 9px;
}

.rules-list li:last-child {
  margin-bottom: 0;
}

/* Login page */
.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 390px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.login-brand {
  justify-content: center;
  margin-bottom: 22px;
}

.login-card h1 {
  margin: 0 0 5px;
  font-size: 23px;
  text-align: center;
}

.login-intro {
  margin: 0 0 22px;
  color: var(--muted);
  text-align: center;
}

.field-group {
  margin-bottom: 15px;
}

.field-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
  color: #526889;
  font-size: 13px;
}

.remember-row input {
  margin: 0;
}

.login-submit {
  width: 100%;
}

.login-footer {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-footer {
  padding: 16px 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 700px) {
  .navbar {
    flex-wrap: wrap;
    gap: 0 12px;
    padding-top: 12px;
  }

  .brand {
    padding: 5px 0 9px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    height: 43px;
  }

  .nav-links a {
    flex: 1;
    justify-content: center;
    padding: 0 7px;
  }

  .account-area {
    gap: 8px;
  }

  .account-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-content {
    margin-top: 16px;
  }

  .status-panel {
    padding: 16px;
  }

  .status-metrics {
    gap: 0;
    margin-top: 19px;
  }

  .metric {
    padding: 0 10px;
  }

  .metric-label {
    font-size: 12px;
  }

  .metric-value {
    font-size: 13px;
  }

  .panel-header,
  .panel-body {
    padding: 14px;
  }

  .player-list {
    padding-right: 14px;
    padding-left: 14px;
  }
}

@media (max-width: 430px) {
  .navbar,
  .page-content {
    width: calc(100% - 24px);
  }

  .brand {
    font-size: 14px;
  }

  .account-name {
    max-width: 74px;
    font-size: 12px;
  }

  .logout-link {
    padding: 5px 7px;
  }

  .status-title {
    font-size: 19px;
  }

  .status-metrics {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .metric,
  .metric:first-child,
  .metric:last-child {
    padding: 0;
    border-right: 0;
  }

  .metric-label {
    margin-bottom: 0;
  }

  .request-card {
    flex-wrap: wrap;
    gap: 8px;
  }

  .request-card .danger {
    margin-left: auto;
  }

  .request-limit {
    white-space: normal;
  }

  .composer-form,
  .download-row {
    align-items: stretch;
    flex-direction: column;
  }

  .download-row .button {
    width: 100%;
  }
}
