/* ROOT */
.fw-add-round-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: #111827;
}

.muted {
  color: #6b7280;
  font-size: 0.9rem;
}

/* HEADER */
.fw-add-round-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.fw-add-round-head h1 {
  font-size: 1.7rem;
  margin: 0 0 0.2rem;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.45rem 1.05rem;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.btn-ghost {
  background: #ffffff;
  border-color: rgba(17, 24, 39, 0.1);
  color: #111827;
}

.btn-ghost:hover {
  background: #f9fafb;
}

.btn-primary {
  background: linear-gradient(135deg, #d9b35c, #b8892a);
  color: #111827;
  box-shadow: 0 10px 26px rgba(184, 137, 42, 0.35);
}

.btn-primary:hover {
  filter: brightness(0.98);
  transform: translateY(-0.5px);
}

.btn-danger {
  border-color: rgba(185, 28, 28, 0.18);
  color: #991b1b;
}

.btn-danger:hover {
  background: rgba(185, 28, 28, 0.06);
}

/* NEW: make compact/expand obvious */
.btn-toggleview {
  background: rgba(254, 249, 195, 0.75);
  border-color: rgba(217, 179, 92, 0.85);
  color: #92400e;
  box-shadow: 0 10px 22px rgba(184, 137, 42, 0.14);
}

.btn-toggleview:hover {
  background: rgba(254, 249, 195, 0.95);
  transform: translateY(-0.5px);
}

/* CARD */
.fw-card {
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid rgba(17, 24, 39, 0.06);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}

/* TOOLBAR */
.fw-rounds-toolbar {
  padding: 1.05rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.toolbar-title h2 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
  font-weight: 750;
}

.toolbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Tiles */
.upload-tile {
  width: 100%;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 0.95rem;
  border-radius: 18px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  background: linear-gradient(
      135deg,
      rgba(217, 179, 92, 0.08),
      rgba(184, 137, 42, 0.03)
    ),
    #ffffff;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.upload-tile--small {
  width: 320px;
  padding: 0.75rem 0.85rem;
}

.upload-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(217, 179, 92, 0.55);
  box-shadow: 0 14px 28px rgba(184, 137, 42, 0.12);
}

.tile-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.04);
  color: #111827;
}

.tile-content {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.tile-title {
  font-weight: 750;
  font-size: 0.95rem;
  color: #111827;
}

.tile-sub {
  font-size: 0.84rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-chip {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(217, 179, 92, 0.55);
  background: rgba(254, 249, 195, 0.6);
  color: #92400e;
}

/* WRAPPER */
.fw-rounds-wrap {
  padding: 1.15rem 1.2rem 1.25rem;
}

.rounds-container {
  display: grid;
  gap: 1.05rem;
}

/* NEW: clearer separation between rounds */
.round-card {
  border-radius: 22px;
  border: 1px solid rgba(17, 24, 39, 0.06);
  background: #ffffff;
  overflow: hidden;
  position: relative;
}

.round-card::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(217, 179, 92, 0),
    rgba(217, 179, 92, 0.55),
    rgba(217, 179, 92, 0)
  );
  opacity: 0.85;
}

.round-card:first-child::before {
  display: none;
}

/* ROUND HEAD */
.round-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.15rem;
  padding: 1rem 1.05rem 0.95rem;
  border-bottom: 1px solid rgba(209, 213, 219, 0.65);
  background: linear-gradient(
      135deg,
      rgba(217, 179, 92, 0.08),
      rgba(184, 137, 42, 0.02)
    ),
    #ffffff;
}

.round-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.round-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.round-chip {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(217, 179, 92, 0.55);
  background: rgba(254, 249, 195, 0.6);
  color: #92400e;
}

.round-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.meta-field {
  position: relative;
}

.meta-field label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.meta-field input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.16s ease, box-shadow 0.16s ease,
    background 0.16s ease;
}

.meta-field input:focus {
  border-color: #d9b35c;
  box-shadow: 0 0 0 1px rgba(217, 179, 92, 0.45);
  background: #ffffff;
}

.required-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #b91c1c;
}

