/* --- Fonter lastes asynkront via HTML for maksimal ytelse --- */

/*
==========================================
  CSS Variabler (Roter)
==========================================
*/
:root {
  /* Fonter */
  --font-body: 'Inter', sans-serif;
  --font-display: 'Playfair Display', serif;

  /* --- Fargepalett fra stilguide --- */
  /* Primærfarge: Vinrød */
  --color-vinrod: #6E0A2D;
  --color-vinrod-rgb: 110, 10, 45;
  --color-vinrod-dark: #520621;
  --color-vinrod-darker: #3D0417;
  --color-vinrod-60: #A86C81;
  --color-vinrod-30: #D4B5C0;
  --color-vinrod-10: #F1E7EB;

  /* Sekundærfarge: Stålgrå */
  --color-stalgra: #909090;
  --color-stalgra-rgb: 144, 144, 144;
  --color-stalgra-60: #BCBCBC;
  --color-stalgra-30: #DDDEDE;
  --color-stalgra-10: #F4F4F4;

  /* Kontrast- og aksentfarge: Gullbånd */
  --color-gullband: #F3B716;
  --color-gullband-rgb: 243, 183, 22;
  --color-gullband-dark: #D9A00F;
  --color-gullband-60: #F7D473;
  --color-gullband-30: #FBE9B9;
  --color-gullband-10: #FDF7E7;

  /* Mye hvitt */
  --color-pure-white: #FFFFFF;

  /* Bakoverkompatibilitet */
  --palette-deep-maroon: var(--color-vinrod);
  --palette-pastel-pink: var(--color-vinrod-10);
  --palette-charcoal-grey: #2B2B2E;
  --palette-cream-ivory: #FFFFFF;
  --palette-pure-white: #FFFFFF;

  /* --- Funksjonelle Variabler --- */
  --color-primary: var(--color-vinrod);
  --color-primary-dark: var(--color-vinrod-dark);
  --color-primary-darker: var(--color-vinrod-darker);
  --color-primary-hover: var(--color-vinrod-dark);

  --color-secondary: var(--color-stalgra);
  --color-accent: var(--color-gullband);
  --color-accent-hover: var(--color-gullband-dark);

  /* Bakgrunner: Mye hvitt og rene flater */
  --color-bg-body: #FFFFFF;
  --color-bg-surface: #FFFFFF;
  --color-bg-subtle: var(--color-stalgra-10);
  --color-bg-dark: #1F1F22;
  --color-bg-header: rgba(255, 255, 255, 0.96);

  /* Tekstfarger */
  --color-text-main: #212529;
  --color-text-muted: #646468;
  --color-text-light: #F4F4F4;
  --color-text-inverse: #FFFFFF;

  /* Kanter og linjer */
  --color-border: #E5E7EB;
  --color-border-dark: var(--color-stalgra-60);

  --color-error: #dc2626;
  --color-success: #16a34a;

  /* Skygger & Effekter */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition-base: all 0.2s ease-in-out;
}

/* --- Dark Mode Overrides (bevart og raffinert) --- */
[data-theme="dark"] {
  --color-primary: #C0325A;
  --color-primary-dark: #9E1A42;
  --color-primary-hover: #D84D74;

  --color-accent: var(--color-gullband);
  --color-accent-hover: var(--color-gullband-60);

  --color-bg-body: #18181B;
  --color-bg-surface: #27272A;
  --color-bg-subtle: #323236;
  --color-bg-dark: #121214;

  --color-text-main: #F4F4F5;
  --color-text-muted: #A1A1AA;
  --color-text-inverse: #FFFFFF;

  --color-border: #3F3F46;
  --color-border-dark: #52525B;

  --color-bg-white: #27272A;
  --color-bg-header: #18181B;

  --color-bg-input: #1F1F23;
}


/* Custom Scrollbar Styles */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-body);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 5px;
  border: 2px solid var(--color-bg-body);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) var(--color-bg-body);
}

/* --- Theme Helpers --- */
[data-theme="dark"] .logo-light-only {
  display: none !important;
}

[data-theme="light"] .logo-dark-only {
  display: none !important;
}

[data-theme="dark"] .logo-dark-only {
  display: block !important;
}

/* --- Quill Editor Dark Mode --- */
[data-theme="dark"] .ql-toolbar.ql-snow,
[data-theme="dark"] .ql-container.ql-snow {
  border-color: var(--color-border) !important;
  background-color: var(--color-bg-input) !important;
  color: var(--color-text-main) !important;
}

