/*
 * Page layout and legacy component classes, on the design tokens defined in site.css
 * (daylight + mango gradient). Selectors are unchanged from the original stylesheet so
 * page scripts keep working; only the look moved to tokens. See design-book.html.
 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--gc-font);
  background: var(--gc-bg);
  color: var(--gc-ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Legacy header (only pages outside the shared header still use it) */
header {
  background: var(--gc-surface);
  color: var(--gc-ink);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--gc-line);
}

.header-content {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: var(--gc-r-sm);
  object-fit: cover;
}

header h1 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 800;
  font-stretch: 75%;
}

header p.tagline {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--gc-muted);
  white-space: nowrap;
  padding-left: 0.75rem;
  border-left: 1px solid var(--gc-line);
  align-self: center;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  align-items: center;
}

nav a {
  color: var(--gc-muted);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--gc-r-sm);
  font-size: 0.9375rem;
  white-space: nowrap;
}

nav a:hover, nav a.active {
  color: var(--gc-ink);
  background: var(--gc-sunken);
}

@media (max-width: 768px) {
  nav {
    justify-content: center;
    gap: 0.5rem;
  }
  nav a {
    font-size: 0.875rem;
    padding: 0.4rem 0.6rem;
  }
}

main {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Class list (home) ---------- */
.search-section {
  display: flex;
  gap: 10px;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  align-items: center;
}

#searchInput {
  flex: 1;
  min-width: 250px;
  height: 44px;
  padding: 0 1rem 0 2.5rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.9375rem;
  background: var(--gc-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a5e63' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 0.9rem center / 18px;
}

#filterCategory,
#sortOrder,
#filterState,
#filterCity {
  height: 44px;
  padding: 0 2.25rem 0 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gc-ink);
  background: var(--gc-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141517' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.85rem center / 16px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

#filterCity {
  min-width: 150px;
}

#searchInput:hover,
#filterCategory:hover,
#sortOrder:hover,
#filterState:hover,
#filterCity:hover {
  background-color: var(--gc-fill-hover);
}

#searchInput:focus,
#filterCategory:focus,
#sortOrder:focus,
#filterState:focus,
#filterCity:focus {
  outline: none;
  background-color: var(--gc-surface);
  border-color: var(--gc-ink);
  box-shadow: 0 0 0 3px var(--gc-focus);
}

/* Search toggle icon — desktop keeps the full search box, so the icon is hidden. */
#searchToggle {
  display: none;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2rem 1.25rem;
  align-items: start;
}

.video-card {
  display: flex;
  flex-direction: column;
  background: var(--gc-surface);
  border-radius: var(--gc-r-lg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--gc-line);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px var(--gc-line), var(--gc-shadow-2);
}

.video-thumbnail {
  width: 100%;
  aspect-ratio: 4 / 5;
  height: auto;
  object-fit: cover;
  background: var(--gc-sunken);
}

.video-card-content {
  position: relative;
  padding: 0.875rem 1rem 1rem;
  background: var(--gc-surface);
}

.video-card h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--gc-ink);
}

.video-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--gc-muted);
  line-height: 1.45;
}

.video-meta {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--gc-subtle);
}

/* Dance-style tag: neutral chip with a colour dot (theme.js sets data-gc-style). */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--gc-chip);
  color: var(--gc-ink);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

.category-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--gc-subtle);
}

.category-badge[data-gc-style="kpop"]::before { background: var(--gc-style-kpop); }
.category-badge[data-gc-style="house"]::before { background: var(--gc-style-house); }
.category-badge[data-gc-style="hiphop"]::before { background: var(--gc-style-hiphop); }
.category-badge[data-gc-style="hardstyle"]::before { background: var(--gc-style-hardstyle); }
.category-badge[data-gc-style="freestyle"]::before { background: var(--gc-style-freestyle); }
.category-badge[data-gc-style="fitcho"]::before { background: var(--gc-style-fitcho); }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--gc-muted);
  background: var(--gc-surface);
  border-radius: var(--gc-r-lg);
  box-shadow: inset 0 0 0 1px var(--gc-line);
}

