/* Modern CSS Variables - Design System */
:root {
  /* Primary Colors */
  --color-primary: #10B981; /* Emerald green */
  --color-primary-hover: #059669;
  --color-primary-light: #D1FAE5;
  --color-primary-dark: #047857;

  /* Secondary Colors */
  --color-secondary: #6366F1; /* Indigo */
  --color-secondary-hover: #4F46E5;

  /* Neutral Colors */
  --color-bg-primary: #F9FAFB;
  --color-bg-secondary: #FFFFFF;
  --color-bg-tertiary: #F3F4F6;

  /* Text Colors */
  --color-text-primary: #1F2937;
  --color-text-secondary: #6B7280;
  --color-text-tertiary: #9CA3AF;

  /* Border Colors */
  --color-border-light: #E5E7EB;
  --color-border-medium: #D1D5DB;
  --color-border-dark: #9CA3AF;

  /* Status Colors */
  --color-success: #10B981;
  --color-error: #EF4444;
  --color-warning: #F59E0B;
  --color-info: #3B82F6;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
body.dark {
  --color-bg-primary: #121212;
  --color-bg-secondary: #1E1E1E;
  --color-bg-tertiary: #2D2D2D;

  --color-text-primary: #E0E0E0;
  --color-text-secondary: #A0A0A0;
  --color-text-tertiary: #707070;

  --color-border-light: #333333;
  --color-border-medium: #444444;
  --color-border-dark: #555555;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Reset and base styles */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  padding: var(--space-xs);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  /* Safe area support for notched devices */
  padding-top: calc(var(--space-xs) + env(safe-area-inset-top));
  padding-bottom: calc(var(--space-xs) + env(safe-area-inset-bottom));
  padding-left: calc(var(--space-xs) + env(safe-area-inset-left));
  padding-right: calc(var(--space-xs) + env(safe-area-inset-right));
  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Visibility helpers (mobile-first) */
.desktop-only { display: none; }
.mobile-only { display: block; }

/* Global Animations & Keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Animation utilities */
.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.2s ease-out;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 0%,
    var(--color-border-light) 50%,
    var(--color-bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* Ripple effect for buttons */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

button.ripple {
  position: relative;
  overflow: hidden;
}

button.ripple::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
}

button.ripple:active::after {
  animation: ripple 0.6s ease-out;
}

/* Modern Card Component */
.card {
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-medium);
}

.card-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-border-light);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.card-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