/* Course dropdown */
.fw-course-dd {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  border-radius: 16px;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.fw-course-dd__inner {
  max-height: 260px;
  overflow: auto;
}

.fw-course-opt {
  display: grid;
  gap: 0.12rem;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(209, 213, 219, 0.55);
}

.fw-course-opt:last-child {
  border-bottom: none;
}

.fw-course-opt:hover,
.fw-course-opt.is-active {
  background: rgba(254, 249, 195, 0.55);
}

.fw-course-opt__name {
  font-weight: 800;
  font-size: 0.92rem;
  color: #111827;
}

.fw-course-opt__meta {
  font-size: 0.82rem;
  color: #6b7280;
}

.fw-course-dd__empty,
.fw-course-dd__loading,
.fw-course-dd__err {
  padding: 0.8rem;
  font-size: 0.88rem;
  color: #6b7280;
}

.round-head__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.7rem;
  min-width: 300px;
}

/* SUMMARY PILL: always show all 3 */
.round-summary {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 0.38rem 0.62rem;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid rgba(17, 24, 39, 0.06);
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.summary-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #6b7280;
}

.summary-value {
  font-size: 0.93rem;
  font-weight: 800;
}

.round-controls {
  display: inline-flex;
  gap: 0.55rem;
}

/* SCORECARD */
.fw-scorecard {
  padding: 0.95rem 1.05rem 1.05rem;
}

.scorecard-wrapper {
  margin: 0;
  padding: 0.25rem;
  border-radius: 18px;
  background: linear-gradient(
      90deg,
      rgba(217, 179, 92, 0.06),
      rgba(184, 137, 42, 0.03)
    ),
    #f9fafb;
}

.scorecard-table {
  overflow-x: auto;
}

.scorecard-table::-webkit-scrollbar {
  height: 6px;
}

.scorecard-table::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.6);
  border-radius: 999px;
}

.scorecard-row {
  display: grid;
  grid-template-columns: 110px repeat(18, minmax(46px, 1fr));
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid rgba(209, 213, 219, 0.5);
}

.scorecard-row:last-child {
  border-bottom: none;
}

.scorecard-row--header {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
}

.scorecard-row--required {
  background: rgba(249, 250, 251, 0.9);
}

.scorecard-row--optional {
  background: rgba(255, 255, 255, 0.7);
}

.scorecard-row--computed {
  background: rgba(240, 253, 244, 0.7);
}

.scorecard-label {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.84rem;
  font-weight: 650;
  color: #374151;
}

.field-tag {
  align-self: flex-start;
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(156, 163, 175, 0.6);
  color: #6b7280;
  background: rgba(249, 250, 251, 0.9);
}

.field-tag--primary {
  border-color: rgba(217, 179, 92, 0.9);
  color: #92400e;
  background: rgba(254, 249, 195, 0.8);
}

.scorecard-hole-header {
  text-align: center;
  padding: 0.2rem 0;
  border-radius: 999px;
  background: rgba(243, 244, 246, 0.9);
  font-size: 0.78rem;
  font-weight: 600;
  color: #4b5563;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.scorecard-hole-header.is-incomplete {
  opacity: 0.7;
}

.scorecard-hole-header.is-complete {
  background: #ecfdf5;
  color: #166534;
  box-shadow: 0 0 0 1px rgba(22, 101, 52, 0.2);
  opacity: 1;
}

.scorecard-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* NEW: subtle front/back 9 divider (hole 10 column) */
.is-turn {
  position: relative;
}

.is-turn::before {
  content: "";
  position: absolute;
  left: -0.18rem;
  top: 10%;
  bottom: 10%;
  width: 2px;
  border-radius: 2px;
  background: rgba(17, 24, 39, 0.10);
}

.scorecard-hole-header.is-turn::before {
  top: 15%;
  bottom: 15%;
}

.score-input,
.score-select {
  width: 100%;
  max-width: 60px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  padding: 0.25rem 0.2rem;
  font-size: 0.84rem;
  outline: none;
  background: #ffffff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease,
    transform 0.1s ease;
}

.score-input:focus,
.score-select:focus {
  border-color: #d9b35c;
  box-shadow: 0 0 0 1px rgba(217, 179, 92, 0.45);
  transform: translateY(-0.5px);
}

.gir-cell {
  font-size: 0.82rem;
}

