:root {
  --bg-color: #ffffff;
  --bg-color-secondary: #f0f0f0;
  --text-color: #121212;
  --accent: #007a33;
  --border-color: #cccccc;
  --error-color: #d32f2f;
}

button {
  font-size: 1rem;
  background: var(--text-color);
  cursor: pointer;
  color: var(--bg-color);
  touch-action: manipulation;
  padding: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: 30px;
}

html {
  height: 100%;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../img/golf-background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  opacity: 0.2;
  will-change: transform;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 90vh;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0;
}

main {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.distance-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.distance-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.9;
}

.distance-value {
  height: 10rem;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.4rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin-top: 1rem;
}

.course-link {
  color: var(--text-color);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
}

.course-select-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 100%;
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  min-width: 100%;
  max-width: 90vw;
  list-style: none;
  margin-top: 0.5rem;
  padding: 0;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.dropdown li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #333;
}

.dropdown li:last-child {
  border-bottom: none;
}

.dropdown li:hover {
  background-color: var(--bg-color-secondary);
}

.hidden {
  display: none;
}

.hole-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 1.2rem;
  font-weight: bold;
}

#holeNumber {
  font-size: 1.4rem;
  font-weight: 700;
}

#holePar {
  font-size: 1rem;
  opacity: 0.8;
}

.distance-card {
  padding: 1.5rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.button-row {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

#prevHole,
#nextHole {
  flex: 0 0 3rem;
}

#calculateBtn {
  flex: 1;
  margin: 0 0.5rem;
}

#button .button:disabled {
  background-color: #444;
  color: #aaa;
  cursor: not-allowed;
}

/* Spinner */
#spinner {
  width: 32px;
  height: 32px;
  border: 5px solid var(--text-color);
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Report modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background-color: #1e1e1e;
  color: var(--text-color);
  padding: 1rem;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.modal-content textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #2a2a2a;
  color: var(--text-color);
  resize: none;
  margin-bottom: 1rem;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.modal-buttons button {
  flex: 1;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
}

#sendReportBtn {
  background-color: var(--accent);
  color: #000;
}

#closeModalBtn {
  background-color: #333;
  color: var(--text-color);
  cursor: pointer;
}

/* footer */
footer {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-color);
  padding: 1rem 0;
}

footer a {
  color: var(--text-color);
  text-decoration: none;
  margin: 0 0.4rem;
}

footer a:hover {
  text-decoration: underline;
}

footer a.report-link {
  color: var(--error-color);
  font-weight: 500;
}
