/* ==========================================================================
   ADMIN STYLESHEET
   ==========================================================================
   Loaded AFTER style.css on the admin pages, so it inherits all the colour
   and font tokens defined there and only adds what the admin screens need:
   forms, the login box, and the dashboard layout.

   Deliberately plainer than the public site - this is a tool, not a shop
   window. Clear labels and big hit areas matter more than atmosphere.
   ========================================================================== */


/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */

/* Centres the login box vertically in the window.
   min-height: 100vh = "at least the full height of the screen". */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.login-box__logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin: 0 auto var(--space-sm);
  border: 1px solid var(--border-gold);
}

.login-box h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: var(--space-xs);
}

.login-box__sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: var(--space-md);
}

.login-box__back {
  text-align: center;
  margin-top: var(--space-sm);
  font-size: 0.85rem;
}


/* ==========================================================================
   FORMS
   ========================================================================== */

.field {
  margin-bottom: var(--space-sm);
}

/* display:block puts the label on its own line above the input. */
.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Inputs don't inherit fonts by default, so we set them explicitly -
   otherwise they'd render in the browser's default font. */
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-bright);
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--gold-dim);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  /* We keep the default focus ring from style.css - it's how keyboard users
     see where they are. Only the border colour is customised here. */
}

.field textarea {
  min-height: 90px;
  resize: vertical;   /* let them drag it taller, but not wider */
}

.field__hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

/* Puts several fields side by side on a wide screen, stacked on mobile. */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
}


/* ==========================================================================
   MESSAGES
   --------------------------------------------------------------------------
   Success and error boxes. Note that each is distinguished by TEXT as well as
   colour - someone who is colour blind should never have to rely on the
   green/red difference alone to know whether something worked.
   ========================================================================== */

.message {
  padding: 0.7rem var(--space-sm);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  font-size: 0.9rem;
  border: 1px solid;
}

.message--error {
  background: rgba(122, 32, 32, 0.22);
  border-color: #a34040;
  color: #f0b8b8;
}

.message--success {
  background: rgba(47, 74, 52, 0.28);
  border-color: var(--green-bright);
  color: #b3d6bb;
}

/* Hidden until there's something to say. The .is-visible class is added by
   js/admin.js when a message needs showing. */
.message[hidden] {
  display: none;
}


/* ==========================================================================
   DASHBOARD LAYOUT
   ========================================================================== */

.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-gold);
  padding: var(--space-sm) 0;
}

.admin-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.admin-header h1 {
  font-size: 1.25rem;
  margin: 0;
}

.admin-header__user {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Each management area of the dashboard. */
.admin-section {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-top: 2px solid var(--border-gold);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.admin-section > h2 {
  font-size: 1.3rem;
  margin-bottom: var(--space-xs);
}

.admin-section__desc {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: var(--space-sm);
}

/* Divider between the "add/edit" form and the table below it. */
.admin-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-md) 0;
}

/* Filter buttons (All / OSRS / RS3) */
.filter-row {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.filter-btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-body);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.filter-btn:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* aria-pressed tells screen readers which filter is active. Styling the
   [aria-pressed="true"] state means the visual and the announced state can
   never drift apart. */
.filter-btn[aria-pressed='true'] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201, 168, 106, 0.10);
}


/* ==========================================================================
   TABLE ACTION BUTTONS
   ========================================================================== */

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-small {
  padding: 0.3rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn-small:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* Delete gets a warning colour on hover so it's harder to hit by accident.
   It also asks for confirmation - see js/admin.js. */
.btn-small--danger:hover {
  color: #f0b0b0;
  border-color: #a34040;
}

/* Row highlight while a record is loaded into the edit form. */
tr.is-editing {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

/* Narrow numeric column, e.g. the staff "Tier" number. */
.cell-center {
  text-align: center;
  color: var(--text-dim);
}

.form-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  align-items: center;
}

/* "Editing event #4" note above the form while editing. */
.editing-note {
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: var(--space-xs);
}


@media (max-width: 640px) {
  .admin-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .admin-section {
    padding: var(--space-sm);
  }
}