/* Force all icons to be themed in dark mode */
[data-theme="dark"] .ql-snow.ql-toolbar button .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-label .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-item .ql-stroke,
[data-theme="dark"] .ql-snow .ql-stroke {
  stroke: var(--color-text-main) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar button .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-label .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-item .ql-fill,
[data-theme="dark"] .ql-snow .ql-fill {
  fill: var(--color-text-main) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar button .ql-thin,
[data-theme="dark"] .ql-snow .ql-thin {
  stroke: var(--color-text-main) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker {
  color: var(--color-text-main) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-label {
  color: var(--color-text-main) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-options {
  background-color: var(--color-bg-surface) !important;
  border-color: var(--color-border) !important;
}

/* Hover and Active states */
[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker.ql-expanded .ql-picker-label .ql-stroke {
  stroke: var(--color-primary) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker.ql-expanded .ql-picker-label .ql-fill {
  fill: var(--color-primary) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker-label:hover,
[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker.ql-expanded .ql-picker-label {
  color: var(--color-primary) !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker.ql-expanded .ql-picker-options .ql-picker-item {
  color: #ffffff !important;
}

[data-theme="dark"] .ql-snow.ql-toolbar .ql-picker.ql-expanded .ql-picker-options .ql-picker-item:hover {
  color: var(--color-primary) !important;
}

[data-theme="dark"] .ql-editor {
  color: var(--color-text-main) !important;
}

/* Very aggressive fix to ensure all text within content areas is readable in dark mode */
[data-theme="dark"] .ql-editor,
[data-theme="dark"] .ql-editor *,
[data-theme="dark"] .feed-item-content,
[data-theme="dark"] .feed-item-content *,
[data-theme="dark"] #documents-list-container,
[data-theme="dark"] #documents-list-container * {
  color: var(--color-text-main) !important;
}

/*
==========================================
  Nullstilling (Reset) & Basis
==========================================
*/
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-main);
  background-color: var(--color-bg-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  word-wrap: break-word;
  width: 100%;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

a:hover {
  color: var(--color-primary-hover);
}

ul,
ol {
  list-style: none;
}

/*
==========================================
  Typografi
==========================================
*/
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  color: var(--color-text-main);
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 1rem;
}

h1 {
  font-size: 3rem;
}

h2 {
  font-size: 2.25rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1rem;
  color: var(--color-text-muted);
}

.text-sm {
  font-size: 0.875rem;
}

.text-lg {
  font-size: 1.125rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/*
==========================================
  Komponenter
==========================================
*/

/* Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  overflow-x: hidden;
  /* Safety */
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  border: none;
  gap: 0.5rem;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--color-primary);
  border: none !important;
  outline: none !important;
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-lg);
  color: white;
}

.btn-secondary {
  background-color: var(--color-bg-body);
  color: var(--color-text-main);
  border: 1px solid var(--color-border-dark);
}

.btn-secondary:hover {
  background-color: var(--color-bg-subtle);
  border-color: var(--color-primary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background-color: var(--color-bg-subtle);
  color: var(--color-primary);
}

#forgot-password-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#forgot-password-btn:hover {
  color: var(--color-primary-hover);
  transform: none;
}

/* 
==========================================
  Dark Mode Toggle Button (Shared)
==========================================
*/
.theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-xl);
}

/* Skjul "Bytt tema" tekst på floating knapp */
.theme-toggle span {
  display: none;
}

@media (max-width: 768px) {
  .theme-toggle {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 45px;
    height: 45px;
  }
}

.btn-full {
  width: 100%;
}

/* Cards */
.card {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
  margin: 0 !important;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.25rem;
  background-color: var(--color-bg-subtle);
  border-top: 1px solid var(--color-border);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-main);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  background-color: var(--color-bg-input, var(--color-bg-surface));
  color: var(--color-text-main);
}

.form-input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(110, 10, 45, 0.15);
}

.form-error {
  color: var(--color-error);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/*
==========================================
  Feed Items (The "Bubbles")
==========================================
*/
.feed-item {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.feed-item:hover {
  box-shadow: var(--shadow-md);
}

.feed-item h3 {
  font-size: 1.25rem;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  color: var(--color-text-main);
}

.feed-item-content {
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* 
==========================================
  Layout & Header
==========================================
*/
.header {
  background-color: var(--color-bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.3s ease;
}


.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
}


.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text-main);
}

.logo img {
  height: 2.5rem;
  width: 2.5rem;
  border-radius: var(--radius-full);
}

/* Globe Language Toggle Button beside Logo */
.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-all);
  box-shadow: var(--shadow-sm);
  user-select: none;
  text-decoration: none;
}

.lang-toggle-btn:hover {
  transform: translateY(-1px) scale(1.04);
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.lang-toggle-btn .globe-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

[data-theme="dark"] .lang-toggle-btn {
  background: var(--color-bg-card);
  border-color: var(--color-border);
  color: var(--color-text-main);
}

/* Header Dark Mode Toggle Button (PC & Mobile Web) */
.header-theme-toggle {
  position: static !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  border-radius: 9999px !important;
  background: var(--color-bg-card, #FFFFFF) !important;
  border: 1px solid var(--color-border, #E2E8F0) !important;
  color: var(--color-text-main, #1E293B) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05)) !important;
  cursor: pointer !important;
  padding: 0 !important;
  transition: var(--transition-all, all 0.2s ease) !important;
  flex-shrink: 0 !important;
}

.header-theme-toggle:hover {
  transform: translateY(-1px) scale(1.05) !important;
  background: var(--color-primary, #6E0A2D) !important;
  color: #FFFFFF !important;
  border-color: var(--color-primary, #6E0A2D) !important;
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1)) !important;
}

[data-theme="dark"] .header-theme-toggle {
  background: var(--color-bg-card, #1E293B) !important;
  border-color: var(--color-border, #334155) !important;
  color: var(--color-text-main, #F8FAFC) !important;
}

[data-theme="dark"] .header-theme-toggle:hover {
  background: var(--color-primary, #6E0A2D) !important;
  color: #FFFFFF !important;
  border-color: var(--color-primary, #6E0A2D) !important;
}


.nav-desktop {
  display: none;
  align-items: center;
  gap: 2rem;
  overflow: visible !important;
}

.nav-link {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--color-accent) !important;
  transform: translateY(-1px);
  text-shadow: 0 0 12px rgba(243, 183, 22, 0.4);
}

.nav-link.active {
  color: var(--color-primary);
  font-weight: 600;
}

[data-theme="dark"] .nav-link {
  color: #F4F4F5;
}

[data-theme="dark"] .nav-link:hover {
  color: var(--color-accent) !important;
  text-shadow: 0 0 14px rgba(243, 183, 22, 0.55);
}

[data-theme="dark"] .nav-link.active {
  color: #FFFFFF;
}

/* Mobile Menu (Premium Overlay) */
.mobile-toggle {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-main);
  z-index: 101;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.mobile-toggle:hover {
  color: var(--color-primary);
  transform: scale(1.1);
}

.mobile-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}

.mobile-menu,
.nav-menu-mobile {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--color-bg-surface, #FFFFFF);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
}

[data-theme="dark"] .mobile-menu,
[data-theme="dark"] .nav-menu-mobile {
  background-color: var(--color-bg-surface, #1C1917);
}

.mobile-menu.show,
.nav-menu-mobile.show {
  display: flex !important;
}

.mobile-menu a,
.nav-menu-mobile a {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-display, inherit);
  color: var(--color-text-main);
  text-decoration: none;
  text-align: center;
  padding: 0.5rem 1rem;
  border: none !important;
  transition: all 0.15s ease;
}

.mobile-menu a:hover,
.mobile-menu a.active,
.nav-menu-mobile a:hover,
.nav-menu-mobile a.nav-link-active {
  color: var(--color-primary);
  transform: translateY(-2px);
}

.mobile-menu .btn,
.nav-menu-mobile .button,
.nav-menu-mobile .btn {
  margin-top: 1rem;
  width: auto;
  min-width: 200px;
}

@media (min-width: 768px) {
  .nav-desktop,
  .nav-menu-desktop {
    display: flex;
  }

  .mobile-toggle,
  .mobile-menu-button {
    display: none !important;
  }

  .mobile-menu,
  .nav-menu-mobile {
    display: none !important;
  }
}

/*
==========================================
  Login Page (Split Screen)
==========================================
*/
.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
}

.login-visual {
  display: none;
  background-image: url('https://picsum.photos/seed/cfa41/1024/1024');
  /* Bytt bilde */
  /* Keramikk-bilde */
  background-size: cover;
  background-position: center;
  position: relative;
}

.login-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.6));
}

.login-visual-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 4rem;
  color: #ffffff !important;
}

.login-visual-content h1,
.login-visual-content p {
  color: #ffffff !important;
}

.login-form-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: var(--color-bg-surface);
}

.login-wrapper {
  width: 100%;
  max-width: 400px;
}

@media (min-width: 1024px) {
  .login-layout {
    grid-template-columns: 1.2fr 1fr;
    /* Mer plass til bildet */
  }

  .login-visual {
    display: block;
  }
}

.login-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
}

.login-logo img {
  height: 10rem;
  width: 10rem;
  object-fit: contain;
  border-radius: var(--radius-full);
}

/*
==========================================
  Dashboard (Medlemsside)
==========================================
*/
/*
==========================================
  Dashboard (Medlemsside)
==========================================
*/
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1rem 0;
  width: 100%;
  max-width: 100%;
  align-items: start;
}