.empty-state p {
  font-size: 1rem;
  margin: 0 0 1rem;
}

.empty-state a {
  color: var(--gc-ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--gc-mango-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

/* ---------- Class modal ---------- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 21, 23, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overflow: auto;
}

.modal-content {
  position: relative;
  margin: 2rem auto;
  max-width: 880px;
  background: var(--gc-surface);
  border-radius: var(--gc-r-lg);
  overflow: hidden;
  box-shadow: var(--gc-shadow-2);
}

.close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: #fff;
  font-size: 1.75rem;
  font-weight: 400;
  cursor: pointer;
  z-index: 1001;
  background: rgba(20, 21, 23, 0.6);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.close:hover {
  background: var(--gc-ink);
}

#modalVideo {
  display: block;
  width: 100%;
  height: var(--gc-stage-h);
  max-height: none;
  object-fit: contain;
  background: var(--gc-ink);
}

.video-info {
  padding: 1.5rem;
}

.video-info h2 {
  margin: 0 0 0.375rem 0;
  color: var(--gc-ink);
  font-size: 1.75rem;
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1.1;
}

.video-info p {
  margin: 0.5rem 0;
  color: var(--gc-muted);
}

.delete-btn {
  margin-top: 1rem;
  padding: 0.625rem 1.25rem;
  background: var(--gc-surface);
  color: var(--gc-danger);
  border: 1px solid var(--gc-danger-line);
  border-radius: var(--gc-r-sm);
  cursor: pointer;
  font-weight: 700;
}

.delete-btn:hover {
  background: var(--gc-danger-tint);
}

/* ---------- Upload ---------- */
.upload-section {
  max-width: 640px;
  margin: 0 auto;
  background: var(--gc-surface);
  padding: 2rem;
  border-radius: var(--gc-r-lg);
  box-shadow: inset 0 0 0 1px var(--gc-line);
}

.upload-section h2 {
  margin: 0 0 1.5rem 0;
  color: var(--gc-ink);
  font-size: 2rem;
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1.05;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 650;
  font-size: 0.9375rem;
  color: var(--gc-ink);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gc-control);
  border-radius: var(--gc-r-sm);
  font-size: 1rem;
  background: var(--gc-surface);
  color: var(--gc-ink);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gc-ink);
  box-shadow: 0 0 0 3px var(--gc-focus);
}

.form-group small {
  display: block;
  margin-top: 0.3rem;
  color: var(--gc-subtle);
  font-size: 0.8125rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* ---------- Buttons ---------- */
.btn-primary {
  flex: 1;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  background: var(--gc-mango) var(--gc-grad-btn);
  color: var(--gc-ink);
  border: none;
  border-radius: var(--gc-r-sm);
  font-size: 1rem;
  font-weight: 750;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover {
  filter: saturate(1.15) brightness(1.02);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  padding: 0.75rem 1.25rem;
  background: var(--gc-surface);
  color: var(--gc-ink);
  text-decoration: none;
  border: none;
  border-radius: var(--gc-r-sm);
  box-shadow: inset 0 0 0 1px var(--gc-control);
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-secondary:hover {
  box-shadow: inset 0 0 0 1.5px var(--gc-ink);
}

.upload-progress {
  margin-top: 2rem;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--gc-chip);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: var(--gc-grad);
  width: 0%;
  transition: width 0.3s;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 1.75rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom));
  background: var(--gc-surface);
  color: var(--gc-muted);
  font-size: 0.875rem;
  margin-top: auto;
  border-top: 1px solid var(--gc-line);
}

footer a {
  color: var(--gc-ink);
  text-decoration-color: var(--gc-mango-deep) !important;
  text-underline-offset: 0.2em;
}

