:root {
    --navy: #0f1b2d;
    --navy-light: #1a2d45;
    --amber: #e8a020;
    --amber-dark: #c9860f;
    --bg: #f5f6f8;
    --card: #ffffff;
    --border: #e2e5ea;
    --ink: #1f2937;
    --muted: #888888;
    --label: #555555;
    --ok: #15803d;
    --ok-bg: #e7f7ed;
    --warn: #7a5500;
    --warn-bg: #fff3d8;
    --danger: #b91c1c;
    --danger-bg: #fcebeb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

h1, h2, h3 {
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 0.75rem;
}

h1 { font-size: 1.55rem; }
h2 { font-size: 1.1rem; }

p { line-height: 1.5; }

a { color: var(--navy); }

.wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

.wrap-wide { max-width: 1280px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.6rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(15, 27, 45, 0.04);
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.admin-grid .card {
    margin-bottom: 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.admin-grid .card.full { grid-column: 1 / -1; }

@media (max-width: 720px) {
    .admin-grid { grid-template-columns: 1fr; }
}

.table-scroll { overflow-x: auto; }

nav.topbar {
    background: var(--navy);
    color: #fff;
    padding: 0.9rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav.topbar strong { letter-spacing: 0.2px; }
nav.topbar strong span { color: var(--amber); }

nav.topbar a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    margin-left: 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.15s;
}

nav.topbar a:hover { color: #fff; }

label { display: block; margin: 0.85rem 0 0.3rem; font-weight: 600; font-size: 0.82rem; color: var(--label); }

input[type=text], input[type=password], input[type=email], input[type=date], select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus { border-color: var(--navy); }

button, .btn {
    display: inline-block;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 0.65rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    margin-top: 1rem;
    transition: background 0.15s;
}

button:hover, .btn:hover { background: var(--navy-light); }

.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #991b1b; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}
.badge.pending  { background: var(--warn-bg); color: var(--warn); }
.badge.approved { background: var(--ok-bg); color: var(--ok); }
.badge.rejected { background: var(--danger-bg); color: var(--danger); }
.badge.none     { background: #eceef1; color: var(--muted); }

.grid-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
}
.grid-photos figure {
    margin: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 27, 45, 0.04);
}
.grid-photos img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; }
.grid-photos figcaption { padding: 0.6rem; text-align: center; }
.grid-photos .btn { margin-top: 0; padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.grid-photos .photo-name {
    display: none; /* skjult i fliser-visning — for meget uro i et billedgitter; vises i liste-visning */
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.grid-photos.list-view .photo-name { display: block; }

.grid-photos.list-view {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.grid-photos.list-view figure {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem;
}
.grid-photos.list-view img { width: 90px; height: 90px; flex-shrink: 0; }
.grid-photos.list-view figcaption {
    padding: 0;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    gap: 1rem;
}
.grid-photos.list-view .photo-name { flex: 1; min-width: 0; margin: 0; }
.grid-photos.list-view .btn { flex-shrink: 0; }

/* ---- Likes / kommentarer ------------------------------------------- */

.photo-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.grid-photos.list-view .photo-meta { justify-content: flex-start; flex-shrink: 0; margin-bottom: 0; }

.like-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--muted);
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.like-btn:hover { color: var(--danger); }
.like-btn.liked { color: var(--danger); font-weight: 700; }

.comment-open {
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.comment-open:hover { color: var(--navy); }

.photo-modal[hidden] { display: none; }
.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 27, 45, 0.75);
}
.photo-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.photo-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 27, 45, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.photo-modal-close:hover { background: rgba(15, 27, 45, 0.85); }
.photo-modal-image {
    flex: 1.4;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.photo-modal-image img { max-width: 100%; max-height: 90vh; display: block; }
.photo-modal-side {
    flex: 1;
    min-width: 260px;
    max-width: 340px;
    padding: 3.25rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.photo-modal-side h3 { font-size: 0.95rem; margin: 1rem 0 0.6rem; }

.modal-delete-photo-btn {
    width: 100%;
    margin-top: 1rem;
    font-size: 0.82rem;
}

#modalLikeBtn {
    align-self: flex-start;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
}
#modalLikeBtn.liked { color: var(--danger); border-color: var(--danger); }

.modal-comments {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}
.modal-comments-empty { color: var(--muted); font-size: 0.85rem; }
.comment {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.comment-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.comment-author { font-weight: 700; color: var(--navy); }
.comment-body { color: var(--ink); white-space: pre-wrap; word-break: break-word; padding-left: 2.1rem; }

.avatar-img-small, .avatar-placeholder-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}
.avatar-placeholder-small {
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.avatar-preview { margin-bottom: 1rem; }
.avatar-img-large, .avatar-placeholder-large {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}
.avatar-placeholder-large {
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
}
.comment-delete {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.75rem;
    padding: 0;
    margin-top: 0.2rem;
    cursor: pointer;
}

.modal-comment-form textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem 0.7rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
}
.modal-comment-form button { margin-top: 0.5rem; width: 100%; }

@media (max-width: 640px) {
    .photo-modal-content { flex-direction: column; max-height: 95vh; }
    .photo-modal-image { max-height: 40vh; }
    .photo-modal-side { max-width: none; }
}

.gallery-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.gallery-toolbar form { display: flex; align-items: center; gap: 0.5rem; }
.gallery-toolbar label { margin: 0; }
.gallery-toolbar select { width: auto; padding: 0.45rem 0.6rem; }

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.view-toggle-btn {
    margin: 0;
    background: #fff;
    color: var(--label);
    border: none;
    border-radius: 0;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--border); }
.view-toggle-btn[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* ---- Sprogvalg (DA/EN) ------------------------------------------- */

.lang-switch {
    font-size: 0.78rem;
    margin-left: 1.25rem;
    white-space: nowrap;
}
.lang-switch a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-weight: 600;
}
.lang-switch a.active { color: #fff; }
.lang-switch a:hover { color: #fff; }
.lang-switch .sep { color: rgba(255, 255, 255, 0.3); margin: 0 0.25rem; }

.lang-switch-light {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
}
.lang-switch-light a { color: var(--muted); text-decoration: none; font-weight: 600; }
.lang-switch-light a.active { color: var(--navy); }
.lang-switch-light .sep { color: var(--border); margin: 0 0.3rem; }

.error   { background: var(--danger-bg); color: var(--danger); font-weight: 500; padding: 0.6rem 0.85rem; border-radius: 8px; }
.success { background: var(--ok-bg); color: var(--ok); font-weight: 500; padding: 0.6rem 0.85rem; border-radius: 8px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--label); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

code {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    word-break: break-all;
}

ul { margin: 0.5rem 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }

/* ---- Auth pages (login / register) ------------------------------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.auth-card .logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}
.auth-card .logo span { color: var(--amber); }

.auth-card .subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 28px;
    line-height: 1.5;
}

.auth-card label:first-of-type { margin-top: 0; }

.auth-card input {
    margin-bottom: 4px;
}

.auth-card button[type=submit] {
    width: 100%;
    margin-top: 20px;
    padding: 0.75rem;
}

.auth-switch {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    margin-top: 22px;
    margin-bottom: 0;
}
.auth-switch a { color: var(--navy); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.auth-hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 12px;
    text-align: center;
    line-height: 1.5;
}

.auth-back {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin-top: 16px;
}
.auth-back a { color: var(--navy); text-decoration: none; }

.timeout { background: var(--warn-bg); color: var(--warn); font-weight: 500; padding: 0.6rem 0.85rem; border-radius: 8px; }

nav.topbar .user-name {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-left: 1.25rem;
}

/* ---- App launcher (core dashboard) --------------------------------- */

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.app-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: border-color 0.15s;
    box-shadow: 0 1px 3px rgba(15, 27, 45, 0.04);
}
.app-card:hover { border-color: var(--navy); }
.app-card .app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: var(--bg);
}
.app-card .app-name { font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.app-card .app-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

.section-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 2rem 0 0.75rem;
}
.section-label:first-of-type { margin-top: 0; }

.secret-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9rem;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    word-break: break-all;
    margin-bottom: 0.75rem;
}