.dashboard-sidebar,
.dashboard-sidebar-right,
.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  min-width: 0;
  margin-top: 0 !important;
  padding-top: 0 !important;
  align-self: start;
}

.dashboard-main {
  gap: 2rem;
}

.profile-card {
  text-align: center;
  position: relative; /* For absolute positioning of notifications */
}


.profile-avatar {
  width: 6rem;
  height: 6rem;
  border-radius: var(--radius-full);
  object-fit: cover;
  margin: 0 auto 1rem;
  border: 4px solid var(--color-bg-body);
  box-shadow: var(--shadow-md);
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.gallery-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.gallery-preview-item {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.gallery-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery-preview-item:hover img {
  transform: scale(1.1);
}

.dashboard-sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 300px;
    grid-template-areas: "left center right";
    gap: 2rem;
    align-items: start;
    padding-top: 1rem;
    padding-bottom: 2rem;
  }

  .dashboard-sidebar { 
    grid-area: left;
    position: sticky;
    top: 5.5rem;
    align-self: start !important;
  }
  
  .dashboard-main { 
    grid-area: center;
    align-self: start !important;
  }
  
  .dashboard-sidebar-right { 
    grid-area: right;
    position: sticky;
    top: 5.5rem;
    align-self: start !important;
  }

  .dashboard-sidebar,
  .dashboard-sidebar-right {
    height: fit-content;
    margin-top: 0 !important;
  }
}

