/* =============================================
   Portmarnock Court Booker — Mobile-first UI
   ============================================= */

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

:root {
  --green: #2d7a3a;
  --green-dark: #1e5628;
  --green-light: #e8f5ea;
  --text: #1a1a1a;
  --muted: #555;
  --border: #ccc;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.1);
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: #f2f4f3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  min-height: 100%;
}

/* ---- Card ---- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

/* ---- Header ---- */
.card-header {
  background: var(--green);
  color: #fff;
  padding: 20px 24px 16px;
}

.card-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card-header p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 4px;
}

/* ---- Form ---- */
.card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="date"],
select,
input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.15s;
}

input[type="date"]:focus,
select:focus,
input[type="text"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45,122,58,0.15);
}

/* Custom select arrow */
.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: 1rem;
}

/* Opponent search */
.opponent-search {
  position: relative;
}

.opponent-search input[type="text"] {
  padding-left: 36px;
}

.opponent-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
}

#opponentSelect {
  margin-top: 8px;
  min-height: 48px;
}

/* ---- Submit button ---- */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 4px;
}

.btn-submit:hover {
  background: var(--green-dark);
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit:disabled {
  background: #9db8a0;
  cursor: not-allowed;
  transform: none;
}

/* ---- Status panel ---- */
#status {
  display: none;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

#status.loading {
  display: block;
  background: #fff8e1;
  border: 1.5px solid #ffe082;
  color: #5d4037;
}

#status.success {
  display: block;
  background: var(--green-light);
  border: 1.5px solid #a5d6a7;
  color: var(--green-dark);
}

#status.error {
  display: block;
  background: #fdecea;
  border: 1.5px solid #ef9a9a;
  color: #b71c1c;
}

#status a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

/* ---- Spinner ---- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Footer ---- */
.card-footer {
  padding: 14px 24px;
  border-top: 1px solid #eee;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* ---- Responsive tweaks ---- */
@media (min-width: 480px) {
  body {
    padding: 32px 16px;
  }

  .card-header h1 {
    font-size: 1.35rem;
  }
}