.gir-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px dashed rgba(22, 163, 74, 0.3);
  background: rgba(240, 253, 244, 0.6);
  color: #16a34a;
  font-size: 0.7rem;
}

.gir-indicator.is-gir {
  border-style: solid;
  border-color: rgba(22, 163, 74, 0.8);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.4);
  background: #ecfdf5;
}

/* Compact mode hides optional block ONLY (summary stays visible) */
.round-card.is-compact .optional-block {
  display: none;
}

/* FOOTER */
.fw-add-round-footer {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(209, 213, 219, 0.7);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-actions {
  display: inline-flex;
  gap: 0.65rem;
}

/* MODALS */
.fw-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.fw-modal[hidden] {
  display: none !important;
}

.fw-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(4px);
  z-index: 99999;
}

.fw-modal__panel {
  position: relative;
  width: min(760px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  z-index: 100000;
}

.fw-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid rgba(209, 213, 219, 0.7);
  background: linear-gradient(
      135deg,
      rgba(217, 179, 92, 0.08),
      rgba(184, 137, 42, 0.02)
    ),
    #ffffff;
}

.fw-modal__head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.fw-modal__body {
  padding: 1.1rem 1.2rem;
  display: grid;
  gap: 0.9rem;
}

.fw-modal__foot {
  padding: 0.95rem 1.2rem 1.1rem;
  border-top: 1px solid rgba(209, 213, 219, 0.7);
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.icon-btn {
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: #ffffff;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: #f9fafb;
}

.upload-zone {
  border-radius: 18px;
  border: 1px dashed rgba(17, 24, 39, 0.18);
  background: #f9fafb;
  padding: 0.95rem;
}

.upload-zone__inner {
  display: grid;
  gap: 0.45rem;
}

.upload-zone__title {
  margin: 0;
  font-weight: 750;
}

.upload-zone__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.upload-preview {
  margin-top: 0.85rem;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: #ffffff;
}

.upload-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.fw-modal__status {
  font-size: 0.88rem;
  color: #374151;
  min-height: 1.1rem;
}

.fw-status--warn {
  color: #92400e;
}

.fw-status--good {
  color: #166534;
}

.csv-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.csv-template {
  font-size: 0.88rem;
  color: #92400e;
  text-decoration: none;
  border-bottom: 1px solid rgba(217, 179, 92, 0.8);
}

.csv-preview {
  border-radius: 18px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: #ffffff;
  overflow: hidden;
}

.csv-preview__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  background: #f9fafb;
  border-bottom: 1px solid rgba(209, 213, 219, 0.7);
}

.csv-preview__title {
  font-size: 0.84rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.csv-preview__table {
  padding: 0.7rem 0.8rem;
  max-height: 280px;
  overflow: auto;
  font-size: 0.88rem;
}

.csv-preview__table table {
  width: 100%;
  border-collapse: collapse;
}

.csv-preview__table th,
.csv-preview__table td {
  text-align: left;
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid rgba(209, 213, 219, 0.55);
}

.csv-preview__table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

/* RESPONSIVE */
@media (max-width: 980px) {
  .fw-rounds-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .upload-tile--small {
    width: 100%;
  }

  .round-head {
    grid-template-columns: 1fr;
  }

  .round-head__right {
    min-width: unset;
    align-items: flex-start;
  }

  .round-meta-grid {
    grid-template-columns: 1fr;
  }

  .scorecard-row {
    grid-template-columns: 90px repeat(18, minmax(40px, 1fr));
  }

  .score-input,
  .score-select {
    max-width: 52px;
  }
}

@media (max-width: 640px) {
  .fw-add-round-page {
    padding-inline: 1rem;
  }

  .fw-add-round-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .fw-add-round-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* Tee select (loaded from course_tees) — styled like inputs */
.meta-field select.tee-select{
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  appearance: none;
}
.meta-field select.tee-select:focus{
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.14);
  background: #fff;
}


/* Fairway selector: use arrow icons for clarity */
[data-hole-field="fairway"] select,
select[data-hole-field="fairway"]{
  text-align: center;
  font-weight: 650;
  letter-spacing: 0.02em;
}

/* Make fairway arrows readable */
[data-hole-field="fairway"] select{
  font-size: 0.95rem;
  line-height: 1;
  padding-top: 6px;
  padding-bottom: 6px;
}