/* Admin Control Modal & Trigger */
.admin-trigger-container {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.admin-panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .admin-panel-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-tool-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem;
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: var(--transition-base);
  text-align: left;
  gap: 0.5rem;
}

.admin-tool-item:hover {
  border-color: var(--color-primary);
  background-color: var(--color-bg-surface);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.admin-tool-icon {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.admin-tool-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text-main);
  margin: 0;
}

.admin-tool-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
}

/*
==========================================
  Utilities
==========================================
*/
.hidden {
  display: none !important;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mt-8 {
  margin-top: 2rem;
}

/* Modal Tabs */
.modal-tabs-container {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 0.5rem;
}

.modal-tabs-container::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  white-space: nowrap;
  flex-shrink: 0;
  background-color: var(--color-bg-subtle) !important;
  border-color: var(--color-border) !important;
}

.tab-btn.active {
  background-color: var(--color-primary) !important;
  color: white !important;
  border-color: var(--color-primary) !important;
}

#tab-add-member {
  margin-left: auto;
}

.bg-subtle {
  background-color: var(--color-bg-subtle);
}

.gallery-delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  z-index: 10;
}

.gallery-delete-btn:hover {
  background: rgba(255, 0, 0, 0.9);
}

.feed-item {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  padding-bottom: 0.75rem;
  /* Less padding to accommodate footer */
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  max-width: 100%;
  overflow-wrap: break-word;
}

/* Post Actions (Like/Comment) */
.post-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--color-border);
  margin-top: 1rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.action-btn:hover {
  background-color: var(--color-bg-body);
  color: var(--color-primary);
}

.action-btn.active {
  color: var(--color-primary);
}

.action-btn i {
  font-size: 1.1rem;
}

/* Quick Comment Bar */
.quick-comment-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.comment-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.comment-input-bar {
  flex: 1;
  background-color: var(--color-bg-body);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: text;
}

.comment-input-bar input {
  background: none;
  border: none;
  outline: none;
  width: 100%;
  color: var(--color-text-main);
}

.comment-input-bar input::placeholder {
  color: var(--color-text-muted);
}

