:root {
  --green-deep:   #1B3A2D;
  --green-mid:    #2D6A4F;
  --green-light:  #8FB896;
  --gold:         #C9A84C;
  --gold-light:   #E8C97A;
  --cream:        #F8F4EC;
  --cream-dark:   #EDE8DC;
  --charcoal:     #1A1A1A;
  --white:        #FFFFFF;
  --status-new:       #C9A84C;
  --status-confirmed: #2980B9;
  --status-completed: #27AE60;
  --status-cancelled: #C0392B;
  --status-approved:  #27AE60;
  --status-rejected:  #C0392B;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  color: var(--charcoal);
  background: var(--cream);
}

h1, h2, h3, .font-display { font-family: 'Playfair Display', serif; }

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--green-deep);
  color: rgba(248,244,236,0.8);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar .sidebar-logo {
  padding: 24px;
}
.admin-sidebar .sidebar-logo img {
  width: 160px;
  display: block;
}

.admin-nav { flex: 1; padding: 0 0 16px; }

.admin-nav-section { border-bottom: 1px solid rgba(255,255,255,0.08); }

.admin-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  font-size: 14px;
  padding: 14px 24px;
  font-weight: 700;
}
.admin-nav-toggle .chevron { transition: transform 0.2s ease; }
.admin-nav-section.open .admin-nav-toggle .chevron { transform: rotate(90deg); }

.admin-nav-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.admin-nav-section.open .admin-nav-items { max-height: 300px; }

.admin-nav-items a, .admin-nav-single {
  display: block;
  padding: 10px 24px 10px 36px;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.admin-nav-single { padding-left: 24px; font-weight: 700; }

.admin-nav-items a:hover, .admin-nav-single:hover { color: var(--gold); }

.admin-nav-items a.active, .admin-nav-single.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(201,168,76,0.08);
}

.admin-signout {
  margin: 16px 24px;
  padding: 10px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: var(--cream);
  background: transparent;
  font-size: 14px;
}
.admin-signout:hover { border-color: var(--gold); color: var(--gold); }

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

.admin-topbar {
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-topbar h1 { font-family: 'DM Sans', sans-serif; font-size: 18px; font-weight: 700; margin: 0; }
.admin-topbar-right { display: flex; align-items: center; gap: 16px; }
.admin-topbar-user { font-size: 14px; color: #6b6b6b; }
.admin-topbar-signout { background: none; border: none; font-size: 14px; color: var(--green-mid); font-weight: 600; }
.admin-hamburger { display: none; background: none; border: none; font-size: 22px; }

.admin-content { padding: 24px; flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.btn-gold { background: var(--gold); color: var(--charcoal); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border: 1px solid var(--green-mid); color: var(--green-mid); }
.btn-outline:hover { background: var(--green-mid); color: var(--white); }
.btn-danger { background: transparent; border: 1px solid var(--status-cancelled); color: var(--status-cancelled); }
.btn-danger:hover { background: var(--status-cancelled); color: var(--white); }
.btn-text { background: none; border: none; color: var(--green-mid); font-weight: 600; }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Tiles ---------- */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.tile {
  border-radius: 12px;
  padding: 24px;
  color: var(--white);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile-gold { background: var(--gold); color: var(--charcoal); }
.tile-green { background: var(--green-mid); }
.tile-blue { background: var(--status-confirmed); }
.tile-grey { background: #6b7280; }
.tile .tile-count { font-size: 36px; font-weight: 700; font-family: 'Playfair Display', serif; }
.tile .tile-label { font-size: 13px; opacity: 0.85; margin-top: 4px; }

/* ---------- Cards (dashboard sub-panels, caddies grid) ---------- */
.panel {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--cream-dark);
  padding: 20px;
  margin-bottom: 24px;
}
.panel h2 { font-size: 16px; margin: 0 0 16px; font-family: 'DM Sans', sans-serif; font-weight: 700; }

/* ---------- Tables ---------- */
table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}
.admin-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b6b6b;
  padding: 10px 12px;
  border-bottom: 2px solid var(--cream-dark);
}
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 14px;
}
.admin-table tr.row-clickable { cursor: pointer; }
.admin-table tr.row-clickable:hover { background: var(--cream); }
.admin-table-wrap { overflow-x: auto; background: var(--white); border-radius: 12px; border: 1px solid var(--cream-dark); }
.admin-table-wrap table { border-radius: 12px; overflow: hidden; }

.detail-row td { padding: 0; border-bottom: 1px solid var(--cream-dark); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
}
.badge-new { background: var(--status-new); color: var(--charcoal); }
.badge-confirmed { background: var(--status-confirmed); }
.badge-completed { background: var(--status-completed); }
.badge-cancelled { background: var(--status-cancelled); }
.badge-approved { background: var(--status-approved); }
.badge-rejected { background: var(--status-rejected); }
.badge-active { background: var(--status-completed); }
.badge-inactive { background: #9ca3af; }
.badge-gold { background: var(--gold); color: var(--charcoal); }

/* ---------- Filter tabs ---------- */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tab {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  font-size: 13px;
  font-weight: 600;
  color: #555;
}
.filter-tab.active { background: var(--green-deep); color: var(--white); border-color: var(--green-deep); }

/* ---------- Header row ---------- */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-row h1 { margin: 0; font-size: 26px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #444;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="password"], input[type="file"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--cream-dark);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: var(--white);
  color: var(--charcoal);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-mid); }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---------- Course selector (pill/tag multi-select) ---------- */
.course-selector {
  border: 1px solid var(--green-mid);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
  cursor: text;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: white;
  position: relative;
}
.course-pill {
  background: var(--gold);
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px 3px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.course-pill-remove {
  cursor: pointer;
  font-size: 14px;
  opacity: 0.7;
  line-height: 1;
}
.course-pill-remove:hover { opacity: 1; }
.course-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--green-mid);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 4px;
}
.course-search {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.course-option {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--charcoal);
}
.course-option:hover { background: var(--cream); }
.course-option.selected { color: var(--green-mid); font-weight: 600; }
.course-option.selected::after { content: "✓"; color: var(--gold); }
.checkbox-item input { width: auto; }

