/* ============================================================
   GOLF MEMBERSHIP SYSTEM — GLOBAL STYLES
   Aesthetic: Dark luxury · forest green · brushed gold
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-deep:   #0d1f0f;
  --green-dark:   #122a14;
  --green-mid:    #1e4620;
  --green-accent: #2e6b31;
  --gold:         #c9a84c;
  --gold-light:   #e8c97a;
  --gold-pale:    #f5e9c8;
  --cream:        #faf7f0;
  --white:        #ffffff;
  --text-primary: #1a1a1a;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;
  --border:       rgba(201,168,76,0.2);
  --border-light: rgba(0,0,0,0.08);
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.14);
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    16px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --transition:   0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--cream);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Typography ────────────────────────────────────────────── */
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; font-family: var(--font-body); font-weight: 500; }
p  { color: var(--text-muted); font-size: 0.95rem; }
a  { color: var(--green-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout Shells ─────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  background: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.03em;
}

.topbar-brand svg { width: 28px; height: 28px; fill: var(--gold); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold-pale);
  font-size: 0.85rem;
}

.topbar-user a {
  color: var(--gold-light);
  font-size: 0.8rem;
  padding: 4px 12px;
  border: 1px solid rgba(201,168,76,0.35);
  border-radius: 20px;
  transition: var(--transition);
}
.topbar-user a:hover { background: rgba(201,168,76,0.1); text-decoration: none; }

.sidebar {
  background: var(--green-dark);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.7rem 1.5rem;
  color: rgba(245,233,200,0.65);
  font-size: 0.88rem;
  font-weight: 400;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--gold-light);
  background: rgba(201,168,76,0.08);
  border-left-color: var(--gold);
  text-decoration: none;
}

.sidebar-nav a svg { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
.sidebar-nav a.active svg,
.sidebar-nav a:hover svg { opacity: 1; }

.sidebar-section {
  padding: 1rem 1.5rem 0.4rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(201,168,76,0.4);
  margin-top: 0.5rem;
}

.main-content {
  padding: 2rem 2.5rem;
  overflow-y: auto;
}

/* ── Auth Pages ────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--green-deep);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(46,107,49,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.08) 0%, transparent 50%);
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo svg { width: 48px; height: 48px; fill: var(--green-mid); }
.auth-logo h1 { font-size: 1.6rem; color: var(--green-deep); margin-top: 0.5rem; }
.auth-logo p  { font-size: 0.8rem; color: var(--text-light); margin-top: 2px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.card-header h3 { margin: 0; font-family: var(--font-display); }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold);
}

.stat-card.green::before { background: var(--green-accent); }
.stat-card.red::before   { background: var(--danger); }
.stat-card.blue::before  { background: #2563eb; }

.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); margin-bottom: 6px; }
.stat-value { font-size: 2rem; font-family: var(--font-display); font-weight: 600; color: var(--text-primary); line-height: 1; }
.stat-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green-accent);
  box-shadow: 0 0 0 3px rgba(46,107,49,0.08);
}

input[type="file"] {
  width: 100%;
  padding: 0.5rem;
  border: 1.5px dashed #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  background: #f9fafb;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--green-mid);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-accent); color: var(--white); text-decoration: none; }

.btn-gold {
  background: var(--gold);
  color: var(--green-deep);
}
.btn-gold:hover { background: var(--gold-light); text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--green-mid);
  border: 1.5px solid var(--green-mid);
}
.btn-outline:hover { background: var(--green-mid); color: var(--white); text-decoration: none; }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #b91c1c; text-decoration: none; }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn svg { width: 16px; height: 16px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: #f9fafb;
  font-weight: 500;
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

tbody td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

tbody tr:hover { background: #fafbfc; }

.member-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--green-mid);
  flex-shrink: 0;
}

.avatar-initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-mid);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  flex-shrink: 0;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.badge-active  { background: var(--success-bg); color: var(--success); }
.badge-inactive{ background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-gold    { background: var(--gold-pale);  color: #92650a; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }

/* ── Days progress bar ──────────────────────────────────────── */
.days-bar {
  background: #e5e7eb;
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin-top: 4px;
}

.days-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: var(--green-accent);
  transition: width 0.5s ease;
}

.days-bar-fill.warning { background: var(--warning); }
.days-bar-fill.danger  { background: var(--danger); }

/* ── NFC Panel ──────────────────────────────────────────────── */
.nfc-panel {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-deep) 100%);
  color: var(--gold-pale);
}

.nfc-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: rgba(201,168,76,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nfc-icon svg { width: 32px; height: 32px; fill: var(--gold); }

.nfc-panel h3 { color: var(--gold-light); font-size: 1.1rem; margin-bottom: 0.5rem; }
.nfc-panel p  { color: rgba(245,233,200,0.6); font-size: 0.85rem; }

.nfc-scanning {
  display: inline-block;
  width: 12px; height: 12px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.3); }
}

/* ── Member profile card ────────────────────────────────────── */
.profile-card {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.profile-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(201,168,76,0.08);
}

.profile-pic-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
}

.profile-name { font-family: var(--font-display); font-size: 1.6rem; margin-top: 0.75rem; }
.profile-meta { font-size: 0.8rem; color: rgba(255,255,255,0.6); margin-top: 2px; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 1rem;
}

.page-btn {
  padding: 5px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.page-btn:hover, .page-btn.active { background: var(--green-mid); color: var(--white); border-color: var(--green-mid); text-decoration: none; }

/* ── Search bar ─────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 1.25rem;
}

.search-input {
  flex: 1;
  padding: 0.55rem 0.9rem;
  border: 1.5px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
}

.search-input:focus { border-color: var(--green-accent); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Misc helpers ───────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 0.82rem; }
.text-center { text-align: center; }
.text-gold   { color: var(--gold); }
.text-green  { color: var(--green-accent); }
.hidden { display: none !important; }