/* Generel Styling & Farvevariabler */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --header-bg: #ffffff;
}

/* OPDATERET: Målretter <html> i stedet for <body> */
html.dark-theme body {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --border-color: #444;
    --primary-color: #64b5f6;
    --primary-hover: #2196f3;
    --header-bg: #1e1e1e;
}

/* Grundlæggende opsætning */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

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

/* Generel Link Styling -- NYT & OPDATERET */
a {
    color: var(--primary-color);
    text-decoration: none; /* Fjern underline som standard */
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline; /* Tilføj underline ved hover */
}


/* Header */
header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s, border-color 0.3s;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Specifik regel for at titel-link følger tekstfarven */
.site-title a {
    text-decoration: none;
    color: var(--text-color);
}
.site-title a:hover {
    text-decoration: none; /* Titel skal ikke have underline */
    color: var(--text-color);
}


.site-title h1 {
    margin: 0;
    font-size: 1.8rem;
}

.site-title p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.7;
}

#theme-switcher {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Forside - Opskriftsgitter */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.recipe-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-decoration: none; /* Opskriftskort skal ikke have underline */
}

.recipe-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.recipe-card-content {
    padding: 1rem;
}

.recipe-card-content h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
}

/* Enkelt Opskrift Side */
.recipe-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    /* margin-top: 2rem; */
}

.recipe-header img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.recipe-header h1 {
    margin-bottom: 0.5rem;
}

.recipe-header p {
    font-style: italic;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.recipe-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.recipe-content h2 {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.ingredients ul, .procedure ol {
    padding-left: 20px;
}

.ingredients li, .procedure li {
    margin-bottom: 0.5rem;
}

/* Billedgalleri (thumbnails) */
.photo-gallery {
    margin-top: 2rem;
}

.photo-gallery h2 {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.thumbnails a {
    display: block;
}
.thumbnails a:hover {
    text-decoration: none; /* Ingen underline på billed-links */
}

.thumbnails img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.thumbnails img:hover {
    border-color: var(--primary-color);
}

/* Lightbox */
#lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
}

#lightbox.active {
    display: flex;
}

#lightbox-img {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
}

#lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: #fff;
    cursor: pointer;
}

/* Admin sektion */
.admin-form {
    max-width: 700px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.admin-form .form-group {
    margin-bottom: 1rem;
}
.admin-form label {
    display: block;
    margin-bottom: 0.5rem;
}
.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-color);
    color: var(--text-color);
}
.admin-form textarea {
    min-height: 150px;
    resize: vertical;
}
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.2s;
}
.btn:hover {
    background: var(--primary-hover);
    color: #fff;
    text-decoration: none; /* Knapper skal aldrig have underline */
}
.error-msg {
    color: #d9534f;
    background: #f2dede;
    border: 1px solid #ebccd1;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .recipe-content {
        grid-template-columns: 1fr;
    }

    /* -- NYE REGLER TIL MOBIL -- */

    /* 1. Gør headeren 'statisk' på mobil, så den scroller med siden */
    header {
        position: static;
    }

    /* 2. Reducer den maksimale højde på hovedbilledet */
    .recipe-header img {
        max-height: 250px;
    }

    /* 3. Reducer padding på opskrifts-containeren for at give mere plads */
    .recipe-container {
        padding: 1.5rem 1rem;
        margin-top: 1rem;
    }
}