/* QM Dokumentenmanagement - Custom Styles */

/* HELO Systems Corporate Identity - Custom Variables */
:root {
  --helo-primary: #003148;        /* HELO Navy */
  --helo-secondary: #98CEC7;      /* HELO Teal */
  --helo-accent: #6eb1e4;         /* Accent blue */
  --helo-success: #38a169;        /* Professional green */
  --helo-warning: #d69e2e;        /* Professional orange */
  --helo-danger: #e53e3e;         /* Error red */
  --helo-gray-50: #f7fafc;        /* Very light gray */
  --helo-gray-100: #edf2f7;       /* Light gray */
  --helo-gray-200: #e2e8f0;       /* Border gray */
  --helo-gray-600: #718096;       /* Medium gray */
  --helo-gray-700: #4a5568;       /* Dark gray */
  --helo-gray-900: #1a202c;       /* Almost black */

  /* Bootstrap overrides */
  --bs-primary: #003148;
  --bs-primary-rgb: 0, 49, 72;
  --bs-link-color: #003148;
  --bs-link-hover-color: #00222f;

  /* Legacy support */
  --primary-blue: var(--helo-primary);
  --secondary-blue: var(--helo-gray-600);
  --warning-yellow: var(--helo-warning);
  --success-green: var(--helo-success);
  --danger-red: var(--helo-danger);
  --info-blue: var(--helo-secondary);
  --light-gray: var(--helo-gray-50);
  --dark-gray: var(--helo-gray-700);

  --border-radius: 0.5rem;
  --box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Typography */
  --font-family-primary: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-family-mono: 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* HELO Systems Body and Layout */
body {
  font-family: var(--font-family-primary);
  background-color: var(--helo-gray-50);
  color: var(--helo-gray-900);
  line-height: 1.6;
}

/* HELO Systems Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--helo-primary);
  line-height: 1.3;
}

/* HELO Systems Logo Styles */
.helo-logo {
  height: 40px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.helo-logo-footer {
  height: 30px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
}

.text-primary { color: var(--helo-primary) !important; }
.text-secondary { color: var(--helo-secondary) !important; }

/* HELO Systems specific classes */
.helo-brand {
  color: var(--helo-primary);
  font-weight: 700;
}

.helo-tagline {
  font-size: 1.1rem;
  color: var(--helo-gray-600);
  font-weight: 500;
  margin-bottom: 0;
}

.helo-highlight {
  background-color: var(--helo-accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  display: inline-block;
}

/* HELO Systems Navigation */
.navbar {
  background: var(--helo-primary) !important;
  border-bottom: 3px solid var(--helo-accent);
  box-shadow: var(--box-shadow);
  padding: 1rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: white !important;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.navbar-brand .brand-main {
  font-size: 1.25rem;
  font-weight: 700;
}

.navbar-brand .brand-sub {
  font-size: 0.8rem;
  color: var(--helo-accent);
  font-weight: 400;
}

.navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
}

.navbar-nav .nav-link:hover {
  color: white !important;
  background-color: var(--helo-secondary);
}

.navbar-nav .nav-link.active {
  background-color: var(--helo-accent);
  color: white !important;
}

/* HELO Systems Card Improvements */
.card {
  border: 1px solid var(--helo-gray-200);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: all 0.2s ease;
  background: white;
}

.card:hover {
  box-shadow: var(--box-shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  background: var(--helo-gray-50);
  border-bottom: 2px solid var(--helo-gray-200);
  font-weight: 600;
  color: var(--helo-primary);
  padding: 1.25rem 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* HELO Systems specific card types */
.card-helo-primary {
  border-left: 4px solid var(--helo-primary);
}

.card-helo-secondary {
  border-left: 4px solid var(--helo-secondary);
}

.card-helo-success {
  border-left: 4px solid var(--helo-success);
}

.card-helo-warning {
  border-left: 4px solid var(--helo-warning);
}

.card-stats {
  background: var(--helo-primary);
  color: white;
  border: none;
}

/* Dashboard Primär-Karte (Meine Dokumente) — theme-aware */
.card.card-stats-primary,
.card.card-stats-primary .card-body {
  background-color: #003148 !important;
  border: none !important;
  color: #ffffff !important;
}
.card.card-stats-primary h3,
.card.card-stats-primary p,
.card.card-stats-primary small,
.card.card-stats-primary .card-body * {
  color: #ffffff !important;
}
[data-theme="dark"] .card.card-stats-primary,
[data-theme="dark"] .card.card-stats-primary .card-body {
  background-color: #345c6f !important;
}

.card-stats .card-body {
  text-align: center;
  padding: 2rem 1.5rem;
}

.card-stats h3 {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
}

.card-stats p {
  opacity: 0.9;
  font-weight: 500;
}

/* Bootstrap-Color-Cards (z.B. Public Portal Statistik):
   themes.css setzt .card-body auf den Theme-Hintergrund, dadurch werden bg-success/primary/info/warning
   überdeckt. Hier explizit transparent setzen + Text in Weiß, damit die Bootstrap-Utility durchscheint. */
.card.bg-success > .card-body,
.card.bg-primary > .card-body,
.card.bg-info    > .card-body,
.card.bg-warning > .card-body,
.card.bg-danger  > .card-body,
.card.bg-secondary > .card-body {
  background-color: transparent !important;
  color: #ffffff !important;
}
.card.bg-success > .card-body *,
.card.bg-primary > .card-body *,
.card.bg-info    > .card-body *,
.card.bg-warning > .card-body *,
.card.bg-danger  > .card-body *,
.card.bg-secondary > .card-body * {
  color: #ffffff !important;
}

/* Document Status Badges */
.badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
}

/* Status Colors */
.status-draft { background-color: var(--secondary-blue) !important; }
.status-submitted-for-qm { background-color: var(--warning-yellow) !important; color: #212529 !important; }
.status-qm-approved { background-color: var(--info-blue) !important; }
.status-published { background-color: var(--success-green) !important; }
.status-archived { background-color: var(--dark-gray) !important; }

/* Document List Styling */
.document-row {
  transition: all 0.2s ease;
  background-color: white;
}

.document-row:hover {
  background-color: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,.1);
}

.document-row.border-warning {
  border-left: 4px solid var(--warning-yellow) !important;
}

.document-row.border-info {
  border-left: 4px solid var(--info-blue) !important;
}

.document-row.border-success {
  border-left: 4px solid var(--success-green) !important;
}

/* Editor Improvements */
.CodeMirror {
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  min-height: 400px;
}

.CodeMirror-focused {
  border-color: var(--helo-primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 49, 72, 0.25);
}

.editor-toolbar {
  border-top: 1px solid #ddd;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  border-bottom: none;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  background-color: #f8f9fa;
}

.editor-toolbar button {
  color: #6c757d;
  border: none;
  background: none;
  margin: 0;
  padding: 8px;
}

.editor-toolbar button:hover {
  background-color: #e9ecef;
  color: #495057;
}

.editor-toolbar.disabled-for-preview button {
  opacity: 0.5;
  pointer-events: none;
}

/* Preview styling */
#preview-content {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
}

#preview-content h1,
#preview-content h2,
#preview-content h3,
#preview-content h4,
#preview-content h5,
#preview-content h6 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--primary-blue);
}

#preview-content h1 { font-size: 2rem; border-bottom: 2px solid #e9ecef; padding-bottom: 0.5rem; }
#preview-content h2 { font-size: 1.75rem; border-bottom: 1px solid #e9ecef; padding-bottom: 0.25rem; }
#preview-content h3 { font-size: 1.5rem; }
#preview-content h4 { font-size: 1.25rem; }

#preview-content code {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.875rem;
  color: var(--danger-red);
}

#preview-content pre {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 1rem;
  overflow-x: auto;
}

