/* =========================================================
   SCOREBORD v46 - clean (mini scorebord)
   ========================================================= */

/* ====== Basis reset ====== */
html, body{
  margin: 0;
  padding: 0;
  background: #fff;
}
ul { list-style: none; padding-left: 0; margin: 0; }
.muted { opacity: .6; }
.error { color: #c00; font-weight: 600; }

/* ====== Kleuren (C# schema) ====== */
:root{
  --bg:       #11774D;   /* donker groen */
  --mid:      #269B63;   /* licht groen */
  --accent:   #FFC225;   /* geel */
  --inactive: #373737; /* RGB(55,55,55) */
  --white:    #FFFFFF;
}

/* =========================================================
   Wrapper + frame
   ========================================================= */
.popup_main_area{
  width: 100%;
  background: transparent;
  padding: 0;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.popup_frame{
  background: var(--bg);
  padding: 10px;              /* rand */
  border-radius: 16px;
  display: inline-block;
  margin-top: 12px;
}

/* =========================================================
   Bord
   ========================================================= */
.popup_flex{
  /* maten (1 plek) */
  --title-h: 70px;
  --value-h: 120px;
  --bottom-h: 110px;

  width: min(94vw, 720px);
  display: flex;
  flex-wrap: nowrap;

  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
}

/* Kolommen verhouding 40/20/40 */
.popup_left,
.popup_right{
  flex: 2 1 0;
  min-width: 0;
  box-sizing: border-box;
}
.popup_middle{
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
}

/* elke kolom = verticale stack */
.popup_left, .popup_middle, .popup_right{
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* =========================================================
   Titelblokken (links/rechts)
   ========================================================= */
.popup_title{
  height: var(--title-h);
  background: var(--mid);
  box-sizing: border-box;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
}

/* 35 in hoek, kleur wisselt mee */
.popup_title h4{
  position: absolute;
  top: 8px;
  margin: 0;
  font-size: 22px;
  line-height: 1;
  white-space: nowrap;
  color: var(--white);
}
#left  .popup_title h4{ left: 10px; right: auto; }
#right .popup_title h4{ right: 10px; left: auto; }

/* club + speler gecentreerd */
.popup_title p{
  margin: 0;
  height: 100%;
  width: 100%;
  color: var(--white);
  text-align: center !important;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  gap: 3px;
  line-height: 1.1;
}

/* club: 1 regel met ... indien nodig */
.popup_title .val-thuis-club,
.popup_title .val-uit-club{
  display: block;
  font-size: 16px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* speler: liever zichtbaar blijven dan afkappen -> mag wrappen */
.popup_title .val-thuisspeler,
.popup_title .val-uitspeler{
  display: block;
  font-size: 16px;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

/* Actief: wit vlak + groene tekst (incl. 35) */
.is-active .popup_title{ background: var(--white); }
.is-active .popup_title h4,
.is-active .popup_title p{ color: var(--mid); }

/* =========================================================
   Scorevlak
   ========================================================= */
.popup_value{
  height: var(--value-h);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.popup_value h2{
  font-size: 44px;
  margin: 0;
  color: var(--inactive);
}

/* =========================================================
   Onderste stats links/rechts
   ========================================================= */
.popup_list_val{
  height: var(--bottom-h);
  background: var(--bg);
  border-top: 2px solid rgba(255,194,37,.85);
  box-sizing: border-box;

  display: flex;
  align-items: flex-start;
  padding-top: 4px;
}
.popup_list_val ul{ width: 100%; }
.popup_list_val ul li p{
  margin: 0;
  padding: 6px 15px;
  font-size: 16px;
  line-height: 1.2;
  color: var(--inactive);
}
.popup_left  .popup_list_val ul li p{ text-align: right; }
.popup_right .popup_list_val ul li p{ text-align: left; }

/* =========================================================
   Middenkolom
   ========================================================= */
.popup_middle{
  background: var(--mid);
  border-left: 2px solid rgba(255,194,37,.85);
  border-right: 2px solid rgba(255,194,37,.85);
  position: relative;
}
.popup_middle_title{
  height: calc(var(--title-h) + var(--value-h));
  border-bottom: 2px solid rgba(255,194,37,.85);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;

  padding: 10px 0;
  box-sizing: border-box;
  text-align: center;
}
.popup_middle_title h4{
  font-size: 16px;
  margin: 0;
  color: var(--white);
}
.popup_bottom_title{ margin-top: 18px; }
.popup_bottom_title h4{ margin: 0; color: var(--white); }
.popup_bottom_title h2{ font-size: 32px; margin: 0; color: var(--white); }

.popup_series{ margin-top: 10px; }
.popup_series h4{ font-size: 14px; margin: 0; color: var(--white); }
.popup_series h2{ font-size: 26px; margin: 0; color: var(--white); }

.popup_middle_list{
  height: var(--bottom-h);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.popup_middle_list ul li p{
  font-size: 16px;
  color: var(--white);
  padding: 6px 0;
  margin: 0;
  line-height: 1.2;
}

/* Live in het bord UIT */
.popup_middle .muted{ display: none !important; }

/* =========================================================
   Actieve kleur mapping obv thuiskleur (data-thuiskleur="g|w")
   ========================================================= */
#root[data-thuiskleur="g"] #left.is-active  .popup_value h2,
#root[data-thuiskleur="g"] #left.is-active  .popup_list_val ul li p{
  color: var(--accent);
}
#root[data-thuiskleur="g"] #right.is-active .popup_value h2,
#root[data-thuiskleur="g"] #right.is-active .popup_list_val ul li p{
  color: var(--white);
}

#root[data-thuiskleur="w"] #left.is-active  .popup_value h2,
#root[data-thuiskleur="w"] #left.is-active  .popup_list_val ul li p{
  color: var(--white);
}
#root[data-thuiskleur="w"] #right.is-active .popup_value h2,
#root[data-thuiskleur="w"] #right.is-active .popup_list_val ul li p{
  color: var(--accent);
}

/* =========================================================
   Bottom bar
   ========================================================= */
.bottom_bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-top:10px;
}

.uitslagen_col{
  flex: 1 1 0;
  color:#000;
  font-size:12px;
  line-height:1.2;
}
.uitslagen_col .u-row{
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.live_outside{
  flex: 0 0 auto;
  padding: 0 10px;
  color:#000;
}

/* Portrait: live boven, uitslagen onder elkaar in 1 kolom (JS vult links) */
@media (orientation: portrait) and (max-width: 520px){
  .popup_flex{ --title-h: 78px; --value-h: 110px; }

  .popup_title h4{ font-size: 24px; }
  .popup_title .val-thuisspeler,
  .popup_title .val-uitspeler{ font-size: 18px; }

  .bottom_bar{
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px 10px;
  }
  .live_outside{
    order: 1;
    text-align: center;
    font-size: 16px;
    line-height: 1.1;
    white-space: nowrap;
  }
  #uitslagenLeft{ order: 2; }
  #uitslagenRight{ order: 3; }
  .uitslagen_col{
    width: 100%;
    font-size: 14px;
    line-height: 1.15;
  }
  .u-row{
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Clubnaam niet meer laten clippen: anker bovenin i.p.v. exact centreren */
.popup_title p{
  justify-content: flex-start;  /* was center */
  padding-top: 6px;             /* club iets naar beneden */
  padding-bottom: 6px;          /* gegarandeerde onderruimte */
  box-sizing: border-box;
}

/* Clubregel iets ruimere line-height */
.popup_title .val-thuis-club,
.popup_title .val-uit-club{
  line-height: 1.3;
}

/* 1) Net iets meer titelhoogte (voorkomt clipping) */
.popup_flex{ --title-h: 74px; }   /* was 70 */

/* 2) Alleen horizontaal clippen, niet verticaal */
.popup_title{
  overflow-x: hidden;
  overflow-y: visible;
}

/* 3) Terug naar gecentreerd, maar met veilige line-height */
.popup_title p{
  justify-content: center;
  padding: 0;                 /* voorkomt rare offsets */
}

/* Zorg dat club + speler altijd beide zichtbaar zijn (ook in actief/wit) */
.popup_title p br{
  display: none;
}

.popup_title p .val-thuis-club,
.popup_title p .val-uit-club,
.popup_title p .val-thuisspeler,
.popup_title p .val-uitspeler{
  display: block;
}
.popup_flex{ --title-h: 74px; }  /* was 70 */

/*Hierboven lijkt het nu goed */
@media (orientation: portrait) and (max-width: 520px){

  /* ====== Basis maten in portrait ======
     - title-h hoger (3 regels header)
     - value-h +2px zodat gele lijn 2px zakt
     - bottom-h -2px zodat totale hoogte gelijk blijft
  */
  .popup_flex{
    --title-h: 92px;
    --value-h: 122px;   /* was 120 */
    --bottom-h: 108px;  /* was 110 */
  }

  /* ====== Header links/rechts: 35 / team / speler ====== */
  .popup_title{
    height: var(--title-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 10px;
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
  }

  /* temaken (35) op eigen regel */
  .popup_title h4{
    position: static !important;   /* weg met absolute corner regels */
    margin: 0;
    font-size: 22px;
    line-height: 1;
    white-space: nowrap;
  }

  /* br uit je HTML negeren zodat we volledige controle hebben */
  .popup_title p{ margin: 0; padding: 0; width: 100%; }
  .popup_title p br{ display: none; }

  /* Teamnaam: 1 regel met ellipsis */
  .popup_title .val-thuis-club,
  .popup_title .val-uit-club{
    display: block;
    font-size: 16px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Spelernaam: 1 regel met ellipsis */
  .popup_title .val-thuisspeler,
  .popup_title .val-uitspeler{
    display: block;
    font-size: 18px;
    line-height: 1.15; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Nooit letter-voor-letter breken */
  .popup_title p,
  .popup_title .val-thuis-club,
  .popup_title .val-uit-club,
  .popup_title .val-thuisspeler,
  .popup_title .val-uitspeler{
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
  }

  /* ====== Midden boven: hoogte forceren zodat gele lijn aansluit ====== */
  .popup_middle_title{
    height: calc(var(--title-h) + var(--value-h)) !important;
    border-bottom: 2px solid rgba(255,194,37,.85);
    padding: 10px 0;
    gap: 8px;
    justify-content: flex-start;
  }

  /* ====== Midden onder: labels links en op dezelfde hoogte als stats ====== */
  .popup_middle_list{
    height: var(--bottom-h);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 4px;        /* zelfde als .popup_list_val */
    box-sizing: border-box;
    text-align: left;
  }

  .popup_middle_list ul{ width: 100%; }

  .popup_middle_list ul li p{
    margin: 0;
    padding: 6px 12px 6px 12px;  /* iets meer naar links */
    font-size: 16px;
    line-height: 1.2;
    color: var(--white);
    text-align: left !important;
  }
}