/* Section spacing */
.section {
  margin-bottom: var(--space-2xl);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Apply themed background only on login page */
body.login-mode {
  background-color: #FBEBD9; /* light orange base */
  background-image: url('/assets/bakgrund-desktop.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

@media (max-width: 768px) {
  body.login-mode {
    background-image: url('/assets/bakgrund-mobil.png');
  }
}

/* Mobile action buttons */
.mobile-actions {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.mobile-actions button {
  flex: 1; /* Make buttons take equal width */
  padding: 0.75rem;
  font-size: 1.2rem; /* Larger icons */
}

/* Desktop-specific layout and compact UI */
@media (min-width: 769px) {
  .desktop-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
  }

  .cart-actions {
    display: flex;
    gap: 0.75rem;
    margin: 10px 0;
  }
  .cart-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    width: auto;
  }

  .desktop-only { display: block; }
  .mobile-only { display: none; }

  .report-tools {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }
  .report-tools .btn,
  .report-tools button {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .info-row {
    display: flex;
    gap: 1rem;
  }
  .info-field { flex: 1; }

  /* Compact controls on desktop */
  input, select, button {
    padding: 10px;
    font-size: 1rem;
  }
  button { width: auto; } /* normal-width buttons on desktop */
}

/* View-level help icon (top-right) */
.view-help {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.view-help .help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: #f1f3f5;
  color: #0d6efd;
  text-decoration: none;
}
.view-help .help-icon:hover {
  background: #e9ecef;
}

/* Modern Navigation Tabs */
.tabs-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-sm);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  position: sticky;
  top: var(--space-lg);
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.tabs-container .tabs {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1 1 auto;
}

.tabs-container .tabs::-webkit-scrollbar {
  display: none;
}

.tabs-container .tabs button {
  float: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 0 0 auto;
  background-color: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: var(--space-sm) var(--space-lg);
  transition: all var(--transition-base);
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  width: auto;
  font-weight: 500;
  font-size: 0.9375rem;
  position: relative;
}

.tabs-container .tabs button:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.tabs-container .tabs button.active {
  background-color: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.tabs-container .tabs button.active:hover {
  background-color: var(--color-primary-hover);
}

.tabs-container .tabs-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 0 0 auto;
}

/* Modern Input Styling */
input, select {
  margin: var(--space-sm) 0;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  transition: all var(--transition-base);
  font-family: inherit;
}

input::placeholder {
  color: var(--color-text-tertiary);
  opacity: 1;
}

input:hover, select:hover {
  border-color: var(--color-border-medium);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
  background-color: var(--color-bg-secondary);
}

/* Enhanced select styling */
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 20px;
  padding-right: 2.75rem;
  cursor: pointer;
}

/* Textarea styling */
textarea {
  margin: var(--space-sm) 0;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  box-sizing: border-box;
  transition: all var(--transition-base);
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

textarea:hover {
  border-color: var(--color-border-medium);
}

textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Modern Button Styling */
button {
  background-color: var(--color-primary);
  color: white;
  border: none;
  cursor: pointer;
  /* Default: medium size */
  padding: 0.625rem 1rem; /* 10px 16px */
  min-height: 40px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

button:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button sizes */
button.btn-sm {
  padding: 0.375rem 0.75rem; /* 6px 12px */
  min-height: 32px;
  font-size: 0.8125rem;
}

button.btn-lg {
  padding: 0.75rem 1.5rem; /* 12px 24px */
  min-height: 48px;
  font-size: 1rem;
}

button.btn-icon {
  padding: 0.5rem;
  min-width: 40px;
  min-height: 40px;
}

button.btn-icon.btn-sm {
  padding: 0.375rem;
  min-width: 32px;
  min-height: 32px;
}

/* Button variants */
button.btn-secondary {
  background-color: var(--color-secondary);
}

button.btn-secondary:hover {
  background-color: var(--color-secondary-hover);
}

button.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  box-shadow: none;
}

button.btn-outline:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary-hover);
}

button.btn-ghost {
  background-color: transparent;
  color: var(--color-text-secondary);
  box-shadow: none;
}

button.btn-ghost:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

button.btn-danger {
  background-color: var(--color-error);
}

button.btn-danger:hover {
  background-color: #DC2626;
}

/* Button group - desktop default: auto-width, right-aligned */
.btn-group {
  display: flex;
  flex-direction: row;
  width: auto;
  margin-left: auto;
  gap: 0.5rem;
}

.btn-group button,
.btn-group .btn {
  width: auto;
}

/* Panel footer - desktop default */
.panel-footer {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  gap: 0.5rem;
}

.panel-footer .btn-group {
  margin-left: 0;
}

/* Mobile: stacked, full width */
@media (max-width: 768px) {
  button.btn-block,
  .btn-block {
    width: 100%;
    display: flex;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
    margin-left: 0;
  }

  .btn-group button,
  .btn-group .btn {
    width: 100%;
  }

  .panel-footer {
    flex-direction: column;
  }
}

/* Modern Table Styling */
table {
  border-collapse: separate;
  border-spacing: 0;
  margin-top: var(--space-md);
  width: 100%;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}

th, td {
  border: none;
  border-bottom: 1px solid var(--color-border-light);
  padding: var(--space-lg) var(--space-md);
  text-align: left;
  font-size: 0.9375rem;
}

th {
  background-color: var(--color-bg-tertiary);
  font-weight: 600;
  color: var(--color-text-primary);
  text-transform: uppercase;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
}

