/**
 * კლუბის შიდა გვერდი — index.php?m=264&club_id=...
 * იტვირთება მხოლოდ ამ URL-ზე (header.php), body.page-club
 */

body.page-club {
  --cp-bg: #f2f4f7;
  --cp-surface: #ffffff;
  --cp-ink: #0f1b2d;
  --cp-muted: #64748b;
  --cp-line: #e5e9f0;
  --cp-navy: #0a192f;
  --cp-navy-2: #172a45;
  --cp-teal: #00d4ff;
  --cp-green: #15af44;
  --cp-red: #e5484d;
  --cp-radius: 18px;
  --cp-shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 8px 24px rgba(15, 27, 45, .06);

  background-color: var(--cp-bg) !important;
  color: var(--cp-ink);
}

body.page-club main.club-page {
  /* შაბლონში ის `.hero__inner` flex-რიგის შიგნითაა — მთელი სიგანე დაიკავოს */
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  margin-top: 0;
  padding-block: 28px 64px;
}

/* გლობალური `.hero .container` (display:flex, max-width:1600px !important) აქ არ უნდა მოქმედებდეს */
body.page-club .club-page > .container {
  display: block !important;
  width: 100% !important;
  max-width: 1240px !important;
  margin: 0 auto !important;
  padding: 0 20px !important;
}

.club-page h1,
.club-page h2 {
  margin: 0;
}

/* ---------- Logo (fallback-ით) ---------- */
.cp-logo {
  --size: 32px;
  position: relative;
  flex: 0 0 var(--size);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2f7;
  overflow: hidden;
}
.cp-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.cp-logo__fallback {
  font-family: var(--ff-heading);
  font-size: calc(var(--size) * .42);
  line-height: 1;
  color: var(--cp-muted);
}
.cp-logo--sm { --size: 24px; }
.cp-logo--md { --size: 44px; }
.cp-logo--xl {
  --size: 104px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .12), 0 12px 32px rgba(0, 0, 0, .35);
}
.cp-logo--xl img { padding: 10px; }

/* ---------- Hero ---------- */
.cp-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 28px;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(0, 212, 255, .22) 0%, transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(21, 175, 68, .18) 0%, transparent 55%),
    linear-gradient(135deg, var(--cp-navy) 0%, var(--cp-navy-2) 100%);
  overflow: hidden;
  isolation: isolate;
}
.cp-hero::after {
  /* მოედნის ხაზები ფონზე */
  content: "";
  position: absolute;
  right: -120px;
  top: 50%;
  width: 360px;
  height: 360px;
  border: 2px solid rgba(255, 255, 255, .06);
  border-radius: 50%;
  transform: translateY(-50%);
  z-index: -1;
}

.cp-hero__club {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.cp-hero__titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cp-eyebrow {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cp-teal);
  font-weight: 500;
}
.cp-hero__name {
  font-family: var(--ff-heading);
  font-weight: 400;
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.1;
  color: #fff;
  overflow-wrap: break-word;
}
.cp-hero__rank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #dbe7f5;
}
.cp-hero__rank i { color: #f5c542; }

.cp-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.cp-stat {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
}
.cp-stat dt {
  font-size: 12px;
  color: #a8b2d1;
  margin-bottom: 4px;
}
.cp-stat dd {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cp-stat dd small {
  font-size: 16px;
  font-weight: 400;
  color: #7f8fb0;
  margin-inline: 2px;
}
.cp-stat--accent {
  background: linear-gradient(135deg, rgba(0, 212, 255, .22), rgba(0, 255, 136, .14));
  border-color: rgba(0, 212, 255, .35);
}

/* შემდეგი მატჩი */
.cp-next {
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  color: var(--cp-ink);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
.cp-next__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}
.cp-next .cp-eyebrow { color: var(--cp-green); }
.cp-next__date {
  font-size: 13px;
  color: var(--cp-muted);
}
.cp-next__teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.cp-next__team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
}
.cp-next__team span:last-child { overflow-wrap: break-word; }
.cp-next__time {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--cp-navy);
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cp-next__venue {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--cp-line);
  font-size: 13px;
  color: var(--cp-muted);
  text-align: center;
}
.cp-next__venue i { color: var(--cp-red); margin-right: 4px; }

