:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(18, 26, 44, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --primary-gold: #f59e0b;
  --primary-gold-glow: rgba(245, 158, 11, 0.35);
  --accent-emerald: #10b981;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Glassmorphism card utility */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.5rem;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.5px;
}

.glow-gold {
  color: var(--primary-gold);
  filter: drop-shadow(0 0 8px var(--primary-gold-glow));
}

.accent-text {
  color: var(--primary-gold);
}

/* Main Container */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.12);
  color: var(--primary-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.35rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.badge-tag.gold {
  background: rgba(245, 158, 11, 0.15);
}

.main-title {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #ffffff 40%, var(--primary-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Form Styles */
.form-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

#playerForm {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.req {
  color: var(--accent-red);
}

.form-input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  color: white;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.25s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-gold);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  background: rgba(15, 23, 42, 0.9);
}

/* Role Selector Grid */
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.role-card input[type="radio"] {
  display: none;
}

.role-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.role-box i {
  font-size: 1.6rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  transition: all 0.25s ease;
}

.role-title {
  font-weight: 700;
  font-size: 1rem;
  color: white;
}

.role-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.role-card input[type="radio"]:checked + .role-box {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--primary-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.role-card input[type="radio"]:checked + .role-box i {
  color: var(--primary-gold);
  transform: scale(1.15);
}

/* Jersey Size Selector */
.size-selector {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.size-btn {
  flex: 1;
  min-width: 60px;
}

.size-btn input[type="radio"] {
  display: none;
}

.size-btn span {
  display: block;
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 0.5rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
  cursor: pointer;
  transition: all 0.25s ease;
}

.size-btn input[type="radio"]:checked + span {
  background: var(--primary-gold);
  color: #0b0f19;
  border-color: var(--primary-gold);
  box-shadow: 0 0 12px var(--primary-gold-glow);
}

/* Photo Upload Dropzone */
.upload-dropzone {
  position: relative;
  background: rgba(15, 23, 42, 0.4);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary-gold);
  background: rgba(245, 158, 11, 0.05);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.icon-circle {
  width: 52px;
  height: 52px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--primary-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 0.75rem;
}

.upload-text {
  font-size: 0.95rem;
  color: #e5e7eb;
}

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

.upload-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.upload-preview img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--primary-gold);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

.btn-remove-photo {
  position: relative;
  z-index: 10;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-remove-photo:hover {
  background: var(--accent-red);
  color: white;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0b0f19;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.75rem;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-heading);
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all 0.25s ease;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-success {
  background: #10b981;
  color: #0b0f19;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-success:hover {
  background: #34d399;
}

.btn-danger-soft {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-danger-soft:hover {
  background: var(--accent-red);
  color: white;
}

/* Success Card & Pass */
.success-card {
  padding: 2.5rem 2rem;
  text-align: center;
}

.check-circle {
  width: 64px;
  height: 64px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1rem;
  border: 2px solid var(--accent-emerald);
}

.success-header h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.success-header p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Player Pass Printable Preview */
.player-pass {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 2px solid var(--primary-gold);
  border-radius: 18px;
  padding: 1.5rem;
  max-width: 480px;
  margin: 0 auto 2rem;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.25);
  text-align: left;
}

.pass-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.pass-league {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary-gold);
  letter-spacing: 1px;
}

.pass-status {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.pass-body {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.pass-avatar img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--primary-gold);
}

.pass-info h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.pass-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.pass-pill {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #d1d5db;
}

.pass-reg-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.success-actions {
  display: flex;
  justify-content: center;
}

/* Admin Portal Styles */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header h2 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
}

.admin-header p {
  color: var(--text-muted);
}

.admin-top-actions {
  display: flex;
  gap: 0.75rem;
}

/* Admin Dashboard Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: rgba(18, 26, 44, 0.75);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-icon.gold { background: rgba(245, 158, 11, 0.15); color: var(--primary-gold); }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

.stat-value {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
}

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

/* Controls & Filter Bar */
.controls-bar {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  color: white;
  font-size: 0.95rem;
}

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

.filter-group {
  display: flex;
  gap: 0.75rem;
}

.filter-select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-select option {
  background: #0b0f19;
  color: white;
}

/* Data Table */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.table-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-gold);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.table-thumb:hover {
  transform: scale(1.15);
}

.badge-role {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-role.batsman { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.badge-role.bowler { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.badge-role.all-rounder { background: rgba(245, 158, 11, 0.15); color: #fde047; }
.badge-role.wicket-keeper { background: rgba(168, 85, 247, 0.15); color: #e9d5ff; }

.badge-size {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
}

.modal-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-icon {
  width: 56px;
  height: 56px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--primary-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 0.75rem;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
}

.modal-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

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

.error-msg {
  color: #fca5a5;
  font-size: 0.82rem;
  margin-top: 0.4rem;
  display: block;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-actions button {
  flex: 1;
}

/* Photo Full Modal */
.photo-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.photo-modal-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
  border: 3px solid var(--primary-gold);
}

.photo-modal-caption {
  margin-top: 1rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.btn-close-photo {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 640px) {
  .role-grid {
    grid-template-columns: 1fr;
  }
  .main-title {
    font-size: 2.2rem;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