tbody tr {
  transition: all var(--transition-base);
  border-bottom: 1px solid var(--color-border-light);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background-color: var(--color-bg-tertiary);
  transform: scale(1.005);
}
ul { padding-left: 0; list-style: none; }
ul li {
  padding: 16px; /* Increased padding for better touch targets */
  font-size: 1.1em;
  border-bottom: 1px solid #ddd;
  gap: 8px;
  min-height: 48px; /* Ensure minimum touch target size */
  display: flex;
  align-items: center;
  transition: background-color 0.2s ease;
}
ul li:hover { background-color: #f0f0f0; cursor: pointer; }
ul li:active { background-color: #e0e0e0; } /* Active state for touch feedback */

/* Modern Typography Scale */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-primary);
  letter-spacing: -0.025em;
}

h1 {
  font-size: 2.25rem;
  margin-bottom: var(--space-xl);
}

h2 {
  font-size: 1.875rem;
  margin-bottom: var(--space-lg);
  font-weight: 600;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  font-weight: 600;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: var(--space-sm);
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

p {
  margin: 0 0 var(--space-md);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

/* --- Specifikt för knappar i varukorgen --- */
#cart button {
  all: unset;
  cursor: pointer;
  font-size: 1.4em; /* Slightly smaller but still tappable */
  color: var(--color-error);
  margin: 0;
  padding: 4px; /* Add padding for touch target */
  min-width: 36px; /* Ensure minimum touch target width */
  min-height: 36px; /* Ensure minimum touch target height */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0; /* Don't shrink */
}
#cart button:hover {
  color: #DC2626;
  transform: scale(1.1); /* Slight scale on hover/touch */
}
#cart button:active {
  transform: scale(0.95); /* Press effect */
}

/* Modern Cart Styling */
#cart {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}

#cart li {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-xs);
  border-bottom: 1px solid var(--color-border-light);
  gap: var(--space-xs);
  transition: all var(--transition-base);
  background: var(--color-bg-secondary);
}

#cart li:last-child {
  border-bottom: none;
}

#cart li:hover {
  background-color: var(--color-bg-tertiary);
}

#cart li:active {
  background-color: var(--color-bg-primary);
}

#cart li > span:first-child {
  flex: 1;
  min-width: 0; /* Allow text to shrink */
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.4;
  font-size: 0.9rem;
  word-break: break-word; /* Break long words if needed */
}

#cart li input[type="number"] {
  width: 50px !important;
  flex-shrink: 0; /* Don't shrink */
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 4px 2px;
  margin: 0;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

#cart li input[type="number"]:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

#cart li > span:last-child {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  min-width: 35px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  flex-shrink: 0; /* Don't shrink */
}

/* Clear cart button */
#clearCart {
  background-color: var(--color-error);
  width: 100%;
  margin-top: var(--space-lg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
#clearCart:hover {
  background-color: #DC2626;
  box-shadow: var(--shadow-md);
}

#downloadPdfBtn {
  background-color: #6c757d;
  font-size: 0.9em;
  padding: 8px 12px;
  width: auto;
  margin-top: 10px;
}

.button-container {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Notifications --- */
#notification-container {
  position: fixed;
  top: 20px;
  left: 50%; /* Center horizontally on mobile */
  transform: translateX(-50%);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: calc(100% - 40px); /* Full width minus margins on mobile */
  max-width: 500px; /* Limit width on larger screens */
  pointer-events: none; /* Allow clicks through container */
}

.notification {
  position: relative;
  padding: 16px 50px 16px 20px; /* More padding for touch */
  border-radius: 12px;
  color: white;
  font-size: 1.05em;
  font-weight: 500;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(0);
  pointer-events: auto; /* Enable clicks on notifications */
  line-height: 1.4;
}

.notification.closing {
  opacity: 0;
  transform: translateY(-20px);
}

.notification.success {
  background: var(--color-success);
}
.notification.error {
  background: var(--color-error);
}
.notification.info {
  background: var(--color-info);
}

.notification .close-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: 24px; /* Larger for easier tapping */
  font-weight: bold;
  color: white;
  background: rgba(255,255,255,0.2);
  border: none;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.notification .close-btn:hover,
.notification .close-btn:active {
  background: rgba(255,255,255,0.3);
}

