/* =========================================================
   TRYTRACK COMPONENTS.CSS
   Reusable UI components: buttons, cards, stat cards,
   forms, tables, badges, lists, loaders, toasts and messages.
========================================================= */

/* =========================================================
   BUTTONS
========================================================= */

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost,
.sidebar-logout-btn,
.btn-small {
  position: relative;
  overflow: hidden;

  border: none;
  border-radius: 14px;

  padding: 13px 18px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  color: #ffffff;
  text-decoration: none;

  font-size: 13px;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.btn-primary::before,
.btn-secondary::before,
.btn-danger::before,
.btn-ghost::before,
.sidebar-logout-btn::before,
.btn-small::before {
  content: "";
  position: absolute;
  top: 0;
  left: -110%;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.13), transparent);
  transition: 0.5s ease;
}

.btn-primary:hover::before,
.btn-secondary:hover::before,
.btn-danger:hover::before,
.btn-ghost:hover::before,
.sidebar-logout-btn:hover::before,
.btn-small:hover::before {
  left: 110%;
}

.btn-primary,
.btn-small,
.sidebar-logout-btn {
  background: var(--gradient-primary);
  box-shadow: 0 10px 24px rgba(37,99,235,0.20);
}

.btn-secondary,
.btn-ghost {
  background: rgba(56,189,248,0.10);
  border: 1px solid rgba(56,189,248,0.22);
  color: #7dd3fc;
  box-shadow: none;
}

.btn-danger {
  background: var(--danger-soft);
  border: 1px solid rgba(239,68,68,0.22);
  color: #fca5a5;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-ghost:hover,
.sidebar-logout-btn:hover,
.btn-small:hover {
  transform: translateY(-2px);
}

.btn-primary:hover,
.btn-small:hover,
.sidebar-logout-btn:hover {
  box-shadow: 0 16px 32px rgba(37,99,235,0.28);
}

.btn-secondary:hover,
.btn-ghost:hover {
  background: rgba(56,189,248,0.16);
  border-color: rgba(56,189,248,0.36);
  color: #ffffff;
}

.btn-danger:hover {
  background: rgba(239,68,68,0.20);
  border-color: rgba(239,68,68,0.38);
}

.btn-small {
  padding: 10px 15px;
  border-radius: var(--radius-pill);
  font-size: 12px;
}

/* =========================================================
   CARDS / SURFACES
========================================================= */

.content-card,
.form-card,
.stat-card,
.chart-card,
.report-card,
.team-status-item,
.report-summary-card,
.player-of-match-card,
.auth-card,
.landing-card,
.landing-preview-card,
.landing-cta {
  position: relative;
  overflow: hidden;

  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
}

.content-card,
.form-card,
.chart-card,
.notification-center-card {
  padding: 28px;
  margin-bottom: 22px;
  border-radius: var(--radius-lg);
}

.content-card::before,
.form-card::before,
.stat-card::before,
.chart-card::before,
.report-summary-card::before,
.player-of-match-card::before,
.landing-card::before {
  content: "";
  position: absolute;
  top: -100px;
  right: -100px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56,189,248,0.10), transparent 70%);
  pointer-events: none;
}

.content-card:hover,
.stat-card:hover,
.chart-card:hover,
.report-card:hover,
.team-status-item:hover,
.report-summary-card:hover,
.player-of-match-card:hover,
.landing-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56,189,248,0.24);
  box-shadow:
    0 22px 50px rgba(0,0,0,0.34),
    0 0 0 1px rgba(56,189,248,0.06),
    0 0 26px rgba(56,189,248,0.10);
}

.form-card:hover {
  border-color: rgba(56,189,248,0.18);
  box-shadow: var(--shadow-md);
}

.content-card h2,
.form-card h2,
.chart-card h2 {
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.content-card + .content-card,
.form-card + .content-card,
.content-card + .form-card {
  margin-top: 24px;
}

/* =========================================================
   APP CARD SYSTEM
========================================================= */

.app-card {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-radius: 26px;

  border: 1px solid rgba(56,189,248,0.09);

  background:
    radial-gradient(circle at top right, rgba(56,189,248,0.07), transparent 32%),
    linear-gradient(135deg, rgba(15,23,42,0.94), rgba(2,6,23,0.84));

  box-shadow:
    0 20px 52px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.025);

  backdrop-filter: blur(18px);

  transition:
    transform 0.20s ease,
    border-color 0.20s ease,
    box-shadow 0.20s ease;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56,189,248,0.22);
  box-shadow:
    0 30px 70px rgba(0,0,0,0.36),
    0 0 0 1px rgba(56,189,248,0.06);
}

