/* ============================================================
   SISTEM KEJOHANAN BOLA SEPAK - Main Stylesheet
   ============================================================ */

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

:root {
  --primary: #0a0f1e;
  --primary-light: #141b33;
  --accent: #00d4aa;
  --accent-dark: #00a882;
  --accent2: #ff6b35;
  --gold: #f5c518;
  --white: #ffffff;
  --gray-100: #f4f5f7;
  --gray-200: #e8eaed;
  --gray-300: #c8cdd6;
  --gray-400: #9199a8;
  --gray-500: #5f6878;
  --gray-600: #3d4455;
  --danger: #e63946;
  --success: #2dc653;
  --warning: #f4a261;
  --info: #4895ef;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.12);
  --shadow-md: 0 4px 16px rgba(0,0,0,.16);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.24);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --sidebar-w: 240px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--gray-100);
  color: var(--primary);
  min-height: 100vh;
  line-height: 1.6;
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s ease;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.page-body {
  padding: 1.75rem;
  flex: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-brand {
  padding: 1.25rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand-icon {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

.brand-text {
  line-height: 1.2;
}

.brand-text .name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: .5px;
}

.brand-text .sub {
  font-size: .68rem;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.nav-section {
  padding: .5rem 1.2rem .25rem;
  font-size: .65rem;
  font-weight: 600;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.2rem;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s;
  border-radius: 0;
  position: relative;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(0,212,170,.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item i { font-size: 1.1rem; width: 20px; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 1rem 1.2rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.user-meta .name { font-size: .85rem; font-weight: 600; color: #fff; }
.user-meta .role { font-size: .7rem; color: rgba(255,255,255,.4); }

/* ============================================================
   TOPBAR
   ============================================================ */
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  cursor: pointer;
  transition: all .2s;
}

.btn-icon:hover { background: var(--gray-100); color: var(--primary); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all .2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.green  { background: #e8f7ee; color: var(--success); }
.stat-icon.blue   { background: #e8f1fc; color: var(--info); }
.stat-icon.orange { background: #fff0e8; color: var(--accent2); }
.stat-icon.teal   { background: #e0faf5; color: var(--accent); }
.stat-icon.gold   { background: #fdf9e3; color: var(--gold); }
.stat-icon.red    { background: #fdeaea; color: var(--danger); }

.stat-body .label { font-size: .78rem; color: var(--gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-body .value { font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--primary); }
.stat-body .sub { font-size: .78rem; color: var(--gray-400); margin-top: .2rem; }

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

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

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--primary);
}

.card-body { padding: 1.25rem; }

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.table th {
  background: var(--primary);
  color: rgba(255,255,255,.7);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-600);
  vertical-align: middle;
}

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

/* Ranking table specific */
.rank-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: var(--gray-500);
}

.rank-num.gold { background: var(--gold); color: #fff; }
.rank-num.silver { background: var(--gray-300); color: var(--gray-600); }
.rank-num.bronze { background: #cd7f32; color: #fff; }

.team-logo-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.team-initials {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ============================================================
   MATCH CARD
   ============================================================ */
.match-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  transition: all .2s;
}

.match-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.match-card .match-meta {
  font-size: .72rem;
  color: var(--gray-400);
  margin-bottom: .6rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

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

.match-team {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: 1;
}

.match-team.home { justify-content: flex-end; flex-direction: row-reverse; }

.match-team-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.match-score {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 80px;
  justify-content: center;
}

.score-box {
  background: var(--primary);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}

.score-sep { font-size: .8rem; color: var(--gray-300); font-weight: 700; }

/* ============================================================
   PLAYER CARD
   ============================================================ */
.player-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: all .2s;
  position: relative;
}

.player-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.player-card .card-top {
  background: var(--primary);
  padding: 1.5rem 1rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.player-card .card-top::before {
  content: '';
  position: absolute;
  bottom: -20px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 40px;
  background: #fff;
  border-radius: 50%;
}

.player-jersey {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.5rem;
  color: rgba(255,255,255,.15);
  position: absolute;
  top: .5rem; right: 1rem;
  line-height: 1;
}

.player-avatar {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2);
  margin: 0 auto;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  position: relative;
  z-index: 1;
}

.player-card .card-body {
  padding: 1rem;
  text-align: center;
}

.player-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .2rem;
}

.player-pos {
  font-size: .72rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.player-no {
  position: absolute;
  top: .75rem; left: .75rem;
  background: var(--accent);
  color: var(--primary);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.player-stats {
  display: flex;
  border-top: 1px solid var(--gray-200);
  margin-top: .75rem;
}

.player-stats .stat {
  flex: 1;
  text-align: center;
  padding: .5rem .25rem;
  border-right: 1px solid var(--gray-200);
}

.player-stats .stat:last-child { border-right: none; }
.player-stats .stat .num { font-family: 'Barlow Condensed', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.player-stats .stat .lbl { font-size: .65rem; color: var(--gray-400); text-transform: uppercase; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.badge-success { background: #e8f7ee; color: var(--success); }
.badge-danger  { background: #fdeaea; color: var(--danger); }
.badge-warning { background: #fff4e0; color: #c4862f; }
.badge-info    { background: #e8f1fc; color: var(--info); }
.badge-secondary { background: var(--gray-200); color: var(--gray-500); }

.badge-pulse { animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(230,57,70,.4); }
  70%  { box-shadow: 0 0 0 8px rgba(230,57,70,0); }
  100% { box-shadow: 0 0 0 0 rgba(230,57,70,0); }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-family: 'Barlow', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: var(--primary); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-dark { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-dark:hover { background: var(--primary-light); }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-100); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warning { background: var(--warning); color: var(--primary); border-color: var(--warning); }

.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .4rem;
}

.form-control {
  width: 100%;
  padding: .6rem .9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: .9rem;
  color: var(--primary);
  background: #fff;
  transition: border-color .2s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,170,.15);
}

.form-control::placeholder { color: var(--gray-300); }

select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.form-help { font-size: .75rem; color: var(--gray-400); margin-top: .3rem; }

/* ============================================================
   KAD PERLAWANAN (Print)
   ============================================================ */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  .card { border: 1px solid #ddd !important; box-shadow: none !important; }
  body { background: #fff; }
}

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
}

.alert-success { background: #e8f7ee; color: #1a7a3a; border-left: 4px solid var(--success); }
.alert-danger  { background: #fdeaea; color: #a32323; border-left: 4px solid var(--danger); }
.alert-info    { background: #e8f1fc; color: #1a4f8a; border-left: 4px solid var(--info); }
.alert-warning { background: #fff4e0; color: #7a4f00; border-left: 4px solid var(--warning); }

/* ============================================================
   PROGRESS / MILIKAN BOLA
   ============================================================ */
.possession-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--gray-200);
}

.possession-bar .left { background: var(--accent); transition: width .5s; }
.possession-bar .right { background: var(--accent2); transition: width .5s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