/* Desktop: move notifications to top-right */
@media (min-width: 769px) {
  #notification-container {
    left: auto;
    right: 20px;
    transform: none;
    width: auto;
    max-width: 400px;
  }

  .notification.closing {
    transform: translateX(100%);
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6); /* Slightly darker for better contrast */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  /* Prevent background scrolling when modal is open */
  overflow: hidden;
}

.modal-content {
  background-color: rgba(255, 255, 255, 0.95); /* More opaque for better readability */
  padding: 24px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: 90%;
  width: 400px;
  /* Add animation */
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-buttons {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-buttons button {
  width: auto;
  min-width: 100px;
  margin: 0;
}

#confirmClearCart {
  background-color: var(--color-error);
}

/* Responsiv design för mobil */
.view-container {
  padding: 0 0.25rem;
}

@media (max-width: 600px) {
  body {
    padding: 0;
    margin: 0;
    margin-bottom: calc(12px + env(safe-area-inset-bottom)); /* Extra space on bottom for notched devices */
  }
  .view-container {
    padding: 0 0.25rem;
  }
  table, th, td { font-size: 1em; }

  /* Optimize spacing for smaller screens */
  h1 { font-size: 1.5em; margin: 12px 0; }
  h2 { font-size: 1.3em; margin: 10px 0; }

  /* Improve readability on small screens */
  label {
    font-size: 1.1em;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
  }

  /* Better spacing for form elements */
  input, select, button {
    margin: 10px 0;
  }

  /* Reduce padding in tight spaces */
  .admin-section {
    padding: 16px;
  }
}

/* === NEW ADMIN PAGE STYLES === */

.admin-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0; /* Remove padding to let sections handle it */
}

.admin-container > h1 {
    padding: 0 20px;
}
.admin-container > p {
    padding: 0 20px;
}


/* Card-based layout for sections */
.admin-section {
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.admin-section h2, .admin-section h3 {
  margin-top: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 20px;
  color: #333;
  font-size: 1.4em;
}

/* Flexbox for form layouts */
.form-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.form-group input {
  flex: 1 1 200px; /* Allow inputs to grow and shrink */
}

.form-group button {
  flex-shrink: 0; /* Prevent button from shrinking */
  width: auto;
}

/* Improved table styles */
#admin-content table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

#admin-content th, #admin-content td {
  border: none;
  border-bottom: 1px solid #ddd;
  padding: 12px;
  text-align: left;
}

#admin-content th {
  background-color: #f8f8f8;
  font-weight: bold;
}

#admin-content tr:hover {
  background-color: #f1f1f1;
}

/* Button styling within tables */
#admin-content td button {
  width: auto;
  padding: 6px 12px;
  font-size: 0.9em;
  margin-right: 5px;
}

.del, .del-artikel, .del-association {
  background-color: var(--color-error);
}
.del:hover, .del-artikel:hover, .del-association:hover {
  background-color: #DC2626;
}

.edit, .edit-artikel, .edit-association {
  background-color: var(--color-info);
}
.edit:hover, .edit-artikel:hover, .edit-association:hover {
  background-color: #2563EB;
}

/* Tab styles (moved from admin.html) */
.tab {
  overflow: hidden;
  border-bottom: 1px solid #ccc;
  margin-bottom: 20px;
}
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.3s;
  border-radius: 6px 6px 0 0;
  margin-right: 5px;
  color: #333;
  width: auto; /* Override general button width */
}
.tab button:hover {
  background-color: var(--color-bg-tertiary);
}
.tab button.active {
  background-color: var(--color-primary);
  color: white;
}
.tabcontent {
  display: none;
  animation: fadeEffect 0.5s;
}

@keyframes fadeEffect {
  from {opacity: 0;}
  to {opacity: 1;}
}

.tabcontent.active {
  display: block;
}



/* Grid layout for import/export/clear sections */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grid-item h3 {
    margin-bottom: 0;
    font-size: 1.2em;
    border: none;
}

/* Style for the sensitive Tools tab */
.tab button[data-tab='Verktyg'].active,
.tab button[data-tab='Verktyg'] {
  background-color: #c82333;
  color: white;
}
.tab button[data-tab='Verktyg']:hover {
  background-color: #a71d2a;
}