@media (min-width: 900px) {
  .cp-hero {
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas:
      "club next"
      "stats next";
    padding: 36px;
    column-gap: 36px;
  }
  .cp-hero__club { grid-area: club; }
  .cp-stats { grid-area: stats; align-self: end; }
  .cp-next { grid-area: next; align-self: center; }
}

/* ---------- Layout ---------- */
.cp-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 24px;
}
.cp-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
@media (min-width: 1024px) {
  .cp-layout { grid-template-columns: minmax(0, 1fr) 420px; }
  .cp-standings { position: sticky; top: 20px; }
}

/* ---------- Card ---------- */
.cp-card {
  background: var(--cp-surface);
  border: 1px solid var(--cp-line);
  border-radius: var(--cp-radius);
  box-shadow: var(--cp-shadow);
  padding: 22px;
}
.cp-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.cp-card__title {
  font-family: var(--ff-heading);
  font-weight: 400;
  font-size: 19px;
  color: var(--cp-ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cp-card__title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(var(--cp-teal), var(--cp-green));
}
.cp-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--cp-muted);
}
.cp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #0b7fa8;
  white-space: nowrap;
  padding: 6px 10px;
  margin: -6px -10px;
  border-radius: 8px;
  transition: background-color .15s, color .15s;
}
.cp-link i { font-size: 12px; transition: transform .15s; }
.cp-link:hover { background: #e8f8fd; color: #075f7e; }
.cp-link:hover i { transform: translateX(3px); }

/* ---------- About ---------- */
.cp-about {
  display: grid;
  gap: 20px;
  padding: 0;
  overflow: hidden;
}
.cp-about__photo {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #e9edf3;
  overflow: hidden;
}
.cp-about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.cp-about__photo:hover img { transform: scale(1.03); }
.cp-about__zoom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 25, 47, .7);
  color: #fff;
  backdrop-filter: blur(6px);
  font-size: 14px;
}
.cp-about__text {
  padding: 0 22px 22px;
  color: #334155;
  line-height: 1.7;
}
.cp-about__text:first-child { padding-top: 22px; }
.cp-about__text p + p { margin-top: .8em; }

/* ---------- Gallery ---------- */
.cp-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.cp-gallery__item {
  display: block;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #e9edf3;
}
.cp-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.cp-gallery__item:hover img { transform: scale(1.06); }

/* ---------- Matches ---------- */
.cp-matches {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.cp-match {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-areas:
    "date teams"
    "date venue";
  column-gap: 16px;
  row-gap: 6px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--cp-line);
  border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.cp-match:hover {
  border-color: #cfe9f3;
  box-shadow: 0 6px 18px rgba(15, 27, 45, .06);
}
.cp-match__date {
  grid-area: date;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  padding: 8px 4px;
  border-radius: 12px;
  background: #f1f5f9;
  text-align: center;
  line-height: 1.15;
}
.cp-match__day {
  font-size: 22px;
  font-weight: 700;
  color: var(--cp-ink);
}
.cp-match__month {
  font-size: 11px;
  color: var(--cp-ink);
}
.cp-match__weekday {
  font-size: 10px;
  color: var(--cp-muted);
  margin-top: 2px;
}
.cp-match__teams {
  grid-area: teams;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.cp-match__team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 500;
}
.cp-match__team--home { justify-content: flex-end; text-align: right; }
.cp-match__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-match__time {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--cp-navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cp-match__venue {
  grid-area: venue;
  font-size: 13px;
  color: var(--cp-muted);
  text-align: center;
}
.cp-match__venue i { color: var(--cp-red); margin-right: 4px; }

@media (max-width: 560px) {
  .cp-match {
    grid-template-columns: 1fr;
    grid-template-areas: "date" "teams" "venue";
    row-gap: 12px;
    padding: 14px;
  }
  .cp-match__date {
    flex-direction: row;
    gap: 6px;
    padding: 6px 10px;
    align-items: baseline;
  }
  .cp-match__day { font-size: 15px; }
  .cp-match__month, .cp-match__weekday { font-size: 13px; margin: 0; }
  .cp-match__weekday::before { content: "· "; }
  .cp-match__team { flex-direction: column; gap: 6px; text-align: center; }
  .cp-match__team--home { flex-direction: column-reverse; }
  .cp-match__name { white-space: normal; font-size: 14px; }
}

.cp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 16px;
  border: 1px dashed var(--cp-line);
  border-radius: 14px;
  color: var(--cp-muted);
  text-align: center;
}
.cp-empty i { font-size: 26px; opacity: .6; }

/* ---------- Standings ---------- */
.cp-standings { padding: 22px 0 10px; }
.cp-standings .cp-card__head { padding-inline: 22px; }
.cp-table-wrap { overflow-x: auto; }
.cp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.cp-table th {
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--cp-muted);
  text-align: center;
  border-bottom: 1px solid var(--cp-line);
}
.cp-table td {
  padding: 9px 6px;
  text-align: center;
  color: #475569;
  border-bottom: 1px solid #f1f4f8;
}
.cp-table tbody tr {
  cursor: pointer;
  transition: background-color .12s;
}
.cp-table tbody tr:hover { background: #f7f9fc; }
.cp-table tbody tr:last-child td { border-bottom: 0; }
.cp-table__pos { width: 44px; padding-left: 18px !important; }
.cp-table__team { text-align: left !important; }
.cp-table__team a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cp-ink);
  font-weight: 500;
  min-width: 0;
}
.cp-table__team a span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.cp-table__pts {
  font-weight: 700;
  color: var(--cp-ink) !important;
  padding-right: 18px !important;
}
.cp-pos {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #eef2f7;
  color: #475569;
}
.cp-pos.is-up { background: rgba(21, 175, 68, .14); color: #0f8a35; }
.cp-pos.is-down { background: rgba(229, 72, 77, .12); color: #c4282d; }

.cp-table tr.is-current { background: linear-gradient(90deg, rgba(0, 212, 255, .14), rgba(0, 212, 255, .04)); }
.cp-table tr.is-current:hover { background: rgba(0, 212, 255, .16); }
.cp-table tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--cp-teal); }
.cp-table tr.is-current .cp-table__team a { font-weight: 700; }