#preview-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #333;
}

#preview-content blockquote {
  border-left: 4px solid var(--primary-blue);
  padding-left: 1rem;
  margin-left: 0;
  color: #6c757d;
  font-style: italic;
}

#preview-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

#preview-content th,
#preview-content td {
  border: 1px solid #dee2e6;
  padding: 0.75rem;
  text-align: left;
}

#preview-content th {
  background-color: var(--light-gray);
  font-weight: 600;
}

/* Dashboard Statistics */
.stats-card {
  border-left: 4px solid;
  transition: transform 0.2s ease;
}

.stats-card:hover {
  transform: translateY(-2px);
}

.stats-card.stats-primary { border-left-color: var(--primary-blue); }
.stats-card.stats-warning { border-left-color: var(--warning-yellow); }
.stats-card.stats-info { border-left-color: var(--info-blue); }
.stats-card.stats-success { border-left-color: var(--success-green); }

/* Workflow indicators */
.workflow-step {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  background-color: #f8f9fa;
  border-left: 4px solid #dee2e6;
}

.workflow-step.active {
  background-color: #e7f3ff;
  border-left-color: var(--primary-blue);
}

.workflow-step.completed {
  background-color: #d4edda;
  border-left-color: var(--success-green);
}

.workflow-step.rejected {
  background-color: #f8d7da;
  border-left-color: var(--danger-red);
}

