/* ============================================================
   Football Payment System — app.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

:root {
  --sidebar-w:    260px;
  --topbar-h:     58px;
  --primary:      #4361ee;
  --primary-dark: #3451d1;
  --success:      #2dc9a8;
  --danger:       #e63946;
  --warning:      #f4a261;
  --sidebar-bg:   #1a2035;
  --body-bg:      #f0f2f8;
  --card-bg:      #ffffff;
  --shadow:       0 2px 12px rgba(0,0,0,.07);
  --text:         #1e293b;
  --muted:        #64748b;
  --border:       #e2e8f0;
  --radius:       12px;
  --ease:         0.2s ease;
}

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

body {
  font-family: 'Sarabun', Tahoma, Arial, sans-serif;
  font-size: 15px;
  background: var(--body-bg);
  color: var(--text);
  margin: 0;
  line-height: 1.6;
}

/* ── AUTH LAYOUT ──────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, #1a2035 0%, #2d3a6e 55%, #4361ee 100%);
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before,
.auth-wrapper::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.auth-wrapper::before { width: 560px; height: 560px; top: -180px; right: -80px; }
.auth-wrapper::after  { width: 380px; height: 380px; bottom:-130px; left:-80px; }

.auth-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #4361ee, #6c8efb);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(67,97,238,.35);
}
.auth-title    { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0 0 .25rem; }
.auth-subtitle { font-size: .875rem; color: var(--muted); }

/* ── APP LAYOUT ───────────────────────────────────────────── */
.layout-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--ease);
  overflow: hidden;
}

.sidebar-header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}
.sidebar-brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #4361ee, #6c8efb);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.sidebar-menu {
  flex: 1;
  padding: .75rem 0;
  overflow-y: auto;
}
.sidebar-section {
  padding: .75rem 1.5rem .25rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.28);
  margin-top: .25rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .7rem 1rem;
  margin: .1rem .75rem;
  border-radius: 10px;
  color: rgba(255,255,255,.62);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--ease);
  position: relative;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active {
  background: rgba(67,97,238,.28);
  color: #aec3ff;
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 22px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}
.sidebar-link i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4361ee, #6c8efb);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: .83rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: .72rem; color: rgba(255,255,255,.4); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-logout {
  color: rgba(255,255,255,.4);
  text-decoration: none;
  font-size: 1rem;
  transition: color var(--ease);
  flex-shrink: 0;
}
.sidebar-logout:hover { color: var(--danger); }

/* Main wrapper */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--ease);
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.topbar-toggle {
  background: none; border: none;
  color: var(--muted); font-size: 1.1rem;
  cursor: pointer; padding: .45rem;
  border-radius: 8px;
  transition: all var(--ease);
  display: none;
}
.topbar-toggle:hover { background: var(--body-bg); color: var(--text); }
.topbar-user { font-size: .875rem; color: var(--muted); font-weight: 500; }
.topbar-user i { margin-right: .35rem; }

/* Content */
.content-area { padding: 1.5rem; flex: 1; }

/* Collapsed */
.layout-wrapper.sidebar-collapsed .sidebar       { transform: translateX(calc(-1 * var(--sidebar-w))); }
.layout-wrapper.sidebar-collapsed .main-wrapper  { margin-left: 0; }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-title    { font-size: 1.35rem; font-weight: 700; color: var(--text); margin: 0; }
.page-subtitle { font-size: .83rem; color: var(--muted); margin-top: .2rem; }

/* ── STAT CARDS ───────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .08;
}
.stat-card-paid::after      { background: var(--success); }
.stat-card-unpaid::after    { background: var(--danger); }
.stat-card-total::after     { background: var(--primary); }
.stat-card-athletes::after  { background: var(--warning); }

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-icon-paid      { background: rgba(45,201,168,.12); color: var(--success); }
.stat-icon-unpaid    { background: rgba(230,57,70,.1);   color: var(--danger);  }
.stat-icon-total     { background: rgba(67,97,238,.1);   color: var(--primary); }
.stat-icon-athletes  { background: rgba(244,162,97,.12); color: var(--warning); }

.stat-label {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: .2rem;
}
.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-body  { flex: 1; min-width: 0; }

/* ── CARD PANEL ───────────────────────────────────────────── */
.card-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-panel-header {
  padding: .9rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 1rem;
}
.card-panel-title {
  font-size: .9rem; font-weight: 600; color: var(--text);
  margin: 0; display: flex; align-items: center; gap: .5rem;
}
.card-panel-title i { color: var(--primary); }
.card-panel-body { padding: 1.4rem; }