@media (max-width: 768px) {
  .header-content {
    justify-content: center;
    gap: 0.5rem;
  }

  header h1 {
    font-size: 1.25rem;
  }

  header p.tagline {
    font-size: 0.8125rem;
    padding-left: 0.5rem;
    white-space: normal;
  }

  main {
    padding: 1rem 1rem 2.5rem;
  }

  .search-section {
    gap: 0.5rem;
  }

  /* Search icon toggles the box; icon + the two dropdowns share the top row. */
  #searchToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    order: 1;
    width: 44px;
    height: 44px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--gc-fill);
    color: var(--gc-ink);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
  }
  #searchToggle .gc-ic { margin: 0; width: 20px; height: 20px; }
  .search-section.search-open #searchToggle {
    background: var(--gc-mango) var(--gc-grad);
    border-color: transparent;
  }

  #searchInput {
    order: 4;
    flex: 1 1 100%;
    min-width: 0;
    display: none;               /* hidden until the icon is tapped */
  }
  .search-section.search-open #searchInput {
    display: block;
  }

  #filterCategory { order: 2; }
  #sortOrder { order: 3; }

  #filterCategory,
  #sortOrder,
  #filterState,
  #filterCity {
    flex: 1 1 0;
    min-width: 0;
    max-width: 50%;
    padding: 0 2rem 0 0.875rem;
    font-size: 0.875rem;
  }

  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 0.75rem;
  }

  /* View tabs stay on one row and scroll sideways. */
  #adminTabs, #customerTabs {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    margin: 0 -1rem 0.25rem;
    padding: 0 1rem;
  }

  .video-card-content {
    padding: 0.625rem 0.75rem 0.875rem;
  }

  .video-card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .modal-content {
    margin: 0;
    min-height: 100%;
    border-radius: 0;
  }

  .video-info {
    padding: 1.25rem 1rem;
  }
}

/* Phones: two compact columns of portrait cards. */
@media (max-width: 559px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 0.75rem;
  }
}

/* Legacy header auth area (pages outside the shared header) */
#authSection, #userSection {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#userSection {
  font-size: 0.9rem;
}

#userEmail {
  font-weight: 600;
}

#signOutBtn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  margin: 0;
  white-space: nowrap;
}

.empty-state a:hover {
  text-decoration-color: var(--gc-ink);
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--gc-subtle);
}

/* ---------- Favourites ---------- */
.video-thumbnail-wrapper {
  position: relative;
}

.favorite-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  color: var(--gc-ink);
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  z-index: 10;
}

.favorite-icon:hover {
  transform: scale(1.08);
}

.favorite-icon.favorited {
  color: var(--gc-rose);
}

.favorite-section {
  margin: 0.75rem 0 0.25rem;
}

.btn-favorite {
  min-height: 36px;
  padding: 0.35rem 0.9rem;
  background: var(--gc-surface);
  border: 1px solid var(--gc-control);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--gc-ink);
}

.btn-favorite:hover {
  border-color: var(--gc-ink);
}

.btn-favorite.favorited {
  background: var(--gc-rose-tint);
  color: var(--gc-rose);
  border-color: var(--gc-rose);
}

.btn-favorite .heart {
  font-size: 1rem;
  line-height: 1;
}

/* ---------- Tags ---------- */
.tags-section {
  margin: 2rem 0;
  padding: 1.25rem;
  background: var(--gc-sunken);
  border-radius: var(--gc-r);
}

.tags-section h3 {
  margin: 0 0 1rem;
  color: var(--gc-ink);
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  min-height: 40px;
}

.tag {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  background: var(--gc-chip);
  color: var(--gc-ink);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.add-tag {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.add-tag input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gc-control);
  border-radius: var(--gc-r-sm);
  font-size: 0.9375rem;
}

.no-data {
  color: var(--gc-subtle);
  font-style: normal;
}

