/* ============================================================
   1. NORMALIZE.CSS v8.0.1 | MIT License
   ============================================================ */

/* Alla webbläsare: Konsekvent radavstånd */
html { line-height: 1.15; }

/* iOS Safari: Förhindra font-storleksändring vid orientationsbyte */
html { -webkit-text-size-adjust: 100%; }

body { margin: 0; }

/* IE: Rendera main-elementet korrekt */
main { display: block; }

/* Chrome, Firefox, Safari: Korrigera font-storlek och marginal på h1 i section/article */
h1 { font-size: 2em; margin: 0.67em 0; }

/* Firefox: Korrekt box-sizing på hr */
/* Edge, IE: Visa overflow på hr */
hr { box-sizing: content-box; height: 0; overflow: visible; }

/* Alla webbläsare: Konsekvent font-arv och storlek i pre */
pre { font-family: monospace, monospace; font-size: 1em; }

/* IE 10: Ta bort grå bakgrund på aktiva länkar */
a { background-color: transparent; }

/* Chrome 57-: Ta bort undre kantlinje på abbr */
/* Edge, IE, Opera, Safari: Lägg till korrekt textdekoration */
abbr[title] { border-bottom: none; text-decoration: underline dotted; }

/* Chrome, Edge, Safari: Korrekt font-weight på bold-element */
b, strong { font-weight: bolder; }

/* Alla webbläsare: Konsekvent font-arv och storlek i kod-element */
code, kbd, samp { font-family: monospace, monospace; font-size: 1em; }

small { font-size: 80%; }

/* Alla webbläsare: Förhindra att sub/sup påverkar radavståndet */
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
sub { bottom: -0.25em; }
sup { top: -0.5em; }

/* IE 10: Ta bort kantlinje på bilder i länkar */
img { border-style: none; }

/* Alla webbläsare: Konsekvent font-arv, storlek och radavstånd i formulärelement */
/* Firefox, Safari: Ta bort marginal */
button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0; }

/* IE: Visa overflow i button och input */
/* Edge: Visa overflow i input */
button, input { overflow: visible; }

/* Edge, Firefox, IE: Ta bort text-transform-arv */
button, select { text-transform: none; }

/* iOS Safari: Möjliggör styling av klickbara typer */
button, [type="button"], [type="reset"], [type="submit"] { -webkit-appearance: button; }

/* Firefox: Ta bort inre kantlinje och padding */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner { border-style: none; padding: 0; }

/* Firefox: Återställ fokusstilar som nollades ovan */
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring { outline: 1px dotted ButtonText; }

/* Firefox: Korrekt padding i fieldset */
fieldset { padding: 0.35em 0.75em 0.625em; }

/* Edge, IE: Korrekt textraderning i legend */
/* IE: Korrekt färgarv från fieldset */
/* Alla webbläsare: Ta bort padding */
legend { box-sizing: border-box; color: inherit; display: table; max-width: 100%; padding: 0; white-space: normal; }

/* Chrome, Firefox, Opera: Korrekt vertikal justering på progress */
progress { vertical-align: baseline; }

/* IE 10+: Ta bort standard vertikal scrollbar i textarea */
textarea { overflow: auto; }

/* IE 10: Korrekt box-sizing och ta bort padding för checkbox och radio */
[type="checkbox"], [type="radio"] { box-sizing: border-box; padding: 0; }

/* Chrome: Korrekt cursor på number-input spinners */
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button { height: auto; }

/* Chrome, Safari: Korrekt utseende och outline på search-input */
[type="search"] { -webkit-appearance: textfield; outline-offset: -2px; }

/* Chrome, Safari (macOS): Ta bort inner padding på search-decoration */
[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

/* iOS Safari: Möjliggör styling av file-upload-knapp */
/* Safari: Ärv font i file-upload-knapp */
::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; }

/* Edge, IE 10+, Firefox: Visa details som block */
details { display: block; }

/* Alla webbläsare: Visa summary som list-item */
summary { display: list-item; }

/* IE 10+: Dölj template-element */
template { display: none; }

[hidden] { display: none; }


/* ============================================================
   2. LAYOUT & GRUNDSTRUKTUR
   ============================================================ */

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.navbar-brand {
  display: block;
  padding: 0 0 .4rem 0;
  width: fit-content;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .4rem;
}