/* Inline Comments List */
.inline-comments-container {
  padding: 0.5rem 0;
  border-top: 1px solid var(--color-border);
  margin-top: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.inline-comments-container.hidden {
  display: none !important;
}

/* Comment Preview */
.comment-preview {
  font-size: 0.85rem;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.comment-item {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.comment-content {
  background-color: var(--color-bg-body);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  flex: 1;
}

.comment-author {
  font-weight: 600;
  margin-right: 0.5rem;
  color: var(--color-text-main);
}

.comment-text {
  color: var(--color-text-muted);
}

.show-more-comments {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  border-radius: var(--radius-full);
}

.show-more-comments:hover {
  background-color: var(--color-bg-body);
  color: var(--color-primary);
}

.show-more-comments.active svg {
  transform: rotate(180deg);
}

.show-more-comments svg {
  transition: transform 0.3s ease;
}

/* Delete Buttons (Admin) */
.post-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.4;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

.post-delete-btn:hover {
  opacity: 1;
  background-color: rgba(220, 38, 38, 0.1);
}

.comment-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  align-self: flex-start;
  margin-top: 0.25rem;
}

.comment-item:hover .comment-delete-btn {
  opacity: 0.4;
}

.comment-item:hover .comment-delete-btn:hover {
  opacity: 1;
  background-color: rgba(220, 38, 38, 0.1);
}

/* Modal Overlay Styling */
div[id$="-modal-overlay"] {
  backdrop-filter: blur(8px) !important;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

/* Modal Card Animation */
div[id$="-modal"]:not(.hidden) .card {
  animation: modalAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Modal Scroll Lock - Unified */
body.modal-open {
  overflow: hidden !important;
}

/* 
==========================================
  Gallery & Upload UI Improvements
==========================================
*/

.upload-drop-zone {
  width: 100%;
  min-height: 150px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  cursor: pointer;
  background-color: var(--color-bg-subtle);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  padding: 1.5rem;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
  border-color: var(--color-primary);
  background-color: rgba(110, 10, 45, 0.05);
}

.upload-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.pending-uploads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.pending-upload-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.pending-upload-preview {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-bottom: 1px solid var(--color-border);
}

.pending-upload-info {
  padding: 0.75rem;
}

.pending-upload-info textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  line-height: 1.4;
  resize: none;
  background-color: var(--color-bg-subtle);
  color: var(--color-text-main);
}

/* Updated Gallery Grid */
.gallery-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  z-index: 10;
}

.gallery-item:hover .gallery-delete-btn {
  opacity: 1;
}

/* Lightbox listeners handled in script.js */


/* --- Utility: Subtle Background --- */
.bg-subtle {
  background-color: var(--color-bg-subtle, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--color-border);
}

/* --- Admin List Styles --- */
.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  background-color: var(--color-bg-subtle, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--color-border);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.admin-list-item:hover {
  border-color: var(--color-primary);
  background-color: rgba(255, 255, 255, 0.08);
}

/* Custom Checkbox for Gallery Admin */
.admin-gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.admin-gallery-item.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.admin-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.admin-gallery-item.selected img {
  opacity: 0.7;
}

.admin-gallery-check {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s ease;
  z-index: 5;
}

.admin-gallery-item.selected .admin-gallery-check {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.modal-container {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: -1;
  transition: opacity 0.3s ease;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Ensure the body within a modal card is flexible but let the container handle scroll */
.modal-content .card-body {
  /* Removed flex: 1 and overflow-y: auto to allow the whole modal container to scroll naturally */
}

/* Hide scrollbar ONLY for the document editor as requested */
#doc-entry-modal .modal-content {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#doc-entry-modal .modal-content::-webkit-scrollbar {
  display: none;
}


/* Modal sizing utilities */
.maxWidth-600 {
  max-width: 600px;
}

.maxWidth-800 {
  max-width: 800px;
}

.maxWidth-800 {
  max-width: 800px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative;
  z-index: 10;
  max-width: 1000px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  cursor: pointer;
  opacity: 0.7;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 100;
}

.lightbox-close:hover {
  opacity: 1;
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.8);
}

.lightbox-image-container {
  max-height: 80vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.lightbox-image-container img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.lightbox-caption {
  margin-top: 1.5rem;
  color: white;
  text-align: center;
  max-width: 600px;
}

.lightbox-caption p {
  color: white !important;
  font-size: 1.125rem;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .lightbox {
    padding: 1rem;
  }

  .lightbox-close {
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem;
    border-radius: 0 0 0 10px;
  }
}

/* Global Textarea Resizing Fix (Snappy Resizing & Grip) */
textarea {
  resize: vertical !important;
  min-height: 80px;
  transition: none !important;
  /* Custom Grip Handle */
  background-image: linear-gradient(-45deg, var(--color-text-muted) 1px, transparent 1px, transparent 4px, var(--color-text-muted) 4px, var(--color-text-muted) 5px, transparent 5px, transparent 8px, var(--color-text-muted) 8px, var(--color-text-muted) 9px, transparent 9px);
  background-repeat: no-repeat;
  background-position: bottom 4px right 4px;
  background-size: 12px 12px;
}

/*
 ==========================================
   Arrangementer (Events) Styles
 ==========================================
 */
.tab-header {
  font-size: 1.5rem;
  transition: var(--transition-base);
  padding-bottom: 0.5rem;
  border-bottom: 3px solid transparent;
}

.tab-header.active {
  color: var(--color-primary) !important;
  border-bottom-color: var(--color-primary);
}

.event-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.event-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.event-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background-color: var(--color-bg-subtle);
}

.event-body {
  padding: 1.5rem;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.event-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.event-meta-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.event-title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--color-text-main);
}

.event-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.event-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.rsvp-status {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.rsvp-status.coming {
  background-color: rgba(22, 163, 74, 0.1);
  color: var(--color-success);
}

.rsvp-status.not-coming {
  background-color: rgba(220, 38, 38, 0.1);
  color: var(--color-error);
}

.past-event-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.past-event-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.past-event-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.past-event-info p {
  font-size: 0.8rem;
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .event-card {
    flex-direction: column;
  }

  .event-actions {
    flex-direction: column;
  }

  .rsvp-status {
    margin-left: 0;
    text-align: center;
  }
}

/* --- Collapsible Documents (Referater) --- */
.collapsible-item .collapsible-content {
  display: none;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  margin-top: 1rem;
}

.collapsible-item.expanded .collapsible-content {
  display: block;
  animation: fadeIn 0.3s ease;
}

.collapsible-item .toggle-arrow {
  transition: transform 0.3s ease;
}

.collapsible-item.expanded .toggle-arrow {
  transform: rotate(180deg);
}

.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Retningslinjer Tabs --- */
/* --- Retningslinjer Tabs --- */
.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 0.5rem;
  min-width: 120px;
  white-space: nowrap;

  /* Inactive: Clear outline */
  background-color: var(--color-bg-surface) !important;
  color: var(--color-text-main) !important;
  border: 2px solid var(--color-text-muted) !important;
  opacity: 0.7;
}

#retningslinjer-tabs {
  gap: 0.75rem;
}