/* ---------- Reviews ---------- */
.reviews-section {
  margin: 1.5rem 0 0;
  padding: 1.25rem;
  background: var(--gc-sunken);
  border-radius: var(--gc-r);
}

.reviews-section h3, .reviews-section h4 {
  margin: 0 0 0.875rem;
  color: var(--gc-ink);
}

.reviews-list {
  margin-bottom: 1.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.review {
  padding: 1rem;
  background: var(--gc-surface);
  border-radius: var(--gc-r);
  margin-bottom: 0.75rem;
  box-shadow: inset 0 0 0 1px var(--gc-line);
}

.review-rating {
  color: var(--gc-mango-deep);
  font-size: 1.125rem;
  margin-bottom: 0.375rem;
}

.review-comment {
  color: var(--gc-ink);
  margin: 0.5rem 0;
  line-height: 1.5;
}

.review-date {
  color: var(--gc-subtle);
  font-size: 0.8125rem;
  margin: 0;
}

.add-review {
  padding: 1.25rem;
  background: var(--gc-surface);
  border-radius: var(--gc-r);
}

.rating-input {
  display: flex;
  gap: 0.375rem;
  margin: 0.75rem 0;
  font-size: 2rem;
}

.star {
  cursor: pointer;
  color: var(--gc-chip);
  transition: color 0.15s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-stroke: 1px var(--gc-control);
}

.star:hover {
  color: var(--gc-mango);
}

.add-review textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gc-control);
  border-radius: var(--gc-r-sm);
  font-size: 0.9375rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 1rem;
}

.error {
  color: var(--gc-danger);
}

/* ---------- Workshops (sessions) ---------- */
.live-events-section {
  margin: 1.5rem 0 0;
  padding: 1.25rem;
  background: var(--gc-sunken);
  border-radius: var(--gc-r);
}

.live-events-section h3, .live-events-section h4 {
  margin: 0 0 0.875rem;
  color: var(--gc-ink);
}

.events-list {
  margin-bottom: 1.5rem;
}

.event-card {
  padding: 1rem;
  background: var(--gc-surface);
  border-radius: var(--gc-r);
  margin-bottom: 0.75rem;
  box-shadow: inset 0 0 0 1px var(--gc-line);
}

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.event-header strong {
  color: var(--gc-ink);
  font-size: 1rem;
  font-weight: 750;
}

.event-details {
  color: var(--gc-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.event-details div {
  margin-bottom: 0.25rem;
}

.add-event {
  padding: 1.25rem;
  background: var(--gc-surface);
  border-radius: var(--gc-r);
  border: 1.5px dashed var(--gc-control);
}

.add-event h4 {
  margin-top: 0;
  color: var(--gc-ink);
}

.delete-event-btn {
  background: var(--gc-surface);
  color: var(--gc-danger);
  border: 1px solid var(--gc-danger-line);
  padding: 6px 12px;
  border-radius: var(--gc-r-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 650;
}

.delete-event-btn:hover {
  background: var(--gc-danger-tint);
}

/* Registration */
.btn-register {
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  background: var(--gc-mango) var(--gc-grad-btn);
  color: var(--gc-ink);
  border: none;
  border-radius: var(--gc-r-sm);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 750;
  transition: filter 0.15s ease;
  width: 100%;
}

.btn-register:hover {
  filter: saturate(1.15) brightness(1.02);
}

.btn-unregister {
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  background: var(--gc-surface);
  color: var(--gc-ink);
  border: none;
  box-shadow: inset 0 0 0 1px var(--gc-control);
  border-radius: var(--gc-r-sm);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 650;
  width: 100%;
}

.btn-unregister:hover {
  box-shadow: inset 0 0 0 1.5px var(--gc-ink);
}

.registered-badge {
  background: var(--gc-success-tint);
  color: var(--gc-success);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
}

.event-card.registered {
  background: var(--gc-success-tint);
  box-shadow: inset 0 0 0 1px var(--gc-success-line);
}