/* Spinner and Loading States */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request.htmx-indicator {
  display: inline-block;
}

/* Auto-save indicator */
#autosave-status {
  padding: 0.5rem;
  border-radius: var(--border-radius);
  background-color: #f8f9fa;
}

/* Markdown help table */
.markdown-help table {
  font-size: 0.875rem;
}

.markdown-help code {
  font-size: 0.75rem;
  background-color: #f8f9fa;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

/* Public portal styling */
.public-document {
  border-left: 4px solid var(--success-green);
}

.public-document .card-header {
  background-color: #d4edda;
  border-bottom: 1px solid #c3e6cb;
}

/* Form enhancements */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  opacity: .65;
  transform: scale(.85) translateY(-0.5rem) translateX(0.15rem);
}

.form-control:focus {
  border-color: var(--helo-primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 49, 72, 0.25);
}

/* HELO Systems Button improvements */
.btn {
  font-weight: 600;
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
  border: 2px solid;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.15);
}

.btn-primary {
  background: var(--helo-primary);
  border-color: var(--helo-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--helo-primary-dark, #00222f);
  border-color: var(--helo-primary-dark, #00222f);
  transform: translateY(-1px);
  box-shadow: var(--box-shadow-lg);
}

.btn-outline-primary {
  color: var(--helo-primary);
  border-color: var(--helo-primary);
}

.btn-outline-primary:hover {
  background-color: var(--helo-primary);
  border-color: var(--helo-primary);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--helo-success);
  border-color: var(--helo-success);
}

.btn-warning {
  background-color: var(--helo-warning);
  border-color: var(--helo-warning);
  color: white;
}

.btn-danger {
  background-color: var(--helo-danger);
  border-color: var(--helo-danger);
}

/* HELO Systems Call-to-Action Button */
.btn-helo-primary {
  background: var(--helo-primary);
  border: none;
  color: white;
  font-weight: 700;
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  box-shadow: var(--box-shadow);
}

.btn-helo-primary:hover {
  background: var(--helo-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--box-shadow-lg);
  color: white;
}

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid #dee2e6;
}

/* =================================================
   MOBILE-FIRST RESPONSIVE IMPROVEMENTS
   ================================================= */