.tab-btn:hover {
  background-color: var(--color-bg-subtle) !important;
  border-color: var(--color-primary) !important;
  color: var(--color-primary) !important;
  opacity: 1;
  transform: translateY(-1px);
}

.tab-btn.active {
  /* Active: Solid Primary */
  background-color: var(--color-primary) !important;
  color: #ffffff !important;
  border-color: var(--color-primary) !important;
  box-shadow: var(--shadow-md);
  opacity: 1;
  font-weight: 700;
}

.tab-btn.active:hover {
  background-color: var(--color-primary-hover) !important;
  box-shadow: var(--shadow-lg);
}

/* --- Image Cropping & Adjustment --- */
.crop-preview-wrapper {
  position: relative;
  width: 100%;
  max-height: 500px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--color-bg-dark);
  /* Matches site dark elements */
  margin-top: 1rem;
  touch-action: none; /* Prevents scrolling while dragging */
}

.crop-area {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: ns-resize;
}

.crop-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 10;
  /* clip-path is updated dynamically by JS */
  clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%);
}

.crop-viewport {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px; /* Initial size, will be updated by JS */
  height: 100px;
  border: 2px solid var(--color-primary);
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4); /* Mask effect */
  z-index: 20;
  cursor: grab;
  background: transparent;
  pointer-events: auto; /* Enable for handles and dragging */
}

.crop-viewport:active {
    cursor: grabbing;
}

/* Grid lines inside viewport */
.crop-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.grid-line {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.5);
}

.line-v { width: 1px; height: 100%; top: 0; }
.line-v:nth-child(1) { left: 33.33%; }
.line-v:nth-child(2) { left: 66.66%; }

.line-h { height: 1px; width: 100%; left: 0; }
.line-h:nth-child(3) { top: 33.33%; }
.line-h:nth-child(4) { top: 66.66%; }

/* Resize Handles */
.crop-resizer {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--color-primary);
    border: 2px solid white;
    border-radius: 50%;
    z-index: 30;
}

.top-left { top: -6px; left: -6px; cursor: nwse-resize; }
.top-right { top: -6px; right: -6px; cursor: nesw-resize; }
.bottom-left { bottom: -6px; left: -6px; cursor: nesw-resize; }
.bottom-right { bottom: -6px; right: -6px; cursor: nwse-resize; }

.crop-viewport.square { aspect-ratio: 1 / 1; }
.crop-viewport.banner { aspect-ratio: 2.5 / 1; }
.crop-viewport.post { aspect-ratio: auto; } /* Removed forced 2:1 ratio */

.crop-overlay {
    display: none; /* We use box-shadow on viewport for masking now */
}

.crop-hint {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  z-index: 30;
  pointer-events: none;
}

/* --- Profile Mini Preview --- */
.profile-mini-preview {
    width: 120px !important;
    height: 120px !important;
    border-radius: 50% !important;
    margin: 1.5rem auto !important;
    border: 4px solid var(--color-bg-body) !important;
    box-shadow: var(--shadow-lg) !important;
    max-height: 120px !important;
    background-color: var(--color-bg-subtle) !important;
    overflow: hidden !important;
}

.profile-mini-preview .crop-viewport {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    transform: none !important;
}

.profile-mini-preview .crop-overlay {
    display: none !important; /* No need for overlay in circular mini preview */
}

.profile-mini-preview .crop-area {
    cursor: default !important;
    width: 100% !important;
    height: 100% !important;
}

