/* ============================================================
   Sport Solution Portal — Shared Suite Stylesheet
   All applications in the Sport Solution suite import or
   reference this file for design-token consistency.
   ============================================================ */

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

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  /* Brand colours */
  --ss-red:       #c0392b;
  --ss-red-hover: #a93226;
  --ss-dark:      #1b1b2f;
  --ss-dark-l:    #2d2d4f;
  --ss-gold:      #f4b524;
  --ss-gold-dim:  #c89410;
  --ss-green:     #2d6a4f;
  --ss-green-l:   #40916c;

  /* Surfaces */
  --surface:      #ffffff;
  --surface-2:    #f5f7fa;
  --surface-3:    #edf0f4;

  /* Borders & shadows */
  --border:       #dee2e6;
  --shadow-sm:    0 1px 4px rgba(0,0,0,.10);
  --shadow-md:    0 4px 16px rgba(0,0,0,.14);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.22);

  /* Text */
  --text:         #212529;
  --text-muted:   #6c757d;
  --text-light:   #adb5bd;

  /* State colours */
  --win:          #198754;
  --draw:         #fd7e14;
  --loss:         #dc3545;

  /* Dimensions */
  --radius:       6px;
  --radius-lg:    10px;
  --header-h:     62px;
  --footer-h:     56px;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--ss-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Suite Header ────────────────────────────────────────────────────────── */
.ss-header {
  background: var(--ss-dark);
  color: #fff;
  height: var(--header-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  flex-shrink: 0;
}

.ss-logo {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  flex-shrink: 0;
}
.ss-logo img { height: 38px; width: auto; }
.ss-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ss-gold);
  letter-spacing: .3px;
  white-space: nowrap;
  line-height: 1.2;
}
.ss-logo-sub {
  font-size: .7rem;
  color: var(--text-light);
  font-weight: 400;
  display: block;
}

.ss-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ── Suite Footer ────────────────────────────────────────────────────────── */
.ss-footer {
  background: var(--ss-dark);
  color: var(--text-light);
  font-size: .8rem;
  padding: .85rem 1.5rem;
  margin-top: auto;
  flex-shrink: 0;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-light);
}
.footer-brand img { height: 24px; width: auto; }