/* Mobile Base (up to 575px) */
@media (max-width: 575px) {
  /* Touch-friendly spacing and sizing */
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  /* Touch targets - minimum 44px */
  .btn {
    min-height: 44px;
    font-size: 0.875rem;
    padding: 0.75rem 1.25rem;
  }
  
  .btn-sm {
    min-height: 36px;
    padding: 0.5rem 1rem;
  }
  
  /* Forms touch-friendly */
  .form-control,
  .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.75rem;
  }
  
  /* Navigation mobile-optimized */
  .navbar {
    padding: 0.5rem 0;
  }
  
  .navbar-brand {
    font-size: 1rem;
  }
  
  .navbar-brand .brand-text {
    display: none; /* Hide subtitle on very small screens */
  }
  
  .navbar-nav .nav-link {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  /* Cards mobile-optimized */
  .card {
    margin-bottom: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-header {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Typography for readability */
  body {
    font-size: 0.9rem;
    line-height: 1.6;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.35rem;
  }
  
  h3 {
    font-size: 1.2rem;
  }
  
  /* Dashboard specific mobile improvements */
  .stats-card .card-body {
    padding: 1rem;
    text-align: center;
  }
  
  .stats-card h3 {
    font-size: 1.75rem;
  }
  
  .efficiency-metric {
    margin-bottom: 1rem;
    padding: 1rem;
  }
  
  .efficiency-metric .metric-value {
    font-size: 1.5rem;
  }
  
  /* Process steps mobile layout */
  .process-step {
    flex-direction: column;
    text-align: center;
    padding: 0.75rem;
  }
  
  .process-step .step-icon {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  /* Table mobile improvements */
  .table-responsive {
    border: none;
  }
  
  .table {
    font-size: 0.8rem;
  }
  
  /* Document list mobile-friendly */
  .document-row {
    padding: 1rem;
  }
  
  .document-row .row {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .document-row .col-md-6,
  .document-row .col-md-2 {
    text-align: left !important;
  }
  
  /* Modal improvements */
  .modal-dialog {
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }
  
  /* Footer mobile */
  footer .row {
    text-align: center;
  }
  
  footer .col-md-6 {
    margin-bottom: 1.5rem;
  }
}

/* Tablet Portrait (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* Touch targets still important */
  .btn {
    min-height: 40px;
    padding: 0.625rem 1.125rem;
  }
  
  .form-control,
  .form-select {
    min-height: 40px;
    font-size: 15px;
  }
  
  .navbar-brand .brand-text {
    display: flex; /* Show subtitle again on tablet */
  }
  
  .card-body {
    padding: 1.25rem;
  }
  
  /* Dashboard layout improvements */
  .stats-card h3 {
    font-size: 2rem;
  }
  
  .efficiency-metric .metric-value {
    font-size: 1.75rem;
  }
}

/* Tablet Landscape (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .navbar-brand {
    font-size: 1.1rem;
  }
  
  .btn {
    font-size: 0.875rem;
  }
  
  /* Editor improvements for tablet */
  .CodeMirror {
    min-height: 300px;
  }
}

/* =================================================
   MOBILE NAVIGATION IMPROVEMENTS
   ================================================= */

/* Mobile menu improvements */
@media (max-width: 991px) {
  .navbar-toggler {
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 0.75rem;
  }
  
  .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
  }
  
  .navbar-collapse {
    background-color: rgba(26, 54, 93, 0.95);
    margin-top: 1rem;
    border-radius: var(--border-radius);
    padding: 1rem;
  }
  
  .navbar-nav {
    gap: 0.5rem;
  }
  
  .navbar-nav .nav-item {
    width: 100%;
  }
  
  .navbar-nav .nav-link {
    border-radius: var(--border-radius);
    margin: 0;
  }
  
  /* Dropdown improvements */
  .dropdown-menu {
    position: static !important;
    transform: none !important;
    box-shadow: none;
    border: none;
    background-color: rgba(43, 108, 176, 0.9);
    margin-top: 0.5rem;
  }
  
  .dropdown-item {
    color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1rem;
  }
  
  .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
  }
}

/* =================================================
   TOUCH-OPTIMIZED FORM CONTROLS
   ================================================= */