/* ── TABLE ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr  { background: #f8faff; }
.data-table th {
  padding: .7rem 1rem;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid #f0f2f8;
  vertical-align: middle; font-size: .875rem;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbff; }
.cell-name  { font-weight: 600; }
.cell-muted { color: var(--muted); }

/* ── BADGES ───────────────────────────────────────────────── */
.badge-status {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .75rem;
  border-radius: 50px; font-size: .78rem; font-weight: 600;
}
.badge-paid    { background: rgba(45,201,168,.1);  color: #1a9e83; }
.badge-unpaid  { background: rgba(230,57,70,.08);  color: #c82333; }
.badge-admin   { background: rgba(67,97,238,.1);   color: var(--primary); }
.badge-coach   { background: rgba(244,162,97,.12); color: #b86b20; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn { border-radius: 8px; font-family: inherit; font-weight: 500; }
.btn-primary           { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover     { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: .78rem;
}

/* ── FORMS ────────────────────────────────────────────────── */
.form-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 620px;
}
.form-label { font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .35rem; }
.form-control,
.form-select {
  border-radius: 8px; border-color: var(--border);
  font-family: inherit; font-size: .9rem;
  padding: .5rem .9rem;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
  outline: none;
}
.form-control.is-invalid,
.form-select.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: .78rem; color: var(--danger); display: block; margin-top: .25rem; }

/* ── FLASH ALERTS ─────────────────────────────────────────── */
.alert-flash {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-weight: 600; font-size: .875rem;
  transition: opacity .3s, transform .3s;
}
.alert-flash-success { background: rgba(45,201,168,.1);  color: #1a9e83; border: 1px solid rgba(45,201,168,.22); }
.alert-flash-danger  { background: rgba(230,57,70,.07);  color: #c82333; border: 1px solid rgba(230,57,70,.18); }
.alert-close {
  margin-left: auto; background: none; border: none;
  font-size: 1.1rem; color: inherit; opacity: .55;
  cursor: pointer; padding: 0; line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-content { border-radius: var(--radius); border: none; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal-header  { border-bottom: 1px solid var(--border); padding: 1.2rem 1.5rem; }
.modal-footer  { border-top: 1px solid var(--border);    padding: 1rem  1.5rem; }

/* ── FILTER ───────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap;
}
.filter-group label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--muted); margin-bottom: .3rem;
}

/* ── SEARCH ───────────────────────────────────────────────── */
.search-wrap { display: flex; gap: .5rem; }
.search-input {
  border-radius: 8px; border: 1px solid var(--border);
  padding: .45rem .875rem; font-size: .875rem;
  font-family: inherit; width: 220px;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.search-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

/* ── CHART ────────────────────────────────────────────────── */
.chart-container { position: relative; height: 240px; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; opacity: .35; display: block; }

/* ── MATRIX TABLE (monthly report) ───────────────────────── */
.matrix-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table tfoot td {
  padding: .6rem 1rem;
  border-top: 2px solid var(--border);
  font-size: .82rem;
}
.data-table tfoot tr:hover { background: transparent; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: 4px 0 20px rgba(0,0,0,.25);
  }
  .layout-wrapper.sidebar-open .sidebar { transform: translateX(0); }
  .main-wrapper  { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .content-area  { padding: 1rem; }
  .stat-value    { font-size: 1.5rem; }
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
}
.layout-wrapper.sidebar-open .sidebar-overlay { display: block; }

/* ── ATHLETE GALLERY CARDS ────────────────────────────────── */
.athlete-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
  display: flex;
  flex-direction: column;
}
.athlete-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 36px rgba(0,0,0,.13);
}
.athlete-card-header {
  padding: 1.4rem 1rem 1.1rem;
  text-align: center;
  position: relative;
  min-height: 155px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.athlete-jersey-no {
  position: absolute;
  top: .75rem;
  right: .875rem;
  font-size: 1.6rem;
  font-weight: 900;
  color: rgba(255,255,255,.7);
  line-height: 1;
  font-style: italic;
  letter-spacing: -1px;
}
.athlete-photo-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin: 0 auto .6rem;
  border: 3px solid rgba(255,255,255,.35);
  overflow: hidden;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.athlete-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.athlete-avatar-letter {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.athlete-jersey-name {
  font-size: .9rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,.25);
  margin-top: .2rem;
}
.athlete-card-body {
  padding: 1rem 1rem .875rem;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.athlete-card-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.athlete-card-sport {
  display: inline-block;
  background: rgba(67,97,238,.08);
  color: var(--primary);
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .75rem;
}
.athlete-card-meta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  font-size: .78rem;
  color: var(--muted);
  margin: .5rem 0;
}
.athlete-card-school {
  font-size: .73rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: .25rem;
  flex: 1;
}
.athlete-card-actions {
  display: flex;
  gap: .4rem;
  justify-content: center;
  padding-top: .75rem;
  border-top: 1px solid #f0f2f8;
  margin-top: .625rem;
}