.footer-links {
  display: flex;
  gap: .75rem;
  margin-left: auto;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: .8rem;
  padding: 0;
  transition: color .15s;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: #fff; }

.page-counter {
  font-size: .72rem;
  color: var(--text-light);
  opacity: .65;
  white-space: nowrap;
  margin-left: auto;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .45rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, opacity .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary   { background: var(--ss-dark);    color: #fff; }
.btn-primary:hover:not(:disabled)   { background: var(--ss-dark-l); }

.btn-red       { background: var(--ss-red);     color: #fff; }
.btn-red:hover:not(:disabled)       { background: var(--ss-red-hover); }

.btn-green     { background: var(--ss-green);   color: #fff; }
.btn-green:hover:not(:disabled)     { background: var(--ss-green-l); }

.btn-grey      { background: #6c757d;           color: #fff; }
.btn-grey:hover:not(:disabled)      { background: #5a6268; }

.btn-gold      { background: var(--ss-gold);    color: var(--ss-dark); }
.btn-gold:hover:not(:disabled)      { background: var(--ss-gold-dim); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled)   { background: var(--surface-2); }

.btn-outline-light {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.85);
}
.btn-outline-light:hover:not(:disabled) {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.btn-sm  { padding: .25rem .65rem; font-size: .78rem; }
.btn-lg  { padding: .65rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  overflow: hidden;
}

.card-header {
  background: var(--ss-dark);
  color: #fff;
  padding: .65rem 1rem;
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.card-header-red { background: var(--ss-red); }

.card-body { padding: 1rem; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-bottom: .75rem;
}

.form-group label {
  font-size: .75rem;
  font-weight: 600;
  color: #495057;
}

input[type=text],
input[type=email],
input[type=password],
input[type=date],
select,
textarea {
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}

input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=date]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ss-dark);
  box-shadow: 0 0 0 3px rgba(27,27,47,.12);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-green  { background: #d1e7dd; color: #0a3622; }
.badge-grey   { background: #e9ecef; color: #495057; }
.badge-red    { background: #f8d7da; color: #58151c; }
.badge-orange { background: #fff3cd; color: #856404; }
.badge-blue   { background: #cfe2ff; color: #084298; }
.badge-gold   { background: #fff3cd; color: #7a5800; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: .65rem 1rem;
  border-radius: var(--radius);
  margin-bottom: .75rem;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.alert-success { background: #d1e7dd; border: 1px solid #a3cfbb; color: #0a3622; }
.alert-danger  { background: #f8d7da; border: 1px solid #f1aeb5; color: #58151c; }
.alert-info    { background: #cff4fc; border: 1px solid #9eeaf9; color: #055160; }
.alert-warning { background: #fff3cd; border: 1px solid #ffecb5; color: #664d03; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  padding: .5rem .65rem;
  text-align: left;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table th.num,
.data-table td.num { text-align: right; }
.data-table td {
  padding: .5rem .65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover   { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease;
}

.modal-lg { width: 780px; }

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

.modal-header {
  padding: 1rem 1.25rem .85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-header h3 { font-size: 1rem; color: var(--ss-dark); }
.modal-body {
  padding: 1.25rem;
  font-size: .875rem;
  line-height: 1.7;
  color: var(--text);
}
.modal-body h4 {
  font-size: .9rem;
  margin-top: 1rem;
  margin-bottom: .25rem;
  color: var(--ss-dark);
}
.modal-body p { margin-bottom: .5rem; }
.modal-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  position: sticky;
  bottom: 0;
  background: var(--surface);
}

/* ── Login Card ──────────────────────────────────────────────────────────── */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 400px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-card .login-logo {
  width: 100px;
  height: auto;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
}

.login-card h2 {
  font-size: 1.2rem;
  color: var(--ss-dark);
  margin-bottom: .25rem;
}

.login-card .login-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid var(--border);
  border-top-color: var(--ss-red);
  border-radius: 50%;
  animation: ss-spin .65s linear infinite;
  flex-shrink: 0;
}

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

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.pos { color: var(--win);  font-weight: 600; }
.neg { color: var(--loss); }

.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.ms-auto { margin-left: auto; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }

/* ── Section title (shared accent style) ────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ss-dark);
  margin-bottom: .75rem;
  padding-bottom: .35rem;
  border-bottom: 3px solid var(--ss-red);
  display: inline-block;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.breadcrumb a   { color: var(--ss-green); cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 .3rem; }

/* ── Empty / Loading states ──────────────────────────────────────────────── */
.loading-msg, .empty-msg {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Filter bar (shared by analytics apps) ──────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 140px;
  flex: 1;
}

.filter-group label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.filter-group select:disabled { opacity: .5; cursor: not-allowed; }

/* ── Stat blocks (shared by analytics apps) ─────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px,1fr));
  gap: .5rem;
}
.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .75rem;
  text-align: center;
}
.stat-box .val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ss-green);
  line-height: 1;
}
.stat-box .lbl {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: .2rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --header-h: auto; }
  .ss-header {
    height: auto;
    min-height: 56px;
    padding: .5rem 1rem;
    flex-wrap: wrap;
    gap: .5rem;
  }
  .ss-logo-text { font-size: .9rem; }
  .filter-bar { gap: .5rem; }
  .filter-group { min-width: 120px; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; max-height: 85vh; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .footer-inner { gap: .75rem; }
  .footer-links { margin-left: 0; }
  .page-counter { margin-left: 0; width: 100%; }
}

@media (max-width: 480px) {
  .ss-header { padding: .5rem .75rem; }
  .login-card { padding: 1.75rem 1.25rem; }
  .login-card .login-logo { width: 80px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .footer-links { gap: 1rem; }
}