/* =========================================================
   GRID SYSTEMS
========================================================= */

.stats-grid,
.module-grid,
.reports-grid,
.dashboard-chart-grid,
.team-status-bar,
.insights-grid,
.landing-card-grid,
.match-report-summary,
.potm-grid,
.team-sheet-grid,
.assignment-grid,
.player-card-grid,
.wellness-metrics,
.injury-card-grid,
.report-row-metrics,
.preview-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 26px;
}

.player-card-grid,
.wellness-metrics,
.injury-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.report-row-metrics {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.preview-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* =========================================================
   STAT CARDS
========================================================= */

.stat-card {
  min-height: 164px;
  padding: 22px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card p,
.team-status-item span,
.report-summary-card span,
.preview-grid span,
.preview-top span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card h2 {
  margin: 10px 0;
  color: #ffffff;
  font-size: clamp(28px, 2.8vw, 48px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.95;
  overflow-wrap: break-word;
  word-break: break-word;
}

.stat-card:hover h2 {
  transform: scale(1.03);
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.stat-ready  { border-color: rgba(34,197,94,0.28); }
.stat-ready::before { background: radial-gradient(circle, rgba(34,197,94,0.16), transparent 70%); }
.stat-ready h2 { color: #86efac; }

.stat-monitor,
.stat-warning { border-color: rgba(245,158,11,0.28); }
.stat-monitor::before,
.stat-warning::before { background: radial-gradient(circle, rgba(245,158,11,0.16), transparent 70%); }
.stat-monitor h2,
.stat-warning h2 { color: #fcd34d; }

.stat-danger { border-color: rgba(239,68,68,0.28); }
.stat-danger::before { background: radial-gradient(circle, rgba(239,68,68,0.16), transparent 70%); }
.stat-danger h2 { color: #fca5a5; }

/* =========================================================
   STATUS / PILLS / BADGES
========================================================= */

.status-pill,
.report-pill,
.wellness-score,
.load-pill,
.stat-trend,
.match-status-badge,
.report-status-badge,
.match-date-pill,
.player-of-match-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-pill,
.wellness-score,
.status-rehab,
.load-low,
.status-info,
.notification-info,
.match-status-badge,
.player-of-match-badge {
  background: var(--primary-soft);
  color: #7dd3fc;
}

.status-available,
.status-present,
.injury-cleared,
.load-good,
.trend-up,
.report-complete,
.readiness-ready {
  background: var(--success-soft);
  color: #86efac;
}

.status-injured,
.status-absent,
.injury-active,
.load-danger,
.trend-danger,
.notification-danger,
.notification-high,
.readiness-danger,
.readiness-unavailable {
  background: var(--danger-soft);
  color: #fca5a5;
}

.status-unavailable,
.status-excused,
.injury-recovery,
.load-warning,
.trend-warning,
.report-draft,
.notification-warning,
.notification-monitor,
.readiness-monitor {
  background: var(--warning-soft);
  color: #fcd34d;
}

/* =========================================================
   DOTS
========================================================= */

.status-dot,
.live-dot,
.insight-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: var(--radius-pill);
}

.dot-ready,
.insight-good,
.live-dot { background: var(--success); box-shadow: 0 0 10px rgba(34,197,94,0.8); }
.dot-warning,
.insight-warning { background: var(--warning); box-shadow: 0 0 10px rgba(245,158,11,0.8); }
.dot-danger,
.insight-danger { background: var(--danger); box-shadow: 0 0 10px rgba(239,68,68,0.8); }
.dot-monitor,
.dot-neutral { background: var(--primary); box-shadow: 0 0 10px rgba(56,189,248,0.8); }

/* =========================================================
   FORMS
========================================================= */

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section h3 {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.grid-form,
.player-form-grid,
.attendance-form,
.wellness-form,
.injury-form,
.match-form,
.match-event-form {
  display: grid;
  gap: 18px;
  align-items: end;
}

.grid-form {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.player-form,
#playerForm {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.player-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.attendance-form  { grid-template-columns: 1.2fr 1fr 1fr auto; }
.wellness-form    { grid-template-columns: 1.4fr 1fr 1fr 1fr auto; }
.injury-form      { grid-template-columns: 1fr 1fr 1fr 1fr auto; }
.match-form       { grid-template-columns: 1.2fr 1.2fr 1fr 1fr 1fr auto; }
.match-event-form { grid-template-columns: 0.7fr 1fr 1.2fr 1.4fr 1.6fr auto; }

label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.86);
  color: #ffffff;
  font-size: 14px;
  backdrop-filter: blur(10px);
}

input,
select {
  height: 52px;
  padding: 0 14px;
}

input[type="date"],
input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  color: #ffffff;
  min-width: 0;
  max-width: 100%;
  text-align: left;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  color: #ffffff;
  text-align: left;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.70;
}

textarea {
  min-height: 110px;
  padding: 14px;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: rgba(148,163,184,0.6);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.12);
}

.form-span-2 { grid-column: span 2; }
.form-span-3 { grid-column: span 3; }
.form-span-4 { grid-column: span 4; }

/* =========================================================
   TABLES
========================================================= */

.table-wrap,
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(2,6,23,0.30);
}

.data-table,
table.premium-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.data-table th,
.data-table td,
table.premium-table th,
table.premium-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid rgba(148,163,184,0.09);
}

.data-table th,
table.premium-table th {
  color: var(--muted);
  background: rgba(15,23,42,0.78);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table td,
table.premium-table td {
  color: var(--text-soft);
  font-size: 13px;
}

.data-table tbody tr:hover,
table.premium-table tbody tr:hover {
  background: rgba(56,189,248,0.05);
}

.data-table tbody tr:last-child td,
table.premium-table tbody tr:last-child td {
  border-bottom: none;
}

/* =========================================================
   LISTS / RECORDS / ITEMS
========================================================= */

.list-stack,
.report-list,
.recent-activity-list,
.match-timeline,
.insight-list {
  display: grid;
  gap: 12px;
}

.list-stack > div,
.list-stack .team-card,
.list-stack .list-item,
.player-profile-card,
.attendance-card,
.wellness-card,
.injury-card,
.match-card,
.report-row,
.timeline-event,
.recent-activity-item,
.insight-card,
.trend-card,
.notification-item,
.team-sheet-player,
.squad-player-card {
  background: rgba(15,23,42,0.76);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
}

.player-profile-card:hover,
.attendance-card:hover,
.wellness-card:hover,
.injury-card:hover,
.match-card:hover,
.report-row:hover,
.timeline-event:hover,
.recent-activity-item:hover,
.insight-card:hover,
.trend-card:hover,
.notification-item:hover,
.team-sheet-player:hover {
  transform: translateY(-2px);
  border-color: rgba(56,189,248,0.24);
  background: linear-gradient(135deg, rgba(56,189,248,0.04), rgba(15,23,42,0.86));
}

.player-card-grid div,
.wellness-metrics div,
.injury-card-grid div,
.report-row-metrics div,
.preview-grid div,
.module-grid div {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,0.12);
  background: rgba(2,6,23,0.38);
}

.player-card-grid span,
.wellness-metrics span,
.injury-card-grid span,
.report-row-metrics span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.player-card-grid strong,
.report-row-metrics strong {
  font-size: 15px;
}

.record-actions,
.player-card-actions,
.report-metrics,
.match-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* record separator dot used in player detail sub-lines */
.record-separator {
  color: rgba(148,163,184,0.4);
  font-size: 10px;
  margin: 0 2px;
}

/* =========================================================
   TOASTS
========================================================= */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(14,14,14,0.88);
  color: #ffffff;
  backdrop-filter: blur(18px);
  box-shadow:
    0 10px 36px rgba(0,0,0,0.32),
    inset 0 1px 0 rgba(255,255,255,0.035);
  transform: translateX(110%);
  opacity: 0;
  pointer-events: auto;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
}

.toast-content  { flex: 1; min-width: 0; }
.toast-title    { margin-bottom: 2px; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }
.toast-message  { font-size: 13px; line-height: 1.5; font-weight: 600; }

.toast-close-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.78);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.toast-close-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #ffffff;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--primary-dark); }

