/* ============================================================
   assets/css/style.css  –  Team Manager
   Tema: chiaro, moderno, sans-serif, mobile-friendly
   ============================================================ */

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

:root {
  --primary:     #1a56db;
  --primary-dk:  #1343b0;
  --primary-lt:  #e8f0fe;
  --success:     #0d9488;
  --warning:     #d97706;
  --danger:      #dc2626;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-200:    #e2e8f0;
  --gray-400:    #94a3b8;
  --gray-600:    #475569;
  --gray-800:    #1e293b;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --transition:  .15s ease;
}

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

body {
  margin: 0;
  font-family: 'Figtree', system-ui, sans-serif;
  font-size: 15px;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 800;
  font-size: 17px;
  color: var(--primary);
}

.sidebar-logo span { font-size: 26px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section-title {
  padding: 10px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-400);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
}

.nav-item:hover, .nav-item.active {
  background: var(--primary-lt);
  color: var(--primary);
  text-decoration: none;
}

.nav-item .icon { font-size: 18px; width: 20px; text-align: center; }

.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-weight: 700; font-size: 18px; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--gray-600);
}

.content { padding: 24px; }

/* ---- CARDS ---- */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-weight: 700; font-size: 16px; margin: 0; }
.card-body { padding: 20px; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }

table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.t th {
  background: var(--gray-50);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}

table.t td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: var(--gray-50); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: filter var(--transition), opacity var(--transition);
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { filter: brightness(.93); text-decoration: none; }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-sm        { padding: 5px 11px; font-size: 13px; }
.btn-lg        { padding: 12px 24px; font-size: 16px; }
.btn-outline   { background: transparent; border: 2px solid currentColor; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 5px;
  color: var(--gray-600);
}

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=datetime-local],
input[type=number], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.alert-success { background: #ecfdf5; border-color: var(--success); color: #065f46; }
.alert-danger  { background: #fef2f2; border-color: var(--danger);  color: #7f1d1d; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #78350f; }
.alert-info    { background: var(--primary-lt); border-color: var(--primary); color: var(--primary-dk); }

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #7f1d1d; }
.badge-blue   { background: var(--primary-lt); color: var(--primary-dk); }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }

/* ---- PARTITA - SCHERMATA TABLET ---- */
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px 0;
}

.player-tile {
  background: #fff;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.player-tile.titolare  { border-color: var(--primary); background: var(--primary-lt); }
.player-tile.in-campo  { border-color: var(--success); background: #ecfdf5; }
.player-tile.fuori     { border-color: var(--gray-200); background: var(--gray-50); opacity: .5; }
.player-tile.sostituito{ border-color: var(--warning);  background: #fffbeb; }

.player-tile .numero {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
}
.player-tile.titolare .numero  { color: var(--primary); }
.player-tile.in-campo .numero  { color: var(--success); }

.player-tile .nome {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--gray-800);
}

.player-tile .minuti-badge {
  font-size: 11px;
  margin-top: 4px;
  color: var(--gray-600);
}

/* ---- STAT BOXES ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.stat-box .val { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-box .lbl { font-size: 12px; font-weight: 600; color: var(--gray-600); text-transform: uppercase; }

/* ---- LOGIN ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f8fafc 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  font-size: 48px;
  margin-bottom: 8px;
}

.login-title {
  text-align: center;
  font-weight: 800;
  font-size: 22px;
  margin: 0 0 24px;
  color: var(--gray-800);
}


/* ---- ORDINAMENTO COLONNE ---- */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { background: var(--gray-200); }
th.sortable .sort-icon {
  display: inline-block;
  margin-left: 5px;
  color: var(--gray-400);
  font-size: 11px;
}
th.sortable.asc  .sort-icon { color: var(--primary); }
th.sortable.desc .sort-icon { color: var(--primary); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }

  .match-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }
  .player-tile { padding: 10px 6px; }
  .player-tile .numero { font-size: 22px; }
}

/* ---- UTILITY ---- */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.text-muted { color: var(--gray-400); font-size: 13px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.hidden { display: none; }
