/* ============================================
   Men's Day Schwanhof - Golf Theme
   Colors: Dark Green #1a3a1a | Gold #c9a84c | White
   ============================================ */

:root {
  --green: #1a3a1a;
  --green-light: #2d5a2d;
  --green-dark: #0f240f;
  --gold: #c9a84c;
  --gold-light: #ddc070;
  --gold-dark: #a88a30;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f0f1f2;
  --gray-200: #e2e4e6;
  --gray-300: #c8cbce;
  --gray-500: #8a8f94;
  --gray-700: #4a4f54;
  --gray-900: #1a1d20;
  --danger: #c0392b;
  --success: #27ae60;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.15);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f0a;
    --bg-card: #152015;
    --bg-input: #1a2a1a;
    --text: #e8e8e8;
    --text-muted: #9aaa9a;
    --border: #2d4a2d;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f0f4f0;
    --bg-card: #ffffff;
    --bg-input: #f8faf8;
    --text: #1a1d20;
    --text-muted: #6a7a6a;
    --border: #d0ddd0;
  }
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  background: var(--green);
  color: var(--white);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header .subtitle {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 500;
}

.header-back {
  color: var(--gold);
  text-decoration: none;
  font-size: 1.4rem;
  padding: 8px;
  margin: -8px;
  display: flex;
  align-items: center;
}

.header-user {
  font-size: 0.8rem;
  color: var(--gold);
}

/* Container */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

@media (prefers-color-scheme: dark) {
  .card-title { color: var(--gold); }
}

.card-badge {
  background: var(--gold);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  min-width: 48px;
  transition: all 0.2s;
  text-decoration: none;
  font-family: var(--font);
}

.btn-primary {
  background: var(--gold);
  color: var(--green-dark);
}

.btn-primary:hover, .btn-primary:active {
  background: var(--gold-dark);
}

.btn-secondary {
  background: var(--green);
  color: var(--white);
}

.btn-secondary:hover, .btn-secondary:active {
  background: var(--green-light);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 2px solid var(--gold);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  min-height: 40px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text);
  min-height: 48px;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--gold);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%23888' d='M6 8L1 3h10z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

.rank-1 td { background: rgba(201,168,76,0.15); }
.rank-2 td { background: rgba(201,168,76,0.08); }
.rank-3 td { background: rgba(201,168,76,0.04); }

/* Navigation */
.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--green);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.3);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: rgba(255,255,255,0.6);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 12px;
  min-width: 60px;
  transition: color 0.2s;
}

.nav-item.active, .nav-item:hover {
  color: var(--gold);
}

.nav-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
}

/* Content padding for bottom nav */
.has-nav {
  padding-bottom: 80px;
}

/* Hero / Login */
.hero {
  text-align: center;
  padding: 40px 20px;
}

.hero-logo {
  font-size: 3rem;
  margin-bottom: 8px;
}

.hero h2 {
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 4px;
}

.hero p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Countdown */
.countdown {
  text-align: center;
  padding: 20px;
}

.countdown-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

.countdown-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.countdown-grid {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.countdown-item {
  text-align: center;
}

/* Weather */
.weather {
  display: flex;
  align-items: center;
  gap: 16px;
}

.weather-temp {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.weather-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.weather-icon {
  font-size: 2.5rem;
}

/* Quick links */
.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.quick-link:hover, .quick-link:active {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.quick-link-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.quick-link-label {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 60px);
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  word-break: break-word;
}

.chat-bubble-other {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-bubble-self {
  align-self: flex-end;
  background: var(--green);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chat-sender {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}

.chat-time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-media-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--border);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.chat-media-btn:hover, .chat-media-btn:active {
  border-color: var(--gold);
}

.chat-media-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-media-remove {
  background: rgba(192,57,43,0.2);
  border: none;
  color: #e74c3c;
  font-size: 1.3rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-bubble img, .chat-bubble video {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 6px;
  max-height: 300px;
  cursor: pointer;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text);
  min-height: 48px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--gold);
}

.chat-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--green-dark);
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tournament card */
.tournament-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.9rem;
}

.tournament-label {
  color: var(--text-muted);
  font-weight: 600;
}

/* Status badges */
.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-upcoming {
  background: var(--gray-200);
  color: var(--gray-700);
}

.status-active {
  background: #27ae60;
  color: white;
}

.status-finished {
  background: var(--gray-500);
  color: white;
}

@media (prefers-color-scheme: dark) {
  .status-upcoming {
    background: var(--gray-700);
    color: var(--gray-300);
  }
}

/* Score input */
.score-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-input-group input {
  width: 100px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.score-result {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Section titles */
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  margin: 24px 0 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 0.9rem;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-center {
  display: flex;
  justify-content: center;
  padding: 40px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: var(--font);
}

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Invite section */
.invite-box {
  background: var(--green);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
}

.invite-link {
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--gold);
  word-break: break-all;
  margin: 12px 0;
}

/* Confirm button in scoreboard */
.confirm-btn {
  background: var(--success);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}

.confirmed-badge {
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 700;
}

/* Utility */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }

/* Responsive tweaks for larger screens */
@media (min-width: 768px) {
  .container {
    padding: 24px;
  }

  .quick-links {
    grid-template-columns: repeat(4, 1fr);
  }
}
