/* ==========================================================================
   1. GLOBALE STILER OG INNSTILLINGER
   ========================================================================== */

/* Definisjon av fargevariabler */
:root {
    --farge-knapp: #66CCFF;
    --farge-knapp-hover: #50C878;
    --farge-knapp-kant: #2C8AD8;
}

/* Sideinnstillinger for utskrift */
@page {
  size: landscape;
  margin: 0.5cm;
}

/* Global box-sizing for enklere layout-beregninger */
* {
  box-sizing: border-box;
}

/* ==========================================================================
   2. HOVEDLAYOUT (HEADER OG FOOTER)
   ========================================================================== */

/* --- Header / Logo --- */
table.logo {
  width: 100%;
  margin-bottom: 1em;
  border: none;
}

table.logo td {
  border: none;
  vertical-align: middle;
}

img.kampark-logo {
  height: 80px;
  width: auto;
}

.logo .symbol {
  width: 75%;
  color: #1F68A5;
}

.logo .bane {
  width: 25%;
  text-align: left;
  font-size: 24px;
  font-weight: bold;
  color: #1F68A5;
}

/* --- Footer --- */
table.footer {
  width: 100%;
  margin-top: 1em;
  border: none;
}

td.footer {
  border: none;
  text-align: center;
  background-color: #66CCFF;
  color: #6c757d;
  padding: 0px;
  font-size: 14px;
}

/* ==========================================================================
   3. KOMPONENTER (TABELLER, KNAPPER, LENKER)
   ========================================================================== */

/* --- Knapper --- */
.restart-button {
    background-color: var(--farge-knapp);
    color: #000000;
    font-weight: bold;
    border: 5px solid var(--farge-knapp-kant);
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 16px;
    padding: 10px 20px;
    white-space: nowrap;
}

.restart-button:hover {
    background-color: var(--farge-knapp-hover);
}

.restart-cell {
    text-align: center;
    vertical-align: middle;
}

/* --- Hovedtabell (Kampark) --- */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 5px 0;
}

table.kampark {
  width: 100%;
  border-collapse: collapse;  
}

/* Generell stil for alle celler */
.kampark th,
.kampark td {
  border: 1px solid black;
  padding: 10px 1px;
  text-align: center;
  vertical-align: middle;
}

/* Tabelloverskrifter */
th.kampark {
  height: 35px;
  padding: 1px;
  font-size: 28px;
  background-color: #66CCFF;
  border: none;
}

th.kastnavn {
  width: 200px;
  font-size: 13px;
  background-color: #FFFFFF;
  text-align: left;
  padding-left: 5px;
}

/* Navnecelle (konsolidert regel) */
td.navn {
  width: 200px;
  font-size: 13px;
  background-color: #FFFFFF;
  text-align: left;
  padding: 0; /* Overstyres for å la lenken fylle cellen */
  vertical-align: middle;
}

/* Poeng- og kastceller */
.kast, .runde { width: 30px; }
.kast, .treff { font-size: 18px; }
.treff { background-color: #FFFFFF; }
.treff_2kast, .kast2, .treff-spesial { background-color: #FF7F7F; }

/* Summeringsceller */
.kastsum {
  font-size: 14px;  
  font-weight: bold;
  background-color: #DDDDDD;
}
.sum15kast {
  width: 45px;
  background-color: #DDDDDD;
  font-weight: bold;
  font-size: 24px;
}
.sum30kast {
  width: 60px;
  background-color: #DDDDDD;
  font-weight: bold;
  font-size: 24px;
}
.sum-total {
  width: 100px;
  background-color: #D6EADF;
  font-size: 18px;
  padding: 10px 2px;
}
.sum-total hr {
  border: none;
  border-top: 1px solid #999;
  margin: 14px 0;
}

/* Tabellfot */
.kampark tfoot th {
  font-weight: bold;
  background-color: #f2f2f2;
}

/* --- Lenker inne i tabellen --- */
.rediger-navn-lenke,
.rediger-treff-lenke {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    box-sizing: border-box;
}

.rediger-navn-lenke {
    padding: 10px 5px;
}

.rediger-treff-lenke {
    padding: 10px 1px;
}

.rediger-navn-lenke:hover,
.rediger-treff-lenke:hover {
    background-color: #e0e0e0;
    cursor: pointer;
}

/* ==========================================================================
   4. HJELPEKLASSER (UTILITY CLASSES)
   ========================================================================== */

/* Fjerner padding, slik at et barne-element (f.eks. en lenke) kan styre det. */
.uten-padding {
    padding: 0 !important;
}

/* ==========================================================================
   5. RESPONSIVE REGLER OG UTSKRIFT
   ========================================================================== */

/* --- For nettbrett og mindre skjermer --- */
@media (max-width: 1024px) {
  .kampark th,
  .kampark td {
    padding: 0;
  }
  
  th.kastnavn,
  td.navn {
    width: 120px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .sum15kast { width: 35px; font-size: 18px; }
  .sum30kast { width: 50px; font-size: 18px; }
  .sum-total { width: 85px; font-size: 18px; }
}

/* --- For utskrift --- */
@media print {
  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
  }
  body {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .kampark th,
  .kampark td {
    padding: 10px 0px !important;
  }
}