/* ========== GLOBAL RESETS ========== */
body, h1, h2, h3, p, ul, li {
    margin: 0;
    padding: 0;
}

/* ========== TEXT STYLES ========== */
h1 {
    font-size: 50px;
    color: #000000; /* Keeping 500.html h1 color */
}

h2 {
    margin: 30px 10px 10px 10px; /* Adjust margins */
}

p {
    font-size: 20px; /* Keeping 500.html p styling */
}

/* ========== BODY ========== */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
    display: flex;
    text-align: center; /* Kept from 500.html */
}

/* ========== HEADER ========== */
header {
    background-color: #0c686d;
    color: #fff;
    padding: 5px 0;
    text-align: center;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 80vw; /* Make it bigger relative to viewport */
    min-width: 600px; /* Ensure it’s never too small */
    margin: 50px auto; /* Center it properly */
    padding: 20px; /* Add better spacing */
    max-height: none; /* Remove unnecessary height restriction */
    clear: both;
    overflow-x: auto;
    z-index: 0;
    border: 2px solid #ccc;
    border-radius: 10px;
}


/* ========== FOOTER ========== */
footer {
    background-color: #0c686d;
    color: #fff;
    text-align: center;
    padding: 10px 0;
    position: fixed;
    bottom: 0;
    width: 100%;
}

/* ========== NAVIGATION ========== */
nav {
    background-color: #516e6f;
    padding: 10px;
    text-align: center;
    width: 200px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
}


nav ul li a {
        font-size: 20px;
        font-weight: bold;
        padding: 10px;
    }

/* Push main content to the right */
main {
    margin-left: 200px; /* SAME width as navbar */
    padding: 10px;
}

/* ======== MOBILE FIX ======== */
@media (max-width: 768px) {
    nav {
        width: 100%;
        height: 60px;
        position: fixed;
        top: 0;
        left: 0;
        flex-direction: row; /* Items in one line */
        justify-content: space-around;
        align-items: center;
        padding: 0;
        z-index: 1000;
    }

    nav ul {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    nav ul li {
        display: inline-block;
        margin: 0;
        padding: 10px;
    }

    nav ul li a {
        font-size: 20px;
        font-weight: bold;
        padding: 10px;
    }

    /* Main content should not be hidden */
    main {
        margin-left: 0;
        margin-top: 70px; /* Push content down */
    }
}

/* ========== ALERT STYLES ========== */
.alert {
    padding: 15px;
    margin-top: 80px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    position: relative;
    z-index: 9999;
}

.alert-success {
    color: #3c763d;
    background-color: #dff0d8;
    border-color: #d6e9c6;
}

.alert-error {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}

/* ========== USER INFO ========== */
.logged-in-user {
    color: #000000;
    font-weight: bold;
    font-size: 125%;
}


/* ========== NYBORGER PAGE STYLES ========== */
.row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    flex: 1 1 50%;
    margin-right: 10px;
}