/* Kolumner – responsiva */
.col { flex: 1 1 100%; }
@media (min-width: 768px)  { .col { flex: 1 1 calc(50% - 1rem); } }
@media (min-width: 1024px) { .col { flex: 1 1 calc(25% - 1rem); } }


/* ============================================================
   3. FORMULÄR
   ============================================================ */

input[type="text"] {
  padding: 0.2rem; /* Ändrat från 0.5 */
  border: 1px solid #C83CC88A;
  border-radius: 4px;
  width: 98%;
}

input[type="image"] {
  width: 35px;
  height: auto;
  cursor: pointer;
}

.block-label {
  margin: .5rem 0 0.3rem 0;
  display: block;
  border-bottom: #C83CC83F solid 1px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid #C83CC83F;
  margin-top: -2.2rem;
}

/*.spinner { visibility: hidden; }
.spinner.active { visibility: visible; }*/
.spinner {
  visibility: hidden;
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #C83CC83F;
  border-top-color: darkmagenta;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.active { visibility: visible; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Formulärrubriker */
label.headinp, label.block-label {font-weight: bold; font-size: 0.9rem; }

/* Checkboxgrid – responsivt */
.table-grid { display: grid; grid-template-columns: 1fr; gap: 0.1rem; }
@media (min-width: 300px)  { .table-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px)  { .table-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .table-grid { grid-template-columns: repeat(4, 1fr); } }

span#searchcount {
  color: #8b3535;
  font-size: small;
}

/* ============================================================
   4. RESULTATTABELL
   ============================================================ */
.table-container {
  overflow-x: scroll;
  overflow-y: auto;
  width: 100%;
  height: 200px; /* Skrivs över av JS (adjustResultsHeight) */
}

table {
  border-collapse: collapse;
}

.table-container table {
  /*width: max-content; testar att ta bor för mindre horisontell scroll */
  min-width: 100%;
}

table, th, td { border: 1px solid #C83CC83F; }
table, th     { border-top: 0; } /* Undviker glitch vid scroll */

th, td {
  padding: .1rem;
  text-align: left;
  vertical-align: top;
}

th { cursor: pointer; font-size: small; }

/* Sticky thead och första kolumn */
thead {
  position: sticky;
  z-index: 2;
  top: 0;
  background: white;
}

td.sticky, th.sticky {
  z-index: 1;
  position: sticky;
  left: 0;
  background: white;
}

/* Kolumnbredder */
th:nth-child(2), td:nth-child(2) { max-width: 10rem; }  /* Församling */
th:nth-child(5), td:nth-child(5) { min-width: 5.3rem; } /* Datum */

/* Sökträff-markering */
.highlight { background-color: yellow; }

/* Varningsmeddelanden */
.warning {
  color: red;
  font-weight: bold;
  border-bottom: 1px solid #C83CC83F;
  border-right:  1px solid #C83CC83F;
  border-left:   1px solid #C83CC83F;
}


/* ============================================================
   5. SORTERING (dropdown-meny)
   ============================================================ */

.sortable-combined {
  position: relative;
  cursor: pointer;
}

.sort-menu-trigger {
  margin-left: -2px;
  font-size: 0.8em;
  user-select: none;
}

.sort-indicator {
  margin-left: -4px;
  font-size: .8em;
  color: #666666;
}

.sort-indicator {
  display: inline-block;
  margin-left: 0.4em;
}

.sort-menu {
  display: none;
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  min-width: 150px;
  padding: 5px 0;
  left: 0;
}

.sort-menu div { padding: 5px 10px; cursor: pointer; }
.sort-menu div:hover { background-color: #f0f0f0; }


/* ============================================================
   6. DETALJMODAL
   ============================================================ */
.modal {
  display: none;
  position: fixed;
  z-index: 2;
  top: 5%;
  left: 2.5%;
  width: 95%;
  max-height: 80%;
  overflow: auto;
  background-color: white;
  border: 2px solid darkmagenta;
  border-radius: 7px;
  padding: 0.4em 1em;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .modal {
    left: 15%;
    width: 70%;
  }
}

@media (min-width: 1024px) {
  .modal {
    left: 25%;
    width: 50%;
  }
}

.modal-content {
  width: 100%;
  float: right;
  line-height: .8em;
  text-align: right;
}

.modal table {
  width: 100%;
}

.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  line-height: 18px;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
}

/* =====================================================
   RA- oc AD-länkar
   ===================================================== */
td a img {
  margin-bottom: -0.27rem;
}

form#searchForm {
  padding-bottom: 1rem;
  border-bottom: 1px solid #C83CC83F;
}

/* ============================================================
   7. NAVIGATION
   ============================================================ */

#sld-nav {
  display: flex;
  align-items: center;
  padding: .2rem 1rem;
  background: white;
  float: right;
}

