:root {
  --green-dark: #2d5016;
  --green-mid: #4a7c26;
  --green-light: #7ab648;
  --gold: #c8952b;
  --gold-light: #f0c060;
  --cream: #faf8f2;
  --brown: #6b4c2a;
  --text: #2c2c2c;
  --text-light: #666;
  --border: #d4c9b0;
  --white: #ffffff;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --success: #27ae60;
  --success-light: #eafaf1;
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--green-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- NAVBAR ---- */
.navbar {
  background: var(--green-dark);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 58px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.navbar-brand img { height: 36px; }

.navbar-nav {
  display: flex;
  gap: 4px;
  list-style: none;
  flex: 1;
}

.navbar-nav a {
  color: rgba(255,255,255,0.85);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.navbar-nav a:hover, .navbar-nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
  text-decoration: none;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e53935;
  color: white;
  border-radius: 10px;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1;
}
.btn-link-inline {
  background: none;
  border: none;
  padding: 0;
  color: #4a7c59;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 2px;
}

.navbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
}

.navbar-user .yard-tag {
  background: var(--gold);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---- LAYOUT ---- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--green-dark);
}

.page-subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 2px;
}

/* ---- CARDS ---- */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  background: var(--green-dark);
  color: white;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-dark);
}

.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card.warning .stat-value { color: var(--danger); }
.stat-card.gold .stat-value { color: var(--gold); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--green-mid); color: white; }
.btn-primary:hover { background: var(--green-dark); color: white; text-decoration: none; }

.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: #a87820; color: white; text-decoration: none; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #a52318; color: white; text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--green-mid);
  border: 1.5px solid var(--green-mid);
}
.btn-outline:hover { background: var(--green-mid); color: white; text-decoration: none; }

.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-icon { padding: 6px 10px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 5px;
  font-size: 0.88rem;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.93rem;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--green-mid); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }

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

thead th {
  background: var(--green-dark);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f5f2ea; }
tbody td { padding: 10px 14px; vertical-align: middle; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gold { background: #fff3cd; color: #856404; }
.badge-grey { background: #eee; color: #666; }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.modal-header {
  background: var(--green-dark);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.modal-header .close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-success { background: var(--success-light); color: #145a32; border: 1px solid #a9dfbf; }
.alert-error { background: var(--danger-light); color: #7b241c; border: 1px solid #f5b7b1; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 60%, var(--green-light) 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 1.5rem;
  color: var(--green-dark);
  font-weight: 700;
}

.login-logo p {
  color: var(--text-light);
  font-size: 0.88rem;
  margin-top: 4px;
}

.login-logo .horseshoe {
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
}

/* ---- NOTICES SCROLLER ---- */
.notices-scroller {
  background: var(--green-dark);
  color: white;
  padding: 12px 24px;
  overflow: hidden;
  position: relative;
}

.notices-scroller h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  margin-bottom: 8px;
}

.notice-items { display: flex; flex-direction: column; gap: 10px; }

.notice-item {
  background: rgba(255,255,255,0.1);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
}

.notice-item .notice-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gold-light);
}

.notice-item .notice-body {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.85);
  margin-top: 2px;
}

/* ---- YARD HOME HERO ---- */
.yard-hero {
  background: linear-gradient(120deg, var(--green-dark), var(--green-mid));
  color: white;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.yard-hero h2 { font-size: 1.6rem; font-weight: 700; }
.yard-hero p { color: rgba(255,255,255,0.8); margin-top: 4px; }

/* ---- BOOKING GRID ---- */
.booking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.slot-btn {
  padding: 7px 6px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 0.82rem;
  text-align: center;
  background: white;
  transition: all 0.15s;
}
.slot-btn.available:hover { background: var(--green-light); color: white; border-color: var(--green-light); }
.slot-btn.booked { background: #fee; border-color: #fcc; color: var(--danger); cursor: not-allowed; }
.slot-btn.mine { background: var(--success-light); border-color: var(--success); color: var(--success); }

/* ---- TABS ---- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 9px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  border-radius: 6px 6px 0 0;
}

.tab-btn:hover { color: var(--green-mid); background: rgba(0,0,0,0.03); }
.tab-btn.active { color: var(--green-dark); border-bottom-color: var(--green-mid); font-weight: 600; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- MISC ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-gold { color: var(--gold); }
.fw-bold { font-weight: 700; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }

.actions-col { white-space: nowrap; }

.pound::before { content: '£'; }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 10px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .navbar-nav { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .yard-hero { padding: 20px; }
}