/* --- Admin Galleri Spesifikk --- */
.gallery-admin-active-section {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1.5rem;
  position: sticky;
  top: -1.25rem; /* Sticky inside card-body scroll area */
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.active-images-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}

.active-image-item {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--color-primary);
  background: var(--color-bg-body);
}

.active-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.active-image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-error);
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  border: none;
  z-index: 2;
}

.gallery-admin-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.user-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: var(--color-bg-surface);
}

.user-group-header {
  padding: 0.75rem 1rem;
  background: var(--color-bg-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-base);
}

.user-group-header:hover {
  background: var(--color-border);
}

.user-group-content {
  padding: 1rem;
  display: none;
  border-top: 1px solid var(--color-border);
}

.user-group.expanded .user-group-content {
  display: block;
  animation: fadeIn 0.3s ease;
}

.user-group.expanded .collapse-icon {
  transform: rotate(180deg);
}

.collapse-icon {
  transition: transform 0.2s ease;
}

/* Notifications */
#notifications-wrapper {
    transition: color 0.2s ease;
}

#notifications-wrapper:hover {
    color: var(--color-primary);
}

.notifications-dropdown {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.notif-item {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--color-border);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background-color: var(--color-bg-subtle);
}

.notif-item p {
    color: var(--color-text);
}

.notif-item span {
    color: var(--color-text-muted);
}

/* User Tags in text */
.user-tag {
    background-color: rgba(67, 97, 238, 0.1); /* Fallback for var(--color-primary-rgb) if not defined */
    padding: 0 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    color: var(--color-primary);
    font-weight: 500;
}

.user-tag:hover {
    background-color: rgba(67, 97, 238, 0.2);
    text-decoration: underline;
}

/* Profile Card Notifications */
.profile-notif-wrapper {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 10;
}

#notifications-wrapper {
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#notifications-wrapper:hover {
  background-color: var(--color-bg-subtle);
  transform: translateY(-1px);
}

#notifications-wrapper.active {
  background-color: var(--color-bg-subtle);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

#notifications-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 300px;
  z-index: 1000;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.notif-item {
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
}


.notif-item {
  border-bottom: 1px solid var(--color-border);
}

.notif-item:last-child {
  border-bottom: none;
}
/* Glasur Gruppe Styles */
.badge-accent {
  background: var(--color-accent);
  color: #1F1F22;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-transform: uppercase;
}

.btn-accent {
  background: var(--color-accent);
  color: #1F1F22;
  font-weight: 600;
}

.btn-accent:hover {
  background: var(--color-accent-hover);
  color: #1F1F22;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================
   PWA / Standalone-modus (åpnet fra hjemskjerm)
   ========================================== */
@media (display-mode: standalone) {
  /* Skjul alle ordinære navigasjonslenker og elementer i toppmenyen */
  .nav-desktop .nav-link,
  .nav-menu-desktop .nav-link,
  .mobile-menu-button,
  .mobile-toggle,
  .mobile-menu,
  .nav-menu-mobile,
  .lang-toggle-btn {
    display: none !important;
  }

  /* Vis kun logo og en ren Logg ut-knapp */
  .nav-desktop,
  .nav-menu-desktop {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  #logout-button,
  .pwa-logout-btn {
    display: inline-flex !important;
    padding: 0.4rem 0.85rem !important;
    font-size: 0.875rem !important;
  }

  /* Safe Area tilpasning */
  body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  header.header {
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
  }
}

body.pwa-standalone .nav-desktop .nav-link,
body.pwa-standalone .nav-menu-desktop .nav-link,
body.pwa-standalone .mobile-menu-button,
body.pwa-standalone .mobile-toggle,
body.pwa-standalone .mobile-menu,
body.pwa-standalone .nav-menu-mobile,
body.pwa-standalone .lang-toggle-btn {
  display: none !important;
}

body.pwa-standalone .nav-desktop,
body.pwa-standalone .nav-menu-desktop,
body.pwa-standalone #logout-button,
body.pwa-standalone .pwa-logout-btn {
  display: none !important;
}

.pwa-header-profile-btn {
  display: none;
}

body.pwa-standalone .pwa-header-profile-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-left: auto;
  outline: none;
}

body.pwa-standalone .pwa-header-profile-btn img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease;
}

body.pwa-standalone .pwa-header-profile-btn:active img {
  transform: scale(0.92);
}

/* ====================================================
   PWA & MOBIL-APP OPPLEVELSE
   ==================================================== */

/* Skjul push-varsler på PC (både kort og støy) */
@media (min-width: 769px) {
  #push-notification-card {
    display: none !important;
  }
}

/* Skjul PWA-spesifikke views og bunnmeny i vanlig nettleser */
.pwa-only,
body:not(.pwa-standalone) .pwa-view:not(#pwa-view-home) {
  display: none !important;
}