.toggle-group { display: flex; gap: 8px; }
.toggle-option {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--cream-dark);
  background: var(--white);
  font-size: 14px;
  font-weight: 600;
}
.toggle-option.active { background: var(--green-mid); color: var(--white); border-color: var(--green-mid); }

.star-picker { display: flex; gap: 4px; font-size: 22px; }
.star-picker span { cursor: pointer; color: #d9d9d9; }
.star-picker span.filled { color: var(--gold); }

.search-input { max-width: 320px; }

.save-confirm { color: var(--status-completed); font-size: 13px; font-weight: 600; margin-left: 8px; }
.save-confirm-error { color: var(--status-cancelled); }

/* ---------- Caddie card grid ---------- */
.caddie-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.caddie-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--cream-dark);
}
.caddie-card .photo-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--cream-dark); }
.caddie-card .photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.caddie-card .badge-pill {
  position: absolute; top: 10px; right: 10px;
  background: var(--gold); color: var(--charcoal);
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.caddie-card .card-body { padding: 16px; }
.caddie-card .card-body h3 { margin: 0 0 6px; font-size: 18px; }
.caddie-card .stars { color: var(--gold); margin-bottom: 6px; }
.caddie-card .courses-line { font-size: 13px; color: #6b6b6b; margin-bottom: 8px; }
.caddie-card .pills-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.caddie-card .pill { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--cream-dark); color: #444; }
.caddie-card .pill.plays-yes { background: rgba(39,174,96,0.15); color: #1e7e42; }
.caddie-card .pill.plays-no { background: #ececec; color: #888; }
.caddie-card .card-actions { display: flex; gap: 8px; }
.caddie-card .card-actions .btn { flex: 1; }

/* ---------- Photo gallery ---------- */
.photo-gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.photo-slot { position: relative; aspect-ratio: 1/1; border-radius: 8px; overflow: hidden; background: var(--cream-dark); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot .photo-remove-btn { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; border: none; font-size: 13px; line-height: 1; cursor: pointer; }
.photo-slot.primary::after { content: "Primary"; position: absolute; bottom: 4px; left: 4px; background: var(--gold); color: var(--charcoal); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.photo-slot-add { display: flex; align-items: center; justify-content: center; border: 2px dashed #ccc; cursor: pointer; color: #999; font-size: 28px; }
.photo-slot-add:hover { border-color: var(--green-mid); color: var(--green-mid); }
.photo-slot-add input[type="file"] { display: none; }

/* ---------- Slide-in panel ---------- */
.slide-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: none; z-index: 100;
}
.slide-overlay.open { display: block; }
.slide-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 100%;
  background: var(--white); z-index: 101;
  transform: translateX(100%); transition: transform 0.25s ease;
  overflow-y: auto; padding: 24px;
}
.slide-overlay.open .slide-panel { transform: translateX(0); }
.slide-panel h2 { margin-top: 0; }
.slide-panel-close { position: absolute; top: 20px; right: 20px; background: none; border: none; font-size: 20px; }

/* ---------- Detail panel (inline expand) ---------- */
.detail-panel {
  background: var(--cream);
  border-left: 4px solid var(--green-mid);
  padding: 24px;
}
.detail-panel h3 { margin-top: 0; font-size: 14px; letter-spacing: 0.05em; text-transform: uppercase; color: #6b6b6b; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.detail-field { font-size: 14px; }
.detail-field label { display: block; font-size: 12px; color: #888; margin-bottom: 2px; }
.detail-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { background: var(--cream-dark); padding: 4px 10px; border-radius: 999px; font-size: 12px; }

/* ---------- Login page ---------- */
.login-page {
  min-height: 100vh;
  background: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card img.login-logo { width: 180px; margin: 0 auto 24px; display: block; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #999; font-size: 13px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--cream-dark); }
.login-error { color: var(--status-cancelled); font-size: 13px; margin-top: 12px; }
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px; border: 1px solid var(--cream-dark); border-radius: 6px; background: var(--white);
  font-weight: 600; font-size: 14px;
}
.btn-google:hover { background: var(--cream); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: #888; font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .tiles-grid { grid-template-columns: repeat(2, 1fr); }
  .caddie-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row, .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 200;
    width: 260px;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-hamburger { display: block; }
  .tiles-grid { grid-template-columns: 1fr 1fr; }
  .caddie-grid { grid-template-columns: 1fr; }
  .admin-topbar-user { display: none; }
}