/* Touch-friendly form improvements */
@media (max-width: 768px) {
  .form-floating > .form-control {
    height: 48px;
    font-size: 16px; /* Prevent iOS zoom */
  }
  
  .form-floating > label {
    padding: 1rem 0.75rem;
  }
  
  /* Checkbox and radio improvements */
  .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
  }
  
  .form-check-label {
    padding-left: 0.5rem;
    line-height: 1.25rem;
  }
  
  /* Select dropdown improvements */
  .form-select {
    background-size: 24px 24px;
    padding-right: 3rem;
  }
  
  /* Button group improvements */
  .btn-group .btn {
    padding: 0.75rem;
    min-width: 44px;
  }
}

/* =================================================
   EDITOR MOBILE OPTIMIZATIONS
   ================================================= */

@media (max-width: 768px) {
  /* SimpleMDE mobile improvements */
  .CodeMirror {
    min-height: 250px;
    font-size: 14px;
  }
  
  .editor-toolbar {
    padding: 0.5rem;
    flex-wrap: wrap;
  }
  
  .editor-toolbar button {
    margin: 0.125rem;
    padding: 0.5rem;
    min-width: 40px;
    min-height: 40px;
  }
  
  /* Hide less important toolbar buttons on mobile */
  .editor-toolbar .fa-header,
  .editor-toolbar .fa-table,
  .editor-toolbar .fa-quote-left {
    display: none;
  }
  
  /* Preview improvements */
  #preview-content {
    font-size: 0.9rem;
    padding: 1rem;
  }
  
  #preview-content h1,
  #preview-content h2,
  #preview-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  /* Editor mode toggle */
  .btn-group .btn-check + .btn {
    min-height: 44px;
  }
}

/* =================================================
   DOCUMENT LIST MOBILE LAYOUT
   ================================================= */

@media (max-width: 768px) {
  .document-row {
    border-left: 4px solid var(--helo-gray-200);
  }
  
  .document-row.border-warning {
    border-left-color: var(--helo-warning) !important;
  }
  
  .document-row.border-success {
    border-left-color: var(--helo-success) !important;
  }
  
  .document-row .row > div {
    margin-bottom: 0.75rem;
  }
  
  .document-row .row > div:last-child {
    margin-bottom: 0;
  }
  
  /* Status badge always full width on mobile */
  .document-row .badge {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
  }
  
  /* Action buttons mobile */
  .document-row .dropdown-toggle {
    width: 100%;
    justify-content: center;
  }
}

/* =================================================
   LOGIN PAGE MOBILE OPTIMIZATIONS
   ================================================= */

@media (max-width: 768px) {
  /* Login card full width on mobile */
  .min-vh-100 {
    min-height: auto;
    padding: 2rem 0;
  }
  
  .card.shadow-lg {
    box-shadow: var(--box-shadow) !important;
    margin: 1rem;
  }
  
  .card-body.p-5 {
    padding: 2rem !important;
  }
  
  /* Demo section improvements */
  .col-md-4 {
    margin-bottom: 1rem;
  }
  
  .col-md-4 .text-center {
    padding: 1rem;
  }
  
  .col-md-4 code {
    font-size: 0.8rem;
    word-break: break-all;
  }
}

/* =================================================
   ACCESSIBILITY IMPROVEMENTS
   ================================================= */

/* Focus improvements for touch navigation */
@media (max-width: 768px) {
  .btn:focus,
  .form-control:focus,
  .form-select:focus {
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.25);
  }
  
  /* Skip link for keyboard navigation */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--helo-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 0 0 4px 4px;
  }
  
  .skip-link:focus {
    top: 0;
  }
}

/* =================================================
   HORIZONTAL SCROLL TABLES
   ================================================= */

