/* ==========================================================
   PadelLiga — Global Styles
   Design: dark, sport, Bebas Neue + DM Sans
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:        #0a0d12;
  --surface:   #111520;
  --surface2:  #181e2e;
  --surface3:  #1f2840;
  --border:    rgba(255,255,255,0.07);
  --accent:    #00e5a0;
  --accent2:   #0095ff;
  --warn:      #ff6b35;
  --danger:    #e03e3e;
  --text:      #e8edf5;
  --text2:     #8a95a8;
  --text3:     #4a5568;
  --win:       #00e5a0;
  --loss:      #ff4757;
  --radius:    12px;
}

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

html, body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- App Shell ---- */
.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  font-family: 'Bebas Neue', cursive;
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
}

.logo-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
}

.logo-sub {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav { padding: 16px 10px; flex: 1; overflow-y: auto; }

.nav-section {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text3);
  text-transform: uppercase;
  padding: 10px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(0,229,160,0.12); color: var(--accent); }

.nav-icon { font-size: 14px; opacity: 0.7; width: 16px; text-align: center; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 4px;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00e5a0, #00b880);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #000;
  flex-shrink: 0;
}

.user-name  { font-size: 13px; font-weight: 500; }
.user-roles { font-size: 11px; color: var(--text3); }

.logout-btn { color: var(--text3) !important; }
.logout-btn:hover { color: var(--loss) !important; }

/* ---- Main Content ---- */
.main-content {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  padding: 32px;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 30px;
  letter-spacing: 2px;
}

/* ---- Role Badges ---- */
.role-badge {
  font-size: 11px; font-weight: 600;
  letter-spacing: 1px; padding: 4px 10px;
  border-radius: 20px; text-transform: uppercase;
}
.role-admin  { background: rgba(0,229,160,0.15);  color: var(--accent); }
.role-coach  { background: rgba(0,149,255,0.15);  color: var(--accent2); }
.role-player { background: rgba(255,107,53,0.15); color: var(--warn); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text3);
  font-weight: 600; margin-bottom: 16px;
}

.card-header-row {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
  margin-bottom: 0;
}

.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
}