/* === Robust styles for Sats Edit Modal === */
.sats-edit-modal {
  width: 95vw;
  max-width: 800px;
  height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.sats-edit-modal h3 {
  padding: 20px;
  margin: 0;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.sats-edit-modal form {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
}

.modal-body {
  overflow-y: auto;
  padding: 20px;
  flex-grow: 1;
}

.modal-footer {
  flex-shrink: 0;
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8f9fa;
}

/* === Modern Search Component === */
.search-container {
  position: relative;
  margin-bottom: var(--space-xl);
}

.search-input-wrapper {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-xs);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--color-border-light);
  transition: all var(--transition-base);
}

.search-input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--color-primary-light);
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  padding: var(--space-sm) var(--space-md);
  margin: 0;
  font-size: 1rem;
}

.search-input-wrapper input:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

.search-input-wrapper button {
  width: auto;
  min-width: 48px;
  padding: var(--space-sm) var(--space-lg);
  flex-shrink: 0;
  box-shadow: none;
  border-radius: var(--radius-lg);
}

#results {
  margin-top: var(--space-md);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  max-height: 400px;
  overflow-y: auto;
}

#results .search-result-item {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

#results .search-result-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
  transform: scaleX(0);
  transition: transform var(--transition-base);
  transform-origin: left;
}

#results .search-result-item:hover::before {
  transform: scaleX(1);
}

#results .search-result-item:last-child {
  border-bottom: none;
}

#results .search-result-item:hover {
  background-color: var(--color-bg-tertiary);
  padding-left: calc(var(--space-lg) + var(--space-sm));
}

#results .search-result-item:active {
  background-color: var(--color-primary-light);
}

.result-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.result-description {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Cleanup old styles */
.modal-content.large { /* This is now handled by .sats-edit-modal */
  text-align: left;
}

/* === Login Page Styles === */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: transparent; /* show themed background */
}

.login-container {
  background-color: rgba(255, 255, 255, 0.85);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 400px;
}

.login-container h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #E67E22; /* accent color */
  font-weight: 600;
  font-size: 2.2rem; /* larger title */
}

/* Visually hidden (keep for accessibility, hide label text) */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.login-container .form-group {
  margin-bottom: 1rem;
}

.login-container .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #555;
}

.login-container input,
.login-container select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.login-container button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: var(--radius-lg);
  background-color: var(--color-primary);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.login-container button[type="submit"]:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.login-container .error {
  color: #dc3545;
  text-align: center;
  margin-top: 1rem;
}

.login-container .login-attribution {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.55);
}

body.dark .login-container .login-attribution {
  color: rgba(255, 255, 255, 0.6);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .login-container {
    padding: 1.5rem;
  }
}

/* === Button Styles === */
.btn-confirm {
  background-color: var(--color-success);
}
.btn-confirm:hover {
  background-color: var(--color-primary-hover);
}

.btn-cancel {
  background-color: var(--color-text-secondary);
  color: white;
}
.btn-cancel:hover {
  background-color: var(--color-text-primary);
}

.error-boundary {
  padding: 20px;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  border-radius: 5px;
}