/* Table scroll improvements */
@media (max-width: 768px) {
  .table-responsive {
    border: 1px solid var(--helo-gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
  }
  
  .table-responsive .table {
    margin-bottom: 0;
    white-space: nowrap;
  }
  
  .table-responsive .table td,
  .table-responsive .table th {
    padding: 0.75rem 0.5rem;
    min-width: 120px;
  }
  
  /* Horizontal scroll indicator */
  .table-responsive::after {
    content: "← Zum Scrollen wischen →";
    display: block;
    text-align: center;
    color: var(--helo-gray-600);
    font-size: 0.75rem;
    padding: 0.5rem;
    background-color: var(--helo-gray-50);
    border-top: 1px solid var(--helo-gray-200);
  }
}

/* =================================================
   PERFORMANCE OPTIMIZATIONS
   ================================================= */

/* Reduce animations on mobile for performance */
@media (max-width: 768px) {
  .card:hover {
    transform: none;
    transition: none;
  }
  
  .document-row:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
}

/* Enhanced Dark Mode Support */
.dark-mode {
  --helo-bg-primary: #1a202c;
  --helo-bg-secondary: #2d3748;
  --helo-bg-tertiary: #4a5568;
  --helo-text-primary: #e2e8f0;
  --helo-text-secondary: #a0aec0;
  --helo-text-muted: #718096;
  --helo-border: #4a5568;
  --helo-shadow: rgba(0, 0, 0, 0.3);
  
  background-color: var(--helo-bg-primary);
  color: var(--helo-text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Dark mode cards and components */
.dark-mode .card,
.dark-mode .modal-content,
.dark-mode .dropdown-menu {
  background-color: var(--helo-bg-secondary);
  border-color: var(--helo-border);
  color: var(--helo-text-primary);
  box-shadow: 0 4px 6px var(--helo-shadow);
}

.dark-mode .card-header,
.dark-mode .card-footer {
  background-color: var(--helo-bg-tertiary);
  border-color: var(--helo-border);
}

/* Dark mode navigation */
.dark-mode .navbar {
  background-color: var(--helo-bg-secondary) !important;
  border-bottom: 1px solid var(--helo-border);
}

.dark-mode .navbar-brand,
.dark-mode .nav-link {
  color: var(--helo-text-primary) !important;
}

.dark-mode .nav-link:hover {
  color: #63b3ed !important;
}

/* Dark mode forms */
.dark-mode .form-control,
.dark-mode .form-select {
  background-color: var(--helo-bg-tertiary);
  border-color: var(--helo-border);
  color: var(--helo-text-primary);
}

.dark-mode .form-control:focus,
.dark-mode .form-select:focus {
  background-color: var(--helo-bg-tertiary);
  border-color: #63b3ed;
  color: var(--helo-text-primary);
  box-shadow: 0 0 0 0.25rem rgba(99, 179, 237, 0.25);
}

/* Dark mode buttons */
.dark-mode .btn-outline-primary {
  color: #63b3ed;
  border-color: #63b3ed;
}

.dark-mode .btn-outline-primary:hover {
  background-color: #63b3ed;
  color: var(--helo-bg-primary);
}

/* Dark mode tables */
.dark-mode .table {
  color: var(--helo-text-primary);
}

.dark-mode .table-striped > tbody > tr:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Dark mode footer */
.dark-mode footer {
  background-color: var(--helo-bg-secondary);
  border-color: var(--helo-border);
  color: var(--helo-text-primary);
}

/* Dark mode text utilities */
.dark-mode .text-muted {
  color: var(--helo-text-muted) !important;
}

.dark-mode .text-body {
  color: var(--helo-text-primary) !important;
}

/* Dark mode badges */
.dark-mode .badge.bg-secondary {
  background-color: var(--helo-bg-tertiary) !important;
}

/* Dark mode alerts */
.dark-mode .alert {
  border: 1px solid var(--helo-border);
}

.dark-mode .alert-info {
  background-color: rgba(99, 179, 237, 0.1);
  border-color: rgba(99, 179, 237, 0.3);
  color: #90cdf4;
}

.dark-mode .alert-success {
  background-color: rgba(72, 187, 120, 0.1);
  border-color: rgba(72, 187, 120, 0.3);
  color: #9ae6b4;
}

.dark-mode .alert-warning {
  background-color: rgba(214, 158, 46, 0.1);
  border-color: rgba(214, 158, 46, 0.3);
  color: #faf089;
}

.dark-mode .alert-danger {
  background-color: rgba(229, 62, 62, 0.1);
  border-color: rgba(229, 62, 62, 0.3);
  color: #feb2b2;
}

/* Dark mode borders */
.dark-mode .border,
.dark-mode .border-top,
.dark-mode .border-bottom,
.dark-mode .border-start,
.dark-mode .border-end {
  border-color: var(--helo-border) !important;
}

/* Dark mode theme transition */
* {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* HELO Systems Process Flow Indicators */
.process-step {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 0.75rem;
  background-color: var(--helo-gray-50);
  border-left: 4px solid var(--helo-gray-200);
  transition: all 0.2s ease;
}

.process-step.active {
  background-color: #e6f3ff;
  border-left-color: var(--helo-primary);
  box-shadow: var(--box-shadow);
}

.process-step.completed {
  background-color: #f0fff4;
  border-left-color: var(--helo-success);
}

.process-step.rejected {
  background-color: #fff5f5;
  border-left-color: var(--helo-danger);
}

.process-step .step-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--helo-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  flex-shrink: 0;
}

.process-step.active .step-icon {
  background-color: var(--helo-primary);
  color: white;
}

.process-step.completed .step-icon {
  background-color: var(--helo-success);
  color: white;
}

/* HELO Systems KMU-focused components */
.kmu-tip {
  background: #f0f8ff;
  border-left: 4px solid var(--helo-accent);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
}

.kmu-tip .tip-icon {
  color: var(--helo-accent);
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

.efficiency-metric {
  text-align: center;
  padding: 1.5rem;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border-top: 3px solid var(--helo-accent);
}

.efficiency-metric .metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--helo-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.efficiency-metric .metric-label {
  font-size: 0.9rem;
  color: var(--helo-gray-600);
  font-weight: 500;
}

.efficiency-metric .metric-change {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.efficiency-metric .metric-change.positive {
  color: var(--helo-success);
}

.efficiency-metric .metric-change.negative {
  color: var(--helo-danger);
}

/* HELO Systems Footer enhancements */
footer {
  background: var(--helo-gray-50) !important;
  border-top: 3px solid var(--helo-primary) !important;
}

/* Print styles for HELO Systems */
@media print {
  .navbar,
  .btn,
  .dropdown,
  #autosave-status {
    display: none !important;
  }
  
  .card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
  }
  
  .container-fluid {
    max-width: none !important;
  }
  
  /* HELO Systems print header */
  @page {
    margin: 2cm;
    @top-left {
      content: "HELO Systems - QM Dokumentenmanagement";
    }
    @top-right {
      content: "ISO 9001 konform";
    }
  }
  
  body::before {
    content: "HELO Systems QM | Mehr AN statt IN Ihrem Unternehmen arbeiten";
    display: block;
    text-align: center;
    font-weight: bold;
    padding: 1rem;
    border-bottom: 2px solid var(--helo-primary);
    margin-bottom: 2rem;
    color: var(--helo-primary);
  }
}

/* Responsive enhancements for KMU mobile usage */
@media (max-width: 768px) {
  .helo-tagline {
    font-size: 1rem;
  }
  
  .efficiency-metric {
    margin-bottom: 1rem;
  }
  
  .efficiency-metric .metric-value {
    font-size: 1.5rem;
  }
  
  .process-step {
    flex-direction: column;
    text-align: center;
    padding: 0.75rem;
  }
  
  .process-step .step-icon {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  .navbar-brand .brand-text {
    display: none;
  }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
  :root {
    --helo-primary: #000080;
    --helo-secondary: #0066cc;
    --helo-gray-600: #333333;
  }
  
  .card {
    border: 2px solid #333 !important;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Responsive Bilder in Dokumenten — nie breiter als Container */
.document-content img,
.markdown-body img,
.rendered-content img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  margin: 0.5rem 0;
}