.hamburger {
  display: none;
}

.menu {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: .2rem;
}

.menu li {
  position: relative;
  white-space: nowrap;
  font-weight: bold;
}

.menu a {
  text-decoration: none;
  display: block;
  line-height: normal;
  color: #333;
  background-color: #F0F0F0;
  padding: .1rem .2rem;
}

.menu li a:hover {
  background-color: #C83CC8;
  color: white;
}

.has-submenu { position: relative; }
.has-submenu > a { display: flex; align-items: center; justify-content: space-between; }
.has-submenu > a svg { font-size: 12px; margin-left: 8px; transition: transform 0.3s ease; }

.has-submenu .submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  z-index: 100;
  min-width: 160px;
  background-color: #EEE;
  border: 1px solid #CCC;
}

.has-submenu:hover .submenu { display: block; }

.submenu li {
  position: static;
  font-weight: normal;
}

.submenu a {
  padding: .1rem .2rem;
  color: #333;
  background-color: #EEE;
}

.submenu a:hover {
  background-color: #C83CC8;
  color: white;
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
    cursor: pointer;
    margin-left: auto;
  }

  .menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 50px;
    right: 0;
    text-align: right;
    min-width: fit-content;
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 99;
  }

  .menu.show { display: flex; }

  .menu a {
    color: #333;
    background: #F0F0F0;
    text-align: right;
    padding: 10px 15px;
  }

  .menu a:hover {
    background: #C83CC8;
    color: white;
  }

  .has-submenu .submenu {
    display: none;
    position: static;
    margin-left: 10px;
    margin-right: 0;
  }

  .has-submenu.open .submenu {
    display: block;
    border-left: solid 2px #C83CC8;
  }

  .has-submenu.open > a svg { transform: rotate(90deg); }

  .submenu a {
    color: #333;
    background: #EEE;
    padding: 8px 15px;
    text-align: right;
  }

  .submenu a:hover {
    background: #C83CC8;
    color: white;
  }
}
/* SLUT 7. NAVIGATION */

/* Sökknapp mm */
.Xbtn-icon-only {
    background: none;      /* Tar bort grå bakgrund */
    border: none;          /* Tar bort ramen */
    padding: 5px;          /* Ger en lagom klickbar yta */
    cursor: pointer;       /* Gör att pekaren blir en hand */
    color: #666;           /* En diskret grå färg som standard */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.1s;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Vad som händer när man håller musen över */
.Xbtn-icon-only:hover {
    color: #d9534f;        /* Ikonen blir rödaktig vid hover */
    transform: scale(1.1); /* Den blir aningen större */
}

/* Vad som händer när man klickar */
.Xbtn-icon-only:active {
    transform: scale(0.95);
}
/* Behållaren som håller knapparna på rad */
.search-btn-container {
    display: inline-flex;
    align-items: center;
    gap: 6px; /* Avstånd mellan knapparna */
    vertical-align: middle;
}

/* Basstil för knapparna (osynliga ramar) */
.btn-icon-base {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

/* Storleksstyrning - Justera dessa för visuell balans */
.svg-reset {
    width: 24px;
    height: 24px;
    color: #888;
    transition: color 0.2s;
}

.svg-search {
    width: 30px; /* Luppen behöver vara lite större för att se lika stor ut */
    height: 30px;
    transition: all 0.2s;
}

.svg-swap {
    width: 30px;
    height: 30px;
    color: #666;
    transition: color 0.2s;
}

/* Hover-effekter */
.btn-icon-base:hover {
    transform: scale(1.1);
}

.btn-swap:hover .svg-swap {
    color: #0076c8; /* Växlingsikonen blir blå */
}

.btn-reset:hover .svg-reset {
    color: #d9534f; /* Soptunnan blir röd */
}

.btn-submit:hover .rim {
    stroke: #0076c8; /* Luppens ram blir blå */
}

.btn-icon-base:active {
    transform: scale(0.95);
}


