/* Rainbow Radio Wales — admin dashboard */

:root {
  --ink: #08080d;
  --side: #0b0b12;
  --panel: #12131c;
  --panel-2: #171926;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f2f1f6;
  --muted: #9d9ab0;
  --c1: #ff2e88;
  --c2: #ff7a1a;
  --c3: #ffd23f;
  --c4: #3ed598;
  --c5: #37b6f6;
  --c6: #a855f7;
  --rainbow: linear-gradient(90deg, var(--c1), var(--c2) 22%, var(--c3) 42%, var(--c4) 62%, var(--c5) 80%, var(--c6));
  --display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}

:focus-visible {
  outline: 2px solid var(--c3);
  outline-offset: 2px;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ---------- shell ---------- */

.admin-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 22px 16px 18px;
  z-index: 30;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.side-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  padding: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.side-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 9px;
}

.side-brand span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.side-brand strong {
  font-family: var(--display);
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.side-brand em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}

.side-link svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.side-link.is-active {
  background: linear-gradient(90deg, rgba(255, 46, 136, 0.18), rgba(168, 85, 247, 0.12));
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--c1);
}

.side-foot {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 34px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 13, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.admin-topbar h1 {
  font-size: 26px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
}

.admin-content {
  padding: 28px 34px 60px;
  max-width: 1220px;
  width: 100%;
}

.admin-notice {
  margin: 18px 34px 0;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(62, 213, 152, 0.35);
  background: rgba(62, 213, 152, 0.1);
  color: #a9f0cf;
  font-size: 14px;
  font-weight: 500;
}

/* ---------- buttons ---------- */

.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.btn-admin:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-admin-primary {
  background: var(--rainbow);
  border-color: transparent;
  color: #08080d;
}

.btn-admin-primary:hover {
  background: var(--rainbow);
  filter: brightness(1.08);
}

.btn-admin-danger {
  color: #ff9ab8;
  border-color: rgba(255, 46, 136, 0.35);
  background: rgba(255, 46, 136, 0.08);
}

.btn-admin-danger:hover {
  background: rgba(255, 46, 136, 0.18);
  border-color: rgba(255, 46, 136, 0.55);
}

.btn-xs {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 7px;
}

/* ---------- dashboard ---------- */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.dash-stats {
  grid-column: span 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.stat-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.stat-value {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  background: var(--rainbow);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 12.5px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 17px;
}

.panel-link {
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
}

.panel-link:hover {
  color: var(--text);
}

.panel-intro {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 20px;
  max-width: 80ch;
}

.panel-live {
  border-color: rgba(255, 46, 136, 0.3);
  background: linear-gradient(150deg, rgba(255, 46, 136, 0.09), rgba(18, 19, 28, 1) 55%);
  grid-column: span 1;
}

.live-title {
  font-family: var(--display);
  font-size: 21px;
  margin-bottom: 6px;
}

.live-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.dash-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.dash-list li:last-child {
  border-bottom: 0;
}

.dash-list div {
  display: flex;
  flex-direction: column;
}

.dash-list strong {
  font-size: 13.5px;
  font-weight: 600;
}

.dash-list span {
  font-size: 12px;
  color: var(--muted);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 640px;
}

.admin-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.row-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
}

.row-title:hover {
  color: var(--c3);
}

.row-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.cell-meta {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.cell-actions form {
  display: inline-block;
}

.cell-actions > * + * {
  margin-left: 6px;
}

.cell-empty {
  color: var(--muted);
  text-align: center;
  padding: 34px 16px !important;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-published {
  color: #7ce8be;
  background: rgba(62, 213, 152, 0.1);
  border: 1px solid rgba(62, 213, 152, 0.28);
}

.status-draft {
  color: #c9c6d8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

/* ---------- forms ---------- */

.admin-form {
  max-width: 900px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-full {
  grid-column: span 2;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input[type='text'],
.field input[type='number'],
.field input[type='date'],
.field input[type='time'],
.field input[type='email'],
.field input[type='url'],
.field textarea,
.field select,
.settings-group input[type='text'],
.settings-group textarea,
.upload-form input[type='file'] {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #0b0c14;
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.settings-group input:focus,
.settings-group textarea:focus {
  outline: none;
  border-color: rgba(255, 210, 63, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.12);
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 13px !important;
  line-height: 1.65 !important;
  min-height: 340px;
}

.hint {
  font-size: 12px;
  color: #7f7d90;
  line-height: 1.45;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: 13.5px;
}

.check-field input {
  accent-color: var(--c1);
  width: 16px;
  height: 16px;
}

.image-field {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.image-preview {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: #0b0c14;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 11px;
  color: var(--muted);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-controls {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.image-controls input[type='file'] {
  font-size: 12.5px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.form-actions-sticky {
  position: sticky;
  bottom: 0;
  background: rgba(8, 8, 13, 0.92);
  backdrop-filter: blur(10px);
  padding: 16px 0;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  z-index: 5;
}

.form-error {
  padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid rgba(255, 46, 136, 0.4);
  background: rgba(255, 46, 136, 0.1);
  color: #ffb4cd;
  font-size: 13.5px;
  margin-bottom: 20px;
}

.settings-group {
  max-width: 900px;
}

/* ---------- media ---------- */

.upload-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.upload-form input[type='file'] {
  width: auto;
  flex: 1;
  min-width: 220px;
  padding: 9px 12px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.media-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0b0c14;
}

.media-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.media-item figcaption {
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.media-name {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-path {
  width: 100%;
  font-size: 11px;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #07080e;
  color: #9cd9ff;
  font-family: ui-monospace, monospace;
}

.media-item form {
  align-self: flex-start;
}

/* ---------- auth ---------- */

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(50% 60% at 20% 10%, rgba(255, 46, 136, 0.22), transparent 70%),
    radial-gradient(45% 55% at 85% 90%, rgba(168, 85, 247, 0.22), transparent 70%),
    var(--ink);
  padding: 24px;
}

.auth-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.auth-brand {
  padding: 48px 40px;
  background: linear-gradient(150deg, rgba(255, 46, 136, 0.16), rgba(168, 85, 247, 0.14) 55%, rgba(55, 182, 246, 0.12));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  position: relative;
  overflow: hidden;
}

.auth-brand img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #fff;
  padding: 4px;
  object-fit: contain;
}

.auth-brand h1 {
  font-size: 30px;
  letter-spacing: -0.03em;
}

.auth-brand p {
  color: #d5d2e2;
  font-size: 14px;
  margin-top: 8px;
}

.auth-rainbow {
  position: absolute;
  inset: auto 0 0 0;
  height: 6px;
  background: var(--rainbow);
}

.auth-panel {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-panel h2 {
  font-size: 26px;
}

.auth-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 10px 0 26px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.auth-form input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #0b0c14;
  color: var(--text);
  font-size: 15px;
  font-family: var(--body);
}

.auth-form input:focus {
  outline: none;
  border-color: rgba(255, 210, 63, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.12);
}

.auth-form .btn-admin {
  margin-top: 8px;
  padding: 12px;
  font-size: 14.5px;
}

.auth-error {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 46, 136, 0.4);
  background: rgba(255, 46, 136, 0.1);
  color: #ffb4cd;
  font-size: 13.5px;
  margin-bottom: 18px;
}

.auth-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 20px;
}

.auth-hint a {
  color: var(--c3);
}

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dash-stats {
    grid-column: span 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 30px 0 60px rgba(0, 0, 0, 0.5);
  }

  .admin-side.is-open {
    transform: none;
  }

  .admin-menu-btn {
    display: block;
  }

  .admin-topbar {
    padding: 18px 20px;
  }

  .admin-topbar h1 {
    font-size: 21px;
  }

  .admin-content {
    padding: 20px 20px 48px;
  }

  .admin-notice {
    margin: 14px 20px 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: auto;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    padding: 32px 28px;
  }

  .auth-panel {
    padding: 32px 28px;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-stats {
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-field {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .panel {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .dash-stats {
    grid-template-columns: 1fr;
  }

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