:root {
  --foreground: white;
  --background: #ba1918;
}

@media (prefers-color-scheme: dark) {
  :root {
    --foreground: #111;       /* Mörk textfärg */
    --background: #f04545;    /* Ljusare röd nyans för kontrast */
  }
}

/* Grundstil */
html {
    /* overflow: hidden; Ta bort denna rad */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--foreground);
    color: black;
    margin: 0;
    overflow-y: auto; /* Tillåt vertikal skrollning */
}
p {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* Header - alltid synlig högst upp */
header {
    background-color: var(--background);
    color: var(--foreground);
    padding: 15px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Navigationsmeny */
nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 10px 0;
    flex-wrap: wrap;
}

nav ul li {
    margin: 5px 15px;
}

nav ul li button {
    background-color: var(--foreground);
    color: var(--background);
    border: 2px solid var(--background);
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, color 0.3s;
    var(--foreground)-space: nowrap;
    min-width: 120px;
    box-sizing: border-box;
}

nav ul li button:hover,
nav ul li button:focus {
    background-color: var(--background);
    color: var(--foreground);
    outline: none;
}
.nav-link{
  display:inline-block;
  background:var(--primary, var(--background));
  color:#fff;
  text-decoration:none;
  font-weight: 600;
  padding:.6rem 1.2rem;
  border-radius: 4px;
  transition:transform .1s ease;
} 
.nav-link:hover,.nav-link:focus{transform:translateY(-2px);}
.nav-link.active{background:var(--accent, #821213);}

.admin-icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  padding: 4px;
  border-radius: 4px;
  color: var(--foreground);
  transition: background 0.2s, color 0.2s;
  line-height: 0;
  vertical-align: middle;
  cursor: pointer;
}

.admin-icon-link:hover {
  background: var(--background);
  color: var(--foreground);
}

.admin-icon-link .tooltip-text {
  visibility: hidden;
  background-color: #333;
  color: #fff;
  text-align: center;
  font-size: 0.75rem;
  padding: 5px 8px;
  border-radius: 4px;
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  var(--foreground)-space: nowrap;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.admin-icon-link:hover .tooltip-text,
.admin-icon-link:focus .tooltip-text,
.admin-icon-link:active .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--foreground);
    font-size: 2em;
    padding: 10px;
    cursor: pointer;
}

.nav-list {
    transition: transform 0.3s ease-in-out;
}
/* Huvudinnehåll - tar all ledig plats */
main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    overflow-y: auto;
}

/* Wrapper för alla artiklar */
.articles-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 20px;
    width: 600px;
    min-height: 400px;
}

/* Sectionstil */
section {
    background: var(--foreground);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

section h1 {
    color: var(--background);
}

section .date {
    font-size: 0.9em;
    color: gray;
}

/* Första paragrafen i varje artikel blir fetstilad */
section p:nth-of-type(2) {
    font-weight: bold;
}

/* Bild och beskrivning */
img {
    width: 100%;
    border-radius: 5px;
}

figcaption {
    font-style: italic;
    text-align: center;
    color: gray;
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Sidofält (Aside) */
aside {
    display: flex;
    flex-direction: column;
    width: 250px;
    border-radius: 10px;
    overflow: hidden;
    color: var(--foreground);
    padding: 20px;
}

.header_red {
    color: var(--background);
}

/* Vit toppdel för loggan */
.logo-container {
    background-color: var(--foreground);
    padding-bottom: 40px;
    display: flex;
    justify-content: center;
}

/* Röd bakgrund startar under loggan */
.aside-content {
    flex-grow: 1;
    background-color: var(--background);
    color: var(--foreground);
    padding: 20px;
    border-radius: 10px;
}

h2 {
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: bold;
    border-bottom: 2px solid var(--foreground);
    padding-bottom: 5px;
}

.news-item {
    margin-bottom: 15px;
}

.date {
    font-size: 0.9em;
    color: lightgray;
}

.headline {
    font-size: 1.1em;
    margin-top: -5px;
    font-weight: bold;
}

/* Footer - alltid längst ner */
footer {
    text-align: center;
    padding: 15px;
    background-color: var(--background);
    color: var(--foreground);
    position: sticky;
    bottom: 0;
    z-index: 1000;
}

.loading {
    padding: 2rem;
    text-align: center;
    font-style: italic;
    color: #666;
}

.error {
    color: #dc3545;
    padding: 2rem;
    border: 1px solid #dc3545;
    margin: 2rem;
}
/* Ta bort focus-ring på container om du inte vill se den */
#content-container:focus { outline: none; }
/* ev. även om klassen används */
.articles-container:focus { outline: none; }

/* Responsivt (mobilvänligt) */
@media (max-width: 768px) {
    .sidebar-left       { order: 2; }
    #content-container  { order: 1; }
    .sidebar-right      { order: 3; }

    .hamburger {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
    }

    .nav-list {
        position: fixed;
        top: 70px;
        right: -100%;
        background: var(--background);
        width: 80%;
        max-width: 300px;
        flex-direction: column;
        padding: 20px 0;
        transition: right 0.3s ease-in-out;
        z-index: 1000;
    }

    .nav-list.active {
        right: 0;
    }

    .nav-list li {
        margin: 0;
        width: 100%;
    }

    .nav-list li button {
        width: 100%;
        border-radius: 0;
        border: none;
        background: var(--foreground);
        text-align: left;
        padding: 12px 20px;
    }

    main {
        flex-direction: column;
        align-items: center;
    }
    aside {
        width: 100%;
        text-align: center;
    }
    aside, .articles-container {
        width: 100%;
    }
    nav ul {
        flex-direction: column;
        width: 100%;
        padding: 0;
    }

    nav ul li {
        margin: 5px 0px;
        width: 100%;
    }

    nav ul li button {
        width: 90%;
        padding: 12px;
    }
    header {
        padding-bottom: 50px;
    }
    h1 {
        font-size: 1.5em;
    }
}