.form-group.tall-box input {
    height: 40px; /* For consistency with the height of taller fields */
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group input,
.form-group textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

.form-group.full-width {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-right: 0;
    width: 100%;
}

.large-box {
    height: 90px;
}

input[type="submit"] {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

input[type="submit"]:hover {
    background-color: #0056b3;
}


/* ========== VIEW TABLE PAGE STYLES ========== */
.table-container {
    display: flex;
    gap: 20px;
}

.left-panel {
    flex: 1;
}

.right-panel {
    flex: 1;
    margin-left: 20px;
}

.table-data {
    margin-bottom: 20px;
}

.record {
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    flex: 1 1 50%;
    margin-right: 10px;
}

.form-group.tall-box textarea,
.form-group.tall-box span {
    height: 8em;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group span,
.form-group input,
.form-group textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
}

.form-group input,
.form-group textarea {
    width: 100%;
}

.full-width {
    flex: 1;
    width: 100%;
}

.large-box {
    height: 90px;
    display: block;
    width: calc(100% - 10px);
}

.log-container {
    border: 1px solid #ccc;
    height: 300px;
    overflow-y: scroll;
}

.log-textarea {
    width: 100%;
    height: 300px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
}

.btn:hover {
    background-color: #0056b3;
}


/* ========== PAGINATION BUTTONS (VIEW TABLE) ========== */
.pagination-container {
    text-align: center;
    margin-top: 10px;
}

.pagination-container a {
    display: inline-block;
    padding: 10px 15px;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
}

.pagination-prev {
    background-color: red;
    margin-right: 10px;
}

.pagination-next {
    background-color: green;
}

.pagination-container a:hover {
    opacity: 0.8;
}

.pagination-dropdown {
    padding: 10px;
    font-size: 16px;
    margin-right: 10px;
}


/* ========== VIEW TABLES PAGE STYLES ========== */
.table-list {
    list-style-type: none;
    padding: 0;
}

.table-list-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.table-link {
    flex: 1;
    text-decoration: none;
    color: #007bff;
    font-size: 18px;
}

.table-link:hover {
    text-decoration: underline;
}

.tilladelser-btn {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tilladelser-btn:hover {
    background-color: #0056b3;
}

.permissions-dropdown {
    display: none;
    margin-top: 10px;
    margin-left: 15px;
}

.permissions-list {
    list-style: none;
    padding: 0;
}

.permissions-item {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.assign-box, .remove-box {
    width: 20px;
    height: 20px;
    border: 2px solid;
    display: inline-block;
    cursor: pointer;
    position: relative;
}

.assign-box {
    border-color: green;
}

.assign-checkbox:checked + .assign-box {
    background-color: green;
}

.remove-box {
    border-color: red;
}

.remove-checkbox:checked + .remove-box {
    background-color: red;
}


/* ========== LOGIN PAGE STYLES ========== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
}

input[type="text"],
input[type="password"] {
    width: 300px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.btn-primary {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #0056b3;
}

/* 🔥 Centering ONLY the login form */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh; /* Full screen height */
    width: 100vw;
}

/* ✨ Make sure this only applies to the login form */
.login-container form {
    width: 320px;  /* Adjust width as needed */
    padding: 20px;
    background: white;  /* Background color */
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);  /* Soft shadow */
    border-radius: 10px; /* Rounded corners */
}

/* 🏷️ Form Labels */
.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

/* 📥 Input Fields */
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
}

/* 🔘 Login Button */
button {
    width: 100%;
    padding: 10px;
    border: none;
    background-color: #007bff;
    color: white;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 10px;
}

button:hover {
    background-color: #0056b3;
}

/* ✅ Flash Messages (Success/Error Notices) */
.alert {
    width: 300px;
    padding: 10px;
    border-radius: 5px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-weight: bold;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}



/* ========== SIGNUP PAGE STYLES ========== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
}

input[type="text"],
input[type="password"] {
    width: 300px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.btn-primary {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #3c763d;
    background-color: #dff0d8;
    border-color: #d6e9c6;
}

.alert-error {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}


/* ========== UPLOAD PDF PAGE STYLES ========== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
}

input[type="file"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}

.btn-primary {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #0056b3;
}


/* ========== VIEW PDF PAGE STYLES ========== */
.pdf-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw; /* Full width */
    height: 90vh; /* 90% of screen height */
}

.pdf-viewer {
    width: 90vw; /* Take up 90% of the viewport width */
    height: 85vh; /* Take up 85% of the viewport height */
    border: 2px solid #ccc;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
}


/* === SIDEBAR OVERLAP FIX (paste at end) === */
:root {
  --nav-w: 200px;   /* must match nav width */
  --header-h: 60px; /* adjust if your header is taller/shorter */
}

/* Body shouldn't be flex when using fixed header/sidebar */
body { display: block !important; }

/* Keep all main content out from under the fixed header + sidebar */
main, .container, .table-container, .pdf-container {
  position: relative;
  margin-left: var(--nav-w) !important;   /* offset for sidebar */
  padding-top: calc(var(--header-h) + 10px) !important; /* offset for fixed header */
  z-index: 1;  /* above page bg, below alerts */
  box-sizing: border-box;
  max-width: calc(100vw - var(--nav-w) - 20px); /* optional: stay on-screen */
}