@media (max-width: 420px) {
  .cp-table th:nth-child(5), .cp-table td:nth-child(5),
  .cp-table th:nth-child(6), .cp-table td:nth-child(6) { display: none; }
}

/* ---------- Mobile hero ---------- */
@media (max-width: 640px) {
  body.page-club main.club-page { padding-top: 16px; }
  .cp-hero { padding: 20px; border-radius: 20px; gap: 18px; }
  .cp-logo--xl { --size: 72px; }
  .cp-logo--xl img { padding: 6px; }
  .cp-hero__club { gap: 14px; }
  .cp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cp-stat { padding: 10px 12px; }
  .cp-stat dd { font-size: 22px; }
  .cp-card { padding: 18px; border-radius: 16px; }
  .cp-card__title { font-size: 17px; }
  .cp-link { font-size: 13px; }
  .cp-standings { padding: 18px 0 6px; }
  .cp-standings .cp-card__head { padding-inline: 18px; }
  .cp-about__text { padding: 0 18px 18px; }
}

/* ---------- მცირე ეკრანები: ზედმეტი გადატანების მოშორება ---------- */
.cp-hero__rank { white-space: nowrap; }
.cp-next__head { flex-wrap: wrap; row-gap: 4px; }
.cp-card__head { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 640px) {
  .cp-hero__rank { font-size: 12px; padding: 4px 10px; }
  .cp-hero__name { font-size: 26px; }
  .cp-next__head { flex-direction: column; align-items: center; text-align: center; }
  .cp-next__team { font-size: 13px; }
}

/* ---------- ცხრილის ზონები (ფერები ადმინიდან, cms_table_zones) ---------- */
.cp-pos.is-zone { font-weight: 700; }
.cp-zones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  list-style: none;
  margin: 8px 0 0;
  padding: 14px 22px 8px;
  border-top: 1px solid var(--cp-line);
  font-size: 12px;
  color: var(--cp-muted);
}
.cp-zones li { display: inline-flex; align-items: center; gap: 6px; }
.cp-zones__dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.cp-zones__range { font-weight: 600; color: var(--cp-ink); }

/* ---------- თეთრი (გამჭვირვალე) ლოგოები — მუქი ფონი (JS ამატებს .is-light-ს) ---------- */
.cp-logo.is-light img,
.cp-logo.is-light { background: var(--cp-navy); }
.cp-logo.is-light .cp-logo__fallback { visibility: hidden; }