.user-list-wrapper {
  max-height: 220px;
  overflow-y: auto;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   DARK MODE STYLES
   ============================================ */

/* Body and backgrounds */
body.dark {
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

/* Form inputs */
body.dark input,
body.dark select,
body.dark textarea {
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border-color: var(--color-border-medium);
}

body.dark input::placeholder {
  color: var(--color-text-tertiary);
}

body.dark input:focus,
body.dark select:focus,
body.dark textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Tables */
body.dark table {
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

body.dark th {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

body.dark td {
  border-color: var(--color-border-light);
  color: var(--color-text-primary);
}

body.dark tbody tr:hover {
  background-color: var(--color-bg-tertiary);
}

/* Cards and sections */
body.dark .card,
body.dark .admin-section {
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

/* Navigation tabs */
body.dark .tabs-container {
  background: rgba(30, 30, 30, 0.95);
  border-color: var(--color-border-light);
}

body.dark .tabs-container .tabs button {
  color: var(--color-text-secondary);
}

body.dark .tabs-container .tabs button:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

body.dark .tabs-container .tabs button.active {
  background-color: var(--color-primary);
  color: white;
}

/* Old tab styles */
body.dark .tab {
  border-bottom-color: var(--color-border-light);
}

body.dark .tab button {
  color: var(--color-text-secondary);
}

body.dark .tab button:hover {
  background-color: var(--color-bg-tertiary);
}

body.dark .tab button.active {
  background-color: var(--color-primary);
  color: white;
}

/* Cart */
body.dark #cart {
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

body.dark #cart li {
  background-color: var(--color-bg-secondary);
  border-bottom-color: var(--color-border-light);
}

body.dark #cart li:hover {
  background-color: var(--color-bg-tertiary);
}

body.dark #cart li > span:first-child {
  color: var(--color-text-primary);
}

body.dark #cart li input[type="number"] {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border-color: var(--color-border-medium);
}

/* Lists */
body.dark ul li {
  border-bottom-color: var(--color-border-light);
}

body.dark ul li:hover {
  background-color: var(--color-bg-tertiary);
}

/* Modals */
body.dark .modal-overlay {
  background-color: rgba(0, 0, 0, 0.75);
}

body.dark .modal,
body.dark .modal-content {
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

body.dark .modal h3,
body.dark .modal-content h3 {
  color: var(--color-text-primary);
}

body.dark .modal p {
  color: var(--color-text-secondary);
}

body.dark .modal-footer {
  background-color: var(--color-bg-tertiary);
  border-top-color: var(--color-border-light);
}

/* Search results */
body.dark #results {
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

body.dark #results .search-result-item {
  border-bottom-color: var(--color-border-light);
}

body.dark #results .search-result-item:hover {
  background-color: var(--color-bg-tertiary);
}

body.dark .result-title {
  color: var(--color-text-primary);
}

body.dark .result-description {
  color: var(--color-text-secondary);
}

body.dark .search-results-list {
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-light);
}

body.dark .search-results-list li {
  border-bottom-color: var(--color-border-light);
  color: var(--color-text-primary);
}

body.dark .search-results-list li:hover {
  background-color: var(--color-bg-tertiary);
}

/* Search input wrapper */
body.dark .search-input-wrapper {
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-medium);
}

body.dark .search-input-wrapper:focus-within {
  border-color: var(--color-primary);
}

body.dark .search-input-wrapper input {
  color: var(--color-text-primary);
}

/* Headings */
body.dark h1,
body.dark h2,
body.dark h3,
body.dark h4,
body.dark h5,
body.dark h6 {
  color: var(--color-text-primary);
}

/* Labels */
body.dark label {
  color: var(--color-text-secondary);
}

/* Login page */
body.dark .login-container {
  background-color: rgba(30, 30, 30, 0.95);
}

body.dark .login-container h2 {
  color: var(--color-primary);
}

body.dark .login-container .form-group label {
  color: var(--color-text-secondary);
}

/* Help and toggle buttons */
body.dark .view-help .help-icon,
body.dark .tabs-actions .theme-toggle {
  background-color: var(--color-bg-tertiary);
  color: var(--color-info);
}

body.dark .view-help .help-icon:hover,
body.dark .tabs-actions .theme-toggle:hover {
  background-color: var(--color-border-medium);
}

/* Notifications */
body.dark .notification {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Admin content */
body.dark #admin-content th {
  background-color: var(--color-bg-tertiary);
}

body.dark #admin-content tr:hover {
  background-color: var(--color-bg-tertiary);
}

body.dark .admin-section h2,
body.dark .admin-section h3 {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-border-light);
}

/* Sats edit modal */
body.dark .sats-edit-modal h3 {
  border-bottom-color: var(--color-border-light);
}

body.dark .sats-edit-modal .table-responsive-wrapper {
  border-color: var(--color-border-light);
}

/* Error boundary */
body.dark .error-boundary {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
}