/* Make sure forms can wrap instead of pushing under the nav */
body:not(.old-layout) .row { 
    flex-wrap: wrap; 
}
body:not(.old-layout) .form-group { 
    min-width: 260px; 
}

/* Alerts should sit above everything */
.alert { z-index: 9999 !important; }

/* Mobile: sidebar becomes top bar -> remove left offset */
@media (max-width: 768px) {
  main, .container, .table-container, .pdf-container {
    margin-left: 0 !important;
    padding-top: 70px !important; /* height of mobile nav/header */
    max-width: 100vw;
  }
}


/* ===== Log editor (write box) ===== */
.right-panel {
  /* size/layout */
  width: 92vw;
  max-width: 700px;
  margin: 12px auto 16px;
  padding: 12px;

  /* look & feel */
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);

  /* touch ergonomics */
  touch-action: pan-y;           /* allow vertical scroll gestures inside */
  -ms-touch-action: pan-y;
}

/* If the editor contains inputs/textarea, make them stretch nicely */
.right-panel input[type="text"],
.right-panel textarea,
.right-panel .editor-field {
  width: 100%;
  min-height: 120px;             /* comfy typing area */
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  line-height: 1.4;
  font: inherit;
  box-sizing: border-box;
}

/* ===== Log reader (scrollable history) ===== */
.log-container {
  /* make it big and readable on phone, but not full-screen */
  max-height: 60vh;
  min-height: 40vh;
  width: 92vw;
  max-width: 700px;
  margin: 8px auto 16px;
  padding: 12px;

  /* enable inner scrolling on mobile */
  overflow: auto;
  -webkit-overflow-scrolling: touch;  /* momentum scroll on iOS */
  overscroll-behavior: contain;       /* keep scroll inside the box */
  touch-action: pan-y;                 /* one-finger vertical scroll */
  -ms-touch-action: pan-y;

  /* look & feel */
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;            /* long words/urls wont blow layout */
}

/* Make sure nothing inside blocks scrolling */
.log-container * {
  touch-action: pan-y;
}

/* ===== Mobile tweaks ===== */
@media (max-width: 600px) {
  .right-panel {
    width: 94vw;
    padding: 12px;
  }
  .log-container {
    width: 94vw;
    max-height: 70vh;   /* a bit taller on phones */
    min-height: 50vh;
    font-size: 0.95rem;
  }
}

/* ===== Desktop/wide screens ===== */
@media (min-width: 900px) {
  .right-panel,
  .log-container {
    max-width: 820px;   /* less tall rectangle, feels wider */
  }
}


/* ============================================
   Restore layout for the "Ny borger" form only
   (form has class="create-table-form")
   ============================================ */

.create-table-form .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.create-table-form .form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    flex: 1 1 50%;
    margin-right: 10px;
}

.create-table-form .form-group.tall-box input {
    height: 40px; /* same as old nyborger */
}

.create-table-form .form-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.create-table-form .form-group input,
.create-table-form .form-group textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

.create-table-form .form-group.full-width {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-right: 0;
    width: 100%;
}

.create-table-form .large-box {
    height: 90px;
}



/* ============================================
   Compact field sizes on /view_table
   ============================================ */

/* Make all normal textareas/spans in records compact */
.table-container .record .form-group textarea,
.table-container .record .form-group span {
    height: 2.4em;
    min-height: 2.4em;
    max-height: 2.4em;
    overflow-y: auto;          /* scroll if text wraps */
}

/* Keep KORT INFO big (assumes name or id contains "kort_info") */
.table-container .record textarea[name*="kort_info"],
.table-container .record textarea[id*="kort_info"] {
    height: 8em;
    min-height: 8em;
    max-height: none;
}

/* Do NOT touch the dedicated log boxes  they already have their own styling */

