/* ============================================================
   SISTEM KEJOHANAN OLAHRAGA — gaya utama
   Satu fail untuk portal awam dan panel admin.
   ============================================================ */

:root {
  --biru:        #1857b8;
  --biru-gelap:  #0f3d85;
  --biru-muda:   #e8f0fc;
  --merah:       #c62828;
  --hijau:       #2e7d32;
  --emas:        #d4a017;
  --perak:       #9aa5b1;
  --gangsa:      #b06a2c;

  --teks:        #16202c;
  --teks-suram:  #65737e;
  --garis:       #dde3ea;
  --latar:       #f3f5f8;
  --kad:         #ffffff;

  --bulat:       10px;
  --bayang:      0 1px 2px rgba(16,32,48,.06), 0 4px 12px rgba(16,32,48,.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--teks);
  background: var(--latar);
}

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

h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

.bekas { max-width: 1180px; margin: 0 auto; padding: 0 16px; }


/* ---------- Kepala ---------- */

.kepala {
  background: linear-gradient(135deg, var(--biru-gelap), var(--biru));
  color: #fff;
  padding: 18px 0;
}
.kepala a { color: #fff; }
.kepala-isi { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.kepala-logo { height: 54px; width: auto; border-radius: 6px; background: #fff; padding: 3px; }
.kepala-tajuk { flex: 1 1 260px; min-width: 0; }
.kepala-tajuk strong { display: block; font-size: 1.22rem; letter-spacing: .2px; }
.kepala-tajuk span { display: block; font-size: .86rem; opacity: .85; }
.kepala-banner { width: 100%; height: auto; border-radius: var(--bulat); display: block; }

.marquee {
  background: var(--emas);
  color: #2a1d00;
  font-size: .88rem;
  padding: 7px 0;
  overflow: hidden;
  white-space: nowrap;
}
.marquee span { display: inline-block; padding-left: 100%; animation: jalan 24s linear infinite; }
@keyframes jalan { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee span { animation: none; padding-left: 0; white-space: normal; }
}


/* ---------- Menu ---------- */

.menu { background: var(--kad); border-bottom: 1px solid var(--garis); }
.menu-isi { display: flex; gap: 2px; overflow-x: auto; }
.menu a {
  padding: 12px 15px;
  color: var(--teks-suram);
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.menu a:hover { color: var(--biru); text-decoration: none; }
.menu a.aktif { color: var(--biru); border-bottom-color: var(--biru); }

.menu-sisi { display: grid; gap: 2px; }
.menu-sisi a { padding: 9px 12px; border-radius: 7px; font-size: .9rem; color: var(--teks); }
.menu-sisi a:hover { background: var(--biru-muda); text-decoration: none; }
.menu-sisi a.aktif { background: var(--biru); color: #fff; }
.menu-sisi .tajuk {
  padding: 14px 12px 5px; font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--teks-suram);
}


/* ---------- Susun atur ---------- */

main { padding: 20px 0 50px; }

.susun-admin { display: grid; grid-template-columns: 215px 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .susun-admin { grid-template-columns: 1fr; } }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.kad {
  background: var(--kad);
  border: 1px solid var(--garis);
  border-radius: var(--bulat);
  box-shadow: var(--bayang);
  padding: 18px;
  margin-bottom: 18px;
}
.kad > :last-child { margin-bottom: 0; }

.kad-tajuk {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.kad-tajuk h2 { margin: 0; }


/* ---------- Jadual ---------- */

.jadual-skrol { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.jd { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.jd th, table.jd td { padding: 9px 10px; border-bottom: 1px solid var(--garis); text-align: left; }
table.jd th {
  background: #f7f9fc; font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--teks-suram);
  white-space: nowrap; position: sticky; top: 0;
}
table.jd tbody tr:hover { background: #fafbfd; }
table.jd td.tgh, table.jd th.tgh { text-align: center; }
table.jd td.kanan, table.jd th.kanan { text-align: right; }
table.jd .suram { color: var(--teks-suram); }


/* ---------- Lencana & pingat ---------- */

.bib {
  display: inline-block; min-width: 34px; padding: 2px 7px;
  background: var(--teks); color: #fff; border-radius: 5px;
  font-size: .78rem; font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}

.lencana {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: .74rem; font-weight: 700; white-space: nowrap;
}
.l-hijau  { background: #e4f3e5; color: var(--hijau); }
.l-merah  { background: #fce8e8; color: var(--merah); }
.l-kelabu { background: #eceff3; color: var(--teks-suram); }
.l-biru   { background: var(--biru-muda); color: var(--biru-gelap); }
.l-emas   { background: #fbf0d2; color: #7a5c00; }

.pingat {
  display: inline-flex; align-items: center; justify-content: center;
  width: 23px; height: 23px; border-radius: 50%;
  font-size: .76rem; font-weight: 700; color: #fff;
}
.p-emas   { background: var(--emas); }
.p-perak  { background: var(--perak); }
.p-gangsa { background: var(--gangsa); }

.rekod-baharu {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  background: var(--emas); color: #2a1d00;
  font-size: .68rem; font-weight: 800; letter-spacing: .04em;
}


/* ---------- Kontinjen ---------- */

.kontinjen-sel { display: flex; align-items: center; gap: 7px; }
.warna-mini { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.logo-mini  { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; flex: none; }
.avatar-huruf {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: .7rem; font-weight: 700;
}


/* Jalur logo pasukan di laman utama */
.logo-pasukan {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px;
}
.logo-pasukan a {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; border-radius: 10px; text-decoration: none; color: inherit;
  text-align: center; transition: background .15s;
}
.logo-pasukan a:hover { background: var(--biru-muda); }
.logo-pasukan img { width: 64px; height: 64px; object-fit: contain; }
.logo-pasukan .logo-ganti {
  width: 64px; height: 64px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700;
}
.logo-pasukan .nama { font-size: .78rem; font-weight: 600; line-height: 1.2; }


/* ---------- Carta mata ---------- */

.carta-baris { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; margin-bottom: 9px; }
.carta-nama { display: flex; align-items: center; gap: 7px; font-size: .88rem; font-weight: 600; min-width: 0; }
.carta-nama span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carta-bar-luar { background: #eceff3; border-radius: 6px; height: 25px; overflow: hidden; }
.carta-bar {
  height: 100%; border-radius: 6px; min-width: 34px;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 9px; color: #fff; font-size: .8rem; font-weight: 700;
  transition: width .4s ease;
}
@media (max-width: 520px) { .carta-baris { grid-template-columns: 105px 1fr; } }


/* ---------- Butang ---------- */

.butang {
  display: inline-block; padding: 8px 15px; border-radius: 7px;
  background: var(--biru); color: #fff; border: 1px solid var(--biru);
  font-size: .88rem; font-weight: 600; cursor: pointer;
  text-align: center; line-height: 1.3;
}
.butang:hover { background: var(--biru-gelap); border-color: var(--biru-gelap); text-decoration: none; color: #fff; }
.butang:disabled, .butang[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.butang.kecil { padding: 4px 10px; font-size: .78rem; border-radius: 5px; }
.butang.kelabu { background: #eceff3; color: var(--teks-suram); border-color: var(--garis); }
.butang.kelabu:hover { background: #e2e7ed; color: var(--teks); }
.butang.bahaya { background: var(--merah); border-color: var(--merah); }
.butang.bahaya:hover { background: #a21f1f; border-color: #a21f1f; }
.butang.luar { background: transparent; color: var(--biru); }
.butang.luar:hover { background: var(--biru-muda); color: var(--biru-gelap); }

.butang-baris { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }


/* ---------- Borang ---------- */

.medan { margin-bottom: 13px; }
.medan label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 4px; color: var(--teks-suram); }
.medan .nota { font-size: .78rem; color: var(--teks-suram); margin-top: 3px; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--garis); border-radius: 7px;
  font: inherit; font-size: .9rem; background: #fff; color: var(--teks);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--biru); box-shadow: 0 0 0 3px rgba(24,87,184,.12);
}
input[readonly] { background: #f5f7fa; color: var(--teks-suram); }
textarea { min-height: 85px; resize: vertical; }

.medan-baris { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 13px; }

input.catatan {
  width: 92px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600;
}
input.cubaan { width: 68px; text-align: center; text-transform: uppercase; }


/* ---------- Tab ---------- */

.tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a {
  padding: 6px 13px; border-radius: 20px; background: #eceff3;
  color: var(--teks-suram); font-size: .84rem; font-weight: 600;
}
.tabs a:hover { background: #e2e7ed; text-decoration: none; }
.tabs a.aktif { background: var(--biru); color: #fff; }


/* ---------- Pemberitahuan ---------- */

.pesan {
  padding: 11px 14px; border-radius: 8px; margin-bottom: 14px;
  font-size: .9rem; border-left: 4px solid;
}
.pesan.ok     { background: #e9f6ea; border-color: var(--hijau); color: #1c5720; }
.pesan.ralat  { background: #fcebeb; border-color: var(--merah); color: #8e1f1f; }
.pesan.amaran { background: #fdf4e0; border-color: var(--emas); color: #6d4f00; }
.pesan.info   { background: var(--biru-muda); border-color: var(--biru); color: var(--biru-gelap); }

.kosong { text-align: center; padding: 34px 16px; color: var(--teks-suram); font-size: .92rem; }


/* ---------- Statistik ---------- */

.stat { background: var(--kad); border: 1px solid var(--garis); border-radius: var(--bulat); padding: 15px; }
.stat .angka { font-size: 1.75rem; font-weight: 800; line-height: 1.1; color: var(--biru-gelap); }
.stat .label { font-size: .78rem; color: var(--teks-suram); text-transform: uppercase; letter-spacing: .05em; }


/* ---------- Log masuk ---------- */

.login-latar {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(135deg, var(--biru-gelap), var(--biru));
}
.login-kotak {
  background: #fff; border-radius: 14px; padding: 30px;
  width: 100%; max-width: 385px; box-shadow: 0 10px 40px rgba(0,0,0,.22);
}
.login-kotak h1 { font-size: 1.22rem; text-align: center; margin-bottom: 4px; }
.login-kotak .sub { text-align: center; color: var(--teks-suram); font-size: .85rem; margin-bottom: 20px; }


/* ---------- Kaki ---------- */

.kaki {
  border-top: 1px solid var(--garis); background: var(--kad);
  padding: 18px 0; font-size: .82rem; color: var(--teks-suram); text-align: center;
}


/* ---------- Cetakan ---------- */

@media print {
  .menu, .kepala, .kaki, .butang, .tabs, .jangan-cetak { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .kad { box-shadow: none; border: none; padding: 0; margin: 0 0 10pt; }
  table.jd { font-size: 10pt; }
  table.jd th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .jadual-skrol { overflow: visible; }
}
