/* Riverside Riding Centre — Yard Manager Admin Portal */

.admin-body {
  background-color: var(--off-white, #FAF6EF);
  color: var(--body-text, #3B332C);
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

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

.admin-body [hidden] {
  display: none !important;
}

.admin-header {
  background-color: var(--conifer-green, #2E4B34);
  color: var(--off-white, #FAF6EF);
  border-bottom: 3px solid var(--warm-sand, #D9C1A3);
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.admin-wordmark {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--off-white, #FAF6EF);
  text-decoration: none;
  letter-spacing: 0.01em;
  display: inline-block;
}

.admin-wordmark-sub {
  font-weight: 500;
  color: var(--warm-sand, #D9C1A3);
}

.admin-utility-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.admin-util-link {
  color: var(--off-white, #FAF6EF);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.9;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.admin-util-link:hover,
.admin-util-link:focus-visible {
  color: var(--warm-sand, #D9C1A3);
  opacity: 1;
}

.admin-user-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(217, 193, 163, 0.35);
}

.admin-user-name {
  font-size: 0.875rem;
  color: var(--warm-sand, #D9C1A3);
  font-weight: 600;
}

.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  width: 100%;
}

@media (min-width: 768px) {
  .admin-main {
    padding: 1.75rem 1.5rem 3.5rem;
  }
}

/* Gates */
.admin-gate-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 0;
}

.admin-gate-card {
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  border: 1px solid rgba(46, 75, 52, 0.16);
  border-top: 4px solid var(--conifer-green, #2E4B34);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 8px 24px rgba(59, 51, 44, 0.08);
}

.admin-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--conifer-green, #2E4B34);
  margin: 0 0 0.35rem;
}

.admin-gate-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.65rem;
  color: var(--conifer-green, #2E4B34);
  margin: 0 0 0.65rem;
  line-height: 1.2;
}

.admin-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.admin-muted {
  color: #6b5f54;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6rem 1.05rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.42rem 0.78rem;
  font-size: 0.84rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--conifer-green, #2E4B34);
  color: var(--off-white, #FAF6EF);
}

.btn-primary:hover:not(:disabled) {
  background-color: #233a28;
}

.btn-secondary {
  background-color: var(--warm-sand, #D9C1A3);
  color: var(--body-text, #3B332C);
  border-color: #c8ae8d;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #ceb28e;
}

.btn-outline {
  background-color: #ffffff;
  color: var(--conifer-green, #2E4B34);
  border-color: rgba(46, 75, 52, 0.35);
}

.btn-outline:hover:not(:disabled) {
  background-color: rgba(46, 75, 52, 0.06);
}

.btn-outline-light {
  background-color: transparent;
  color: var(--off-white, #FAF6EF);
  border-color: rgba(250, 246, 239, 0.45);
}

.btn-outline-light:hover:not(:disabled) {
  background-color: rgba(250, 246, 239, 0.12);
}

.btn-danger {
  background-color: var(--jump-red, #B33A3A);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background-color: #962f2f;
}

.btn-danger-outline {
  background-color: #ffffff;
  color: var(--jump-red, #B33A3A);
  border-color: rgba(179, 58, 58, 0.45);
}

.btn-danger-outline:hover:not(:disabled) {
  background-color: rgba(179, 58, 58, 0.08);
}

/* KPI Strip */
.admin-stats-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
  .admin-stats-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .admin-stats-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.stat-card {
  background: #ffffff;
  border: 1px solid rgba(46, 75, 52, 0.14);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-card-highlight {
  background: rgba(232, 175, 175, 0.22);
  border-color: rgba(179, 58, 58, 0.25);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b5f54;
}

.stat-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--conifer-green, #2E4B34);
  line-height: 1.15;
}

/* Tabs */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(217, 193, 163, 0.7);
}

.admin-tab {
  appearance: none;
  background: #ffffff;
  border: 1px solid rgba(46, 75, 52, 0.22);
  color: var(--body-text, #3B332C);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-tab:hover {
  border-color: var(--conifer-green, #2E4B34);
  background: rgba(217, 193, 163, 0.28);
}

.admin-tab.is-active {
  background: var(--conifer-green, #2E4B34);
  border-color: var(--conifer-green, #2E4B34);
  color: var(--off-white, #FAF6EF);
}

/* Section Headers & Panels */
.admin-panel {
  min-width: 0;
}

.section-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.45rem;
  color: var(--conifer-green, #2E4B34);
  margin: 0;
}

.section-subtitle {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  color: var(--conifer-green, #2E4B34);
  margin: 0 0 0.75rem;
}

.admin-card {
  background: #ffffff;
  border: 1px solid rgba(46, 75, 52, 0.14);
  border-radius: 12px;
  padding: 1.1rem;
  margin-bottom: 1.15rem;
  box-shadow: 0 2px 10px rgba(59, 51, 44, 0.04);
}

.admin-card-warm {
  background: rgba(217, 193, 163, 0.22);
  border-color: rgba(217, 193, 163, 0.8);
}

/* Forms */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .form-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.form-field label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--body-text, #3B332C);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="tel"],
.form-field input[type="date"],
.form-field input[type="time"],
.form-field input[type="number"],
.form-field input[type="url"],
.form-field select,
.form-field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.56rem 0.72rem;
  border-radius: 8px;
  border: 1px solid rgba(59, 51, 44, 0.28);
  background: #ffffff;
  color: var(--body-text, #3B332C);
  font-family: inherit;
  font-size: 0.93rem;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 2px solid rgba(46, 75, 52, 0.25);
  border-color: var(--conifer-green, #2E4B34);
}

.form-help {
  font-size: 0.79rem;
  color: #6b5f54;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--conifer-green, #2E4B34);
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.filter-bar .form-field {
  flex: 1 1 180px;
  max-width: 240px;
}

.uk-date-pill {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  background: rgba(168, 196, 214, 0.35);
  color: var(--body-text, #3B332C);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.badge-pending {
  background: rgba(232, 175, 175, 0.45);
  color: #6d2222;
}

.badge-confirmed {
  background: rgba(46, 75, 52, 0.14);
  color: var(--conifer-green, #2E4B34);
}

.badge-completed {
  background: rgba(168, 196, 214, 0.45);
  color: #1f465d;
}

.badge-cancelled,
.badge-closed {
  background: rgba(179, 58, 58, 0.15);
  color: var(--jump-red, #B33A3A);
}

.badge-sand {
  background: rgba(217, 193, 163, 0.48);
  color: var(--body-text, #3B332C);
}

.badge-sky {
  background: rgba(168, 196, 214, 0.4);
  color: #21455c;
}

.badge-archived {
  background: #ece7df;
  color: #6b5f54;
}

/* Alerts */
.admin-alert {
  padding: 0.75rem 0.95rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.admin-alert-danger {
  background: rgba(179, 58, 58, 0.1);
  border: 1px solid var(--jump-red, #B33A3A);
  color: #7d2020;
}

.admin-alert-info {
  background: rgba(168, 196, 214, 0.25);
  border: 1px solid var(--sky-blue, #A8C4D6);
  color: var(--body-text, #3B332C);
}

/* Booking Allocation Cards */
.bookings-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.booking-card {
  background: #ffffff;
  border: 1px solid rgba(46, 75, 52, 0.16);
  border-left: 5px solid var(--conifer-green, #2E4B34);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 2px 10px rgba(59, 51, 44, 0.04);
}

.booking-card.is-pending {
  border-left-color: var(--dusky-pink, #E8AFAF);
}

.booking-card.is-cancelled {
  border-left-color: var(--jump-red, #B33A3A);
  opacity: 0.88;
}

.booking-card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(217, 193, 163, 0.55);
}

.booking-rider-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.18rem;
  color: var(--conifer-green, #2E4B34);
  margin: 0 0 0.2rem;
}

.booking-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  font-size: 0.88rem;
  color: #5b5046;
}

.booking-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.booking-notes-box {
  background: var(--off-white, #FAF6EF);
  border: 1px solid rgba(217, 193, 163, 0.65);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
}

.booking-alloc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .booking-alloc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1120px) {
  .booking-alloc-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.booking-conflict-banner {
  background: rgba(179, 58, 58, 0.1);
  border: 2px solid var(--jump-red, #B33A3A);
  color: #7c1f1f;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
}

.booking-conflict-banner strong {
  color: var(--jump-red, #B33A3A);
}

.booking-conflict-list {
  margin: 0.35rem 0 0.55rem 1.15rem;
  padding: 0;
}

.booking-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
}

.booking-yard-notes-wrap {
  flex: 1 1 260px;
}

/* Cards grid for Horses, Arenas, Grooms, Events */
.yard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 680px) {
  .yard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .yard-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.horse-card {
  background: #ffffff;
  border: 1px solid rgba(46, 75, 52, 0.16);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.horse-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--warm-sand, #D9C1A3);
  overflow: hidden;
}

.horse-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  min-height: 140px;
  background: linear-gradient(135deg, #D9C1A3 0%, #eadac3 100%);
  color: var(--conifer-green, #2E4B34);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
}

.horse-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.horse-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.horse-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  color: var(--conifer-green, #2E4B34);
  margin: 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* Responsive Data Table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid rgba(217, 193, 163, 0.55);
  vertical-align: top;
}

.admin-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b5f54;
  background: var(--off-white, #FAF6EF);
}

@media (max-width: 720px) {
  .admin-table-stack thead {
    display: none;
  }
  .admin-table-stack,
  .admin-table-stack tbody,
  .admin-table-stack tr,
  .admin-table-stack td {
    display: block;
    width: 100%;
  }
  .admin-table-stack tr {
    background: #ffffff;
    border: 1px solid rgba(46, 75, 52, 0.14);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.75rem;
  }
  .admin-table-stack td {
    border-bottom: none;
    padding: 0.28rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .admin-table-stack td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.8rem;
    color: #6b5f54;
    flex-shrink: 0;
  }
}

/* Settings image preview */
.settings-media-preview {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(46, 75, 52, 0.18);
  max-width: 340px;
  margin-bottom: 0.45rem;
}

.settings-media-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

/* Modal */
.admin-modal[hidden] {
  display: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 41, 35, 0.55);
}

.admin-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 12px;
  border-top: 4px solid var(--conifer-green, #2E4B34);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(217, 193, 163, 0.65);
}

.admin-modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  color: var(--conifer-green, #2E4B34);
  margin: 0;
}

.admin-modal-close {
  appearance: none;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #6b5f54;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
}

.admin-modal-body {
  padding: 1.2rem 1.25rem;
}

.modal-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

/* Toasts */
.admin-toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
}

.admin-toast {
  background: var(--conifer-green, #2E4B34);
  color: var(--off-white, #FAF6EF);
  padding: 0.72rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  border-left: 4px solid var(--warm-sand, #D9C1A3);
}

.admin-toast.is-error {
  background: var(--jump-red, #B33A3A);
  border-left-color: #ffffff;
}

.empty-state {
  padding: 1.5rem;
  text-align: center;
  background: var(--off-white, #FAF6EF);
  border: 1px dashed rgba(46, 75, 52, 0.3);
  border-radius: 10px;
  color: #6b5f54;
  font-size: 0.94rem;
}