.stat-card.green::before  { background: var(--accent); }
.stat-card.blue::before   { background: var(--accent2); }
.stat-card.orange::before { background: var(--warn); }
.stat-card.purple::before { background: #a78bfa; }

.stat-label {
  font-size: 11px; color: var(--text3);
  letter-spacing: 1px; text-transform: uppercase; font-weight: 600;
}
.stat-value {
  font-family: 'Bebas Neue', cursive;
  font-size: 42px; line-height: 1; margin: 6px 0 4px; letter-spacing: 1px;
}
.stat-sub { font-size: 12px; color: var(--text2); }

.stat-card.green  .stat-value { color: var(--accent); }
.stat-card.blue   .stat-value { color: var(--accent2); }
.stat-card.orange .stat-value { color: var(--warn); }
.stat-card.purple .stat-value { color: #a78bfa; }

/* ---- Grids ---- */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text3); font-weight: 600;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px; font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); color: var(--text); }
.td-name { font-weight: 500; color: var(--text); }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 4px; letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge-green  { background: rgba(0,229,160,0.12); color: var(--accent); }
.badge-red    { background: rgba(255,71,87,0.12);  color: var(--loss); }
.badge-blue   { background: rgba(0,149,255,0.12);  color: var(--accent2); }
.badge-orange { background: rgba(255,107,53,0.12); color: var(--warn); }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--text2); }
.badge-purple { background: rgba(167,139,250,0.12); color: #a78bfa; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
}
.btn-primary   { background: var(--accent); color: #000; }
.btn-primary:hover { background: #00c988; }
.btn-secondary { background: var(--surface3); color: var(--text); }
.btn-ghost     { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger    { background: #e03e3e; color: #fff; }
.btn-danger:hover { background: #c42f2f; }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; }

/* ---- Forms ---- */
.form-group   { margin-bottom: 16px; }
.form-label   {
  font-size: 11px; font-weight: 600;
  letter-spacing: 1px; color: var(--text2);
  text-transform: uppercase; display: block; margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--accent); }

/* ---- Login ---- */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 20% 50%, rgba(0,229,160,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 40%, rgba(0,149,255,0.05) 0%, transparent 60%);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 380px; max-width: 90vw;
}

.login-logo   { text-align: center; margin-bottom: 32px; }
.logo-big     { font-family: 'Bebas Neue', cursive; font-size: 36px; letter-spacing: 4px; color: var(--accent); }
.logo-small   { font-size: 11px; color: var(--text3); letter-spacing: 3px; text-transform: uppercase; margin-top: 2px; }

.btn-login {
  width: 100%; padding: 12px;
  background: var(--accent); color: #000;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 700;
  font-family: 'Bebas Neue', cursive; letter-spacing: 2px;
  cursor: pointer; margin-top: 8px;
  transition: background 0.15s;
}
.btn-login:hover    { background: #00c988; }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Alerts ---- */
.alert {
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; margin-bottom: 12px;
}
.alert-error   { background: rgba(255,71,87,0.12);  color: var(--loss);   border: 1px solid rgba(255,71,87,0.2); }
.alert-success { background: rgba(0,229,160,0.12); color: var(--accent);  border: 1px solid rgba(0,229,160,0.2); }

/* ---- Match cards ---- */
.match-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px; display: flex;
  align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.match-card:hover { border-color: rgba(0,229,160,0.3); }
.match-vs   { font-family: 'Bebas Neue', cursive; font-size: 16px; letter-spacing: 1px; }
.match-meta { font-size: 12px; color: var(--text2); margin-top: 3px; }

/* ---- Training items ---- */
.training-item {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.training-item:last-child { border-bottom: none; }
.training-type { font-size: 13.5px; font-weight: 500; }
.training-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ---- Player items ---- */
.player-item {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.player-item:last-child { border-bottom: none; }
.player-left  { display: flex; align-items: center; gap: 10px; }
.player-name  { font-size: 13.5px; font-weight: 500; }
.player-sub   { font-size: 12px; color: var(--text2); }

.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #00e5a0, #00b880);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #000; flex-shrink: 0;
}

/* ---- Availability toggles ---- */
.avail-toggle { display: flex; gap: 6px; }
.avail-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.15s; font-family: 'DM Sans', sans-serif;
}
.avail-yes        { background: rgba(0,229,160,0.08);  color: var(--accent); border-color: rgba(0,229,160,0.15); }
.avail-yes:hover  { background: rgba(0,229,160,0.15); }
.avail-yes.active { background: rgba(0,229,160,0.2); border-color: var(--accent); }
.avail-no         { background: rgba(255,71,87,0.08);  color: var(--loss);   border-color: rgba(255,71,87,0.15); }
.avail-no:hover   { background: rgba(255,71,87,0.15); }
.avail-no.active  { background: rgba(255,71,87,0.2);  border-color: var(--loss); }

/* ---- Callup cards ---- */
.match-callup-card { margin-bottom: 16px; }
.callup-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 12px;
}
.callup-body   { padding-top: 12px; border-top: 1px solid var(--border); }
.callup-section { margin-bottom: 14px; }
.section-label {
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 2px;
  font-weight: 600; margin-bottom: 10px;
}
.player-chips  { display: flex; flex-wrap: wrap; gap: 8px; }
.player-chip   { display: flex; align-items: center; gap: 8px; }
.chip-name     { font-size: 13px; font-weight: 500; }

.pair-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.pair-row:last-child { border-bottom: none; }
.pair-number {
  font-family: 'Bebas Neue', cursive; font-size: 20px; color: var(--accent); width: 20px;
}
.pair-names { flex: 1; font-size: 13px; font-weight: 500; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200; display: none;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 32px;
  width: 480px; max-width: 90vw;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal-title   { font-family: 'Bebas Neue', cursive; font-size: 22px; letter-spacing: 2px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---- Player select (callup modal) ---- */
.player-select-item {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px;
  cursor: pointer; transition: all 0.15s;
}
.player-select-item:hover    { border-color: rgba(0,229,160,0.3); }
.player-select-item.selected { border-color: var(--accent); background: rgba(0,229,160,0.08); }

.checkbox {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1.5px solid var(--text3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; transition: all 0.15s;
}
.checkbox.checked { background: var(--accent); border-color: var(--accent); color: #000; }

/* ---- Team cards ---- */
.team-card       { transition: border-color 0.15s; }
.team-card:hover { border-color: rgba(0,229,160,0.3); }
.team-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 16px;
}
.team-name   { font-size: 17px; font-weight: 600; }
.team-league { font-size: 12px; color: var(--text2); margin-top: 2px; }
.team-stats-row { display: flex; gap: 20px; }
.team-stat .ts-label {
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1px;
}
.team-stat .ts-value {
  font-family: 'Bebas Neue', cursive; font-size: 28px; line-height: 1;
}
.ts-value.green  { color: var(--accent); }
.ts-value.blue   { color: var(--accent2); }
.ts-value.win    { color: var(--win); }
.ts-value.loss   { color: var(--loss); }

/* ---- Progress bar ---- */
.progress-bar {
  height: 6px; background: var(--surface3);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: var(--accent); transition: width 0.3s;
}

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 4px;
  background: var(--surface2); padding: 4px;
  border-radius: 10px; width: fit-content;
}
.tab {
  padding: 7px 16px; border-radius: 7px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--text2); transition: all 0.15s;
}
.tab.active        { background: var(--surface3); color: var(--text); }
.tab:hover:not(.active) { color: var(--text); }

/* ---- Misc ---- */
.loading     { padding: 40px; text-align: center; color: var(--text2); }
.empty-state { color: var(--text3); font-size: 13px; padding: 16px 0; text-align: center; }

/* ---- Date/time picker icons (dark theme) ---- */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) brightness(1.4);
  cursor: pointer;
  opacity: 0.8;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* ---- Responsive column helpers ---- */
.col-sm-only { display: none; }

@media (max-width: 768px) {
  .col-md      { display: none !important; }
  .col-sm-only { display: block; }
}

/* ---- Mobile Top Bar ---- */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 300;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
}

.hamburger {
  background: none; border: none;
  color: var(--text); font-size: 20px;
  cursor: pointer; padding: 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background 0.15s;
  flex-shrink: 0;
}
.hamburger:hover { background: var(--surface2); }

.mobile-logo {
  font-family: 'Bebas Neue', cursive;
  font-size: 22px; color: var(--accent); letter-spacing: 2px;
}

/* Overlay para fechar sidebar no mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2col  { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Evitar overflow horizontal */
  html, body, .app-shell { overflow-x: hidden; max-width: 100vw; }
  .main-content { overflow-x: hidden; }

  /* Topbar mobile */
  .mobile-topbar { display: flex; }

  /* Sidebar desliza como drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }

  /* Conteúdo principal */
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 72px;
    box-sizing: border-box;
    width: 100%;
  }

  /* Page header */
  .page-header  { flex-wrap: wrap; gap: 10px; }
  .page-title   { font-size: 26px; }

  /* Cards */
  .card { padding: 16px; }

  /* Tabelas: scroll horizontal apenas quando necessário */
  .table-scroll              { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll.wide table   { min-width: 640px; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-value { font-size: 34px; }

  /* Training items — stack verticalmente */
  .training-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 0;
  }
  .training-item > div:last-child { flex-wrap: wrap; }

  /* Modais — quase full-width */
  .modal {
    width: calc(100vw - 32px);
    max-width: 100%;
    padding: 24px 18px;
    margin: 16px;
    border-radius: 12px;
  }

  /* Tabs — scroll horizontal se não couberem */
  .tabs { overflow-x: auto; width: 100%; }

  /* Callup header */
  .callup-header { flex-direction: column; gap: 10px; }

  /* Team stats row */
  .team-stats-row { flex-wrap: wrap; gap: 12px; }

  /* Avail buttons */
  .avail-btn { padding: 5px 10px; font-size: 11px; }
}

@media (max-width: 480px) {
  .main-content { padding: 12px; padding-top: 68px; }
  .card         { padding: 12px; }
  .page-title   { font-size: 22px; }

  /* Page header empilha */
  .page-header  { flex-direction: column; align-items: flex-start; }
  .page-header .btn { align-self: stretch; justify-content: center; }

  /* Stat cards */
  .stats-grid { gap: 10px; }
  .stat-value { font-size: 28px; }
  .stat-card  { padding: 14px; }

  /* Tabelas */
  th { padding: 0 8px 8px; font-size: 9px; }
  td { padding: 10px 8px; font-size: 12.5px; }

  /* Pair rows */
  .pair-row { flex-wrap: wrap; gap: 6px; }

  /* Player chips */
  .player-chips { gap: 6px; }
}

/* ---- Pagination / Page-size bar ---- */
.page-size-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

@media (max-width: 480px) {
  .page-size-bar { justify-content: flex-start; }
  .pagination-bar { justify-content: center; }
}