.toast-success .toast-icon { background: var(--success-soft); color: #4ade80; }
.toast-error .toast-icon   { background: var(--danger-soft);  color: #f87171; }
.toast-warning .toast-icon { background: var(--warning-soft); color: #fbbf24; }
.toast-info .toast-icon    { background: rgba(59,130,246,0.14); color: #60a5fa; }

/* =========================================================
   LOADER
========================================================= */

.global-loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,12,20,0.80);
  backdrop-filter: blur(6px);
}

.global-loader.hidden { display: none; }

.rugby-loader {
  text-align: center;
  color: #ffffff;
}

.rugby-loader p {
  margin-top: 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.rugby-ball {
  width: 80px;
  height: 52px;
  position: relative;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(145deg, #f5f5f5, #d9d9d9);
  transform: rotate(-25deg);
  animation:
    rugby-roll 1.2s linear infinite,
    rugby-bounce 0.9s ease-in-out infinite;
  box-shadow: 0 8px 22px rgba(0,0,0,0.34);
}

.rugby-ball::before,
.rugby-ball::after {
  content: "";
  position: absolute;
  background: #222;
}

.rugby-ball::before {
  width: 9px;
  height: 100%;
  left: 50%;
  transform: translateX(-50%);
}

.rugby-ball::after {
  width: 42px;
  height: 5px;
  top: 50%;
  left: 50%;
  border-radius: 10px;
  transform: translate(-50%, -50%);
}

@keyframes rugby-roll {
  from { transform: rotate(-25deg) rotate(0deg); }
  to   { transform: rotate(-25deg) rotate(360deg); }
}

@keyframes rugby-bounce {
  0%, 100% { translate: 0 0; }
  50%       { translate: 0 -9px; }
}

/* =========================================================
   AUTH MESSAGE / FORM MESSAGE
========================================================= */

.auth-message,
.form-message {
  margin-bottom: 16px;
  padding: 12px 15px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
}

.auth-message-success, .form-message-success {
  background: var(--success-soft);
  border: 1px solid rgba(34,197,94,0.24);
  color: #86efac;
}

.auth-message-error, .form-message-error {
  background: var(--danger-soft);
  border: 1px solid rgba(239,68,68,0.24);
  color: #fca5a5;
}

.auth-message-warning, .form-message-warning {
  background: var(--warning-soft);
  border: 1px solid rgba(245,158,11,0.24);
  color: #fcd34d;
}

/* =========================================================
   RESPONSIVE COMPONENTS
========================================================= */

@media (max-width: 1200px) {
  .player-form-grid,
  .match-form,
  .match-event-form {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-span-2,
  .form-span-3,
  .form-span-4 {
    grid-column: span 2;
  }
}

@media (max-width: 1100px) {
  .dashboard-chart-grid { grid-template-columns: 1fr; }

  .team-status-bar,
  .insights-grid,
  .landing-card-grid,
  .landing-card-grid.four {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1000px) {
  .attendance-form,
  .wellness-form,
  .injury-form {
    grid-template-columns: repeat(2, 1fr);
  }

  .attendance-form button,
  .wellness-form button,
  .injury-form button {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .potm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .team-sheet-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .grid-form,
  .player-form-grid,
  .attendance-form,
  .wellness-form,
  .injury-form,
  .match-form,
  .match-event-form,
  .team-status-bar,
  .insights-grid,
  .match-report-summary,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .grid-form > div,
  .player-form-grid > div,
  .attendance-form > div,
  .wellness-form > div,
  .injury-form > div,
  .match-form > div,
  .match-event-form > div {
    min-width: 0;
  }

  input, select, textarea { max-width: 100%; }

  .form-span-2,
  .form-span-3,
  .form-span-4 {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .stats-grid,
  .landing-card-grid,
  .landing-card-grid.four {
    grid-template-columns: 1fr;
  }

  .content-card,
  .form-card,
  .chart-card,
  .notification-center-card {
    padding: 20px;
  }

  .stat-card { min-height: auto; }

  .toast-container { left: 12px; right: 12px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
}

@media (max-width: 480px) {
  input, select, textarea { font-size: 16px; }

  .form-card .btn-primary,
  .form-card .btn-secondary,
  .form-card .btn-danger,
  .auth-card .btn-primary,
  .auth-card .btn-secondary,
  .auth-card .btn-danger,
  .sidebar-logout-btn {
    width: 100%;
    white-space: normal;
  }
}

/* =========================================================
   COMPONENT STABILITY
========================================================= */

.content-card,
.form-card,
.stat-card,
.chart-card,
.report-card,
.team-status-item,
.report-summary-card,
.player-profile-card,
.attendance-card,
.wellness-card,
.injury-card,
.match-card,
.report-row,
.notification-item,
.squad-player-card,
.team-sheet-player {
  min-width: 0;
}