/* Standalone / PWA app-modus */
body.pwa-standalone {
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)) !important;
}

body.pwa-standalone button,
body.pwa-standalone .pwa-nav-item,
body.pwa-standalone .badge,
body.pwa-standalone .pwa-settings-item {
  user-select: none;
  -webkit-user-select: none;
}

/* I standalone-modus: skjul ordinære desktop-sidebarer */
body.pwa-standalone .dashboard-sidebar,
body.pwa-standalone .dashboard-sidebar-right {
  display: none !important;
}

/* Gjør layouten til en ren mobil app-kolonne */
body.pwa-standalone .dashboard-grid {
  display: block !important;
  max-width: 620px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

body.pwa-standalone .pwa-only {
  display: block !important;
}

/* Sørg for at .hidden ALLTID skjuler elementer, selv i PWA */
.hidden,
body.pwa-standalone .hidden,
body.pwa-standalone .pwa-only.hidden,
body.pwa-standalone .pwa-push-banner.hidden {
  display: none !important;
}

/* PWA Sidevisninger: kun det aktive viewet vises */
body.pwa-standalone .pwa-view {
  display: none !important;
}

body.pwa-standalone .pwa-view.active {
  display: block !important;
  animation: pwaViewFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pwaViewFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* PWA Topp-faner (Innlegg / Kommende Conventions) */
body.pwa-standalone .pwa-top-tabs-card {
  margin-top: 0.25rem !important;
  margin-bottom: 1.25rem !important;
  border-radius: 16px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

body.pwa-standalone .pwa-top-tabs-card .card-body {
  padding: 0.5rem !important;
}

body.pwa-standalone .pwa-top-tabs-card button {
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem !important;
  padding: 0.7rem 0.5rem !important;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* PWA Push Onboarding Banner */
.pwa-push-banner {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.14), rgba(154, 52, 18, 0.08));
  border: 1px solid var(--color-primary);
  border-radius: 16px;
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* PWA "Vis mer / Tidligere innlegg"-knapp */
.pwa-show-more-container {
  margin-top: 1rem;
  margin-bottom: 2rem;
  text-align: center;
}

.pwa-show-more-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pwa-show-more-btn:hover {
  background: var(--color-bg-surface);
  border-color: var(--color-primary);
}

/* PWA Native Bottom Navigation Bar */
.pwa-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
  display: none;
  justify-content: space-around;
  align-items: center;
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 2500;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

body.pwa-standalone .pwa-bottom-nav {
  display: flex !important;
}

/* Løft dark mode-knappen over mobilappens bunnmeny */
body.pwa-standalone .theme-toggle {
  bottom: calc(58px + env(safe-area-inset-bottom, 0px) + 1rem) !important;
  right: 1.25rem !important;
  z-index: 3000 !important;
}

@media (display-mode: standalone) {
  .theme-toggle {
    bottom: calc(58px + env(safe-area-inset-bottom, 0px) + 1rem) !important;
    right: 1.25rem !important;
    z-index: 3000 !important;
  }
}

.pwa-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}

.pwa-nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transition: stroke 0.15s ease, transform 0.15s ease;
}

.pwa-nav-item.active {
  color: var(--color-primary) !important;
  font-weight: 700;
}

.pwa-nav-item.active svg {
  stroke: var(--color-primary);
  transform: scale(1.1);
}

/* PWA Innstillinger Listestil */
.pwa-settings-group {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.pwa-settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  color: var(--color-text-main);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.12s ease;
}

.pwa-settings-item:last-child {
  border-bottom: none;
}

.pwa-settings-item:active {
  background: var(--color-bg-subtle);
}

/* PWA Toggle Switch (iOS-aktig ren bryter) */
.pwa-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.pwa-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pwa-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-border);
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.pwa-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.pwa-switch input:checked + .pwa-slider {
  background-color: var(--color-primary);
}

.pwa-switch input:checked + .pwa-slider:before {
  transform: translateX(20px);
}

/* ====================================================
   LIKE-KNAPP FOR INNLEGG (FEED)
   ==================================================== */
.like-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  padding: 0.45rem 0.95rem !important;
  border-radius: 9999px !important;
  border: 1.5px solid var(--color-border) !important;
  background: var(--color-bg-subtle) !important;
  color: var(--color-text-main) !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  user-select: none;
  -webkit-user-select: none;
}

.like-btn:hover {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

.like-btn.liked {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.14) !important;
  color: #ef4444 !important;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.25) !important;
}

.like-btn.liked .like-count {
  color: #ef4444 !important;
  font-weight: 700 !important;
}

.like-btn:active {
  transform: scale(0.93) !important;
}



