/* Modernized Farbpalette und Fonts */
:root {
  --primary-color: #007bff; /* Bootstrap primary */
  --secondary-color: #6c757d; /* Bootstrap secondary */
  --success-color: #28a745; /* Bootstrap success */
  --danger-color: #dc3545; /* Bootstrap danger */
  --info-color: #17a2b8; /* Bootstrap info */
  --warning-color: #ffc107; /* Bootstrap warning */
  --light-color: #f8f9fa; /* Bootstrap light */
  --dark-color: #343a40; /* Bootstrap dark */

  --background-light: #f4f7f6; /* Softer light background */
  --background-dark: #1a202c; /* Dark background */
  --text-light: #2d3748; /* Dark text for light mode */
  --text-dark: #e2e8f0; /* Light text for dark mode */

  --card-bg-light: #ffffff;
  --card-bg-dark: #2d3748; /* Dark card background */
  --card-border-light: rgba(0, 0, 0, 0.125);
  --card-border-dark: rgba(255, 255, 255, 0.125);

  --border-radius: 0.5rem; /* Slightly smaller border radius */
  --shadow: rgba(0, 0, 0, 0.1); /* Softer shadow */

  --font-family-sans-serif: 'Inter', sans-serif;
  --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Prevent flash of light theme when dark theme is activated */
html.theme-dark {
  background-color: var(--background-dark);
  color: var(--text-dark);
}

html.theme-dark body {
  background-color: var(--background-dark);
  color: var(--text-dark);
}

html.theme-dark .list-group-item {
  background-color: var(--card-bg-dark);
  border-color: var(--card-border-dark);
  color: var(--text-dark);
}

html.theme-dark .modal-content {
  background-color: var(--card-bg-dark);
  border-color: var(--card-border-dark);
  color: var(--text-dark);
}

html.theme-dark .card {
  background-color: var(--card-bg-dark);
  border-color: var(--card-border-dark);
}

html.theme-dark .navbar {
  background-color: var(--dark-color) !important;
}

html.theme-dark .form-control {
  background-color: var(--card-bg-dark);
  color: var(--text-dark);
  border-color: rgba(255, 255, 255, 0.3);
}

html.theme-dark .footer {
  background-color: var(--dark-color) !important;
  color: var(--text-dark);
}

html.theme-dark .footer .fas.fa-heart {
  color: var(--info-color);
}

/* Allgemeine Styles mit neuen Fonts */
body {
  font-family: var(--font-family-sans-serif);
  background-color: var(--background-light);
  color: var(--text-light);
  transition: background-color .3s, color .3s;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.dark-mode {
  background-color: var(--background-dark);
  color: var(--text-dark);
}

/* Entfernen des Hintergrundmusters */
body::before {
  content: none;
}

/* Verbesserter Container */
.container {
  margin-top: 2rem;
  margin-bottom: 2rem;
  flex-grow: 1;
}

/* Responsive Container Max-Widths für bessere Bildschirmausnutzung */
@media (min-width: 576px) {
  .container {
    max-width: 95%; /* Small screens: 95% of viewport width */
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 90%; /* Medium screens: 90% of viewport width */
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 85%; /* Large screens: 85% of viewport width */
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 80%; /* Extra large screens: 80% of viewport width */
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 85%; /* Extra extra large screens: 75% of viewport width */
  }
}

/* Karten-Design für Inhalte */
.card {
  background-color: var(--card-bg-light);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 8px var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem; /* Increased margin */
  border: 1px solid var(--card-border-light);
}

.modal-content {
  background-color: var(--card-bg-light);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 8px var(--shadow);
  padding: 0; /* Remove padding from modal content */
  border: 1px solid var(--card-border-light);
}

body.dark-mode .card,
body.dark-mode .modal-content {
  background-color: var(--card-bg-dark);
  border-color: var(--card-border-dark);
}

.footer .fas.fa-heart {
  color: var(--info-color);
}

body.dark-mode .footer {
  background-color: var(--dark-color) !important; /* Override Bootstrap's bg-light */
  color: var(--text-dark);
}

body.dark-mode .footer .fas.fa-heart {
  color: var(--info-color);
}

/* Buttons */
.btn {
  border-radius: var(--border-radius);
  transition: all 0.2s ease-in-out; /* Smoother transition */
  font-weight: 500;
  padding: 0.5rem 1rem; /* Adjusted padding */
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: #fff;
}

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

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

/* Ensure text color is white in dark mode for danger button */
body.dark-mode .btn-danger {
  color: #fff;
}

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

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

/* Adjust outline secondary button color in dark mode */
body.dark-mode .btn-outline-secondary {
  color: rgba(255, 255, 255, 0.75); /* Lighter text color */
  border-color: rgba(255, 255, 255, 0.5); /* Lighter border color */
}

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


.btn:hover {
  transform: translateY(-1px); /* Subtle lift on hover */
  box-shadow: 0 6px 12px var(--shadow);
  opacity: 0.9;
}

/* Drag & Drop Elemente */
.draggable {
  cursor: grab;
  position: relative; /* Needed for absolute positioning of the handle */
  padding-left: 2.5rem; /* Add padding to the left to make space for the handle */
}

.draggable:active {
  cursor: grabbing;
}

.drag-handle {
  cursor: grab;
  position: absolute; /* Position the handle absolutely on the left */
  top: 0;
  left: 0;
  bottom: 0;
  width: 2rem; /* Set a fixed width for the handle area */
  display: flex; /* Use flex to center the icon */
  align-items: center;
  justify-content: center;
  /* Optional: Add a subtle background or border for debugging/visual cue */
  /* background-color: rgba(0, 123, 255, 0.1); */
  /* border-right: 1px solid rgba(0, 123, 255, 0.2); */
}

.drag-handle:active {
  cursor: grabbing;
}

/* Style for the element being dragged */
.sortable-chosen {
  opacity: 1 !important; /* Ensure the dragged element is fully visible */
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Add a stronger shadow for visual feedback */
  /* Removed transform: rotate(2deg); */
  transition: none !important; /* Prevent CSS transitions from interfering with Sortable.js positioning */
}

/* Style for the placeholder where the element will be dropped */
.sortable-ghost {
  opacity: 0.2; /* Make the placeholder semi-transparent */
  background-color: var(--primary-color); /* Highlight the drop area */
  transition: none !important; /* Prevent CSS transitions from interfering with Sortable.js positioning */
}


/* Agenda Buttons Layout */
.agenda-buttons {
  display: flex;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
  gap: 0.75rem; /* Increased gap */
  margin-bottom: 1.5rem;
  flex-direction: row; /* Default to row for desktop */
}

@media (max-width: 767px) {
  .agenda-buttons {
    flex-direction: column; /* Stack buttons on mobile */
  }

  .agenda-buttons .btn {
    width: 100%; /* Full width buttons on mobile */
  }
}

/* Container Anpassungen für mobile Geräte */
@media (max-width: 767px) {
  .container {
    padding-right: 1rem; /* Adjusted padding */
    padding-left: 1rem; /* Adjusted padding */
  }
}

/* Punkt-Aktionen Buttons */
.point-actions {
  margin-left: auto;
  display: flex;
  flex-direction: row; /* Always row for actions */
  gap: 0.5rem;
  align-items: center;
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
}

/* Point metadata styling */
.point-meta {
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Verbesserte Lesbarkeit und Konsistenz im Dark Mode */
body.dark-mode {
  background-color: var(--background-dark);
  color: var(--text-dark);
}

body.dark-mode a {
  color: var(--info-color); /* Use info color for links in dark mode */
}

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

.white {
  color: #fff !important;
}

body.dark-mode .btn {
  /* Button text color is handled by Bootstrap classes */
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode .form-control {
  background-color: var(--card-bg-dark);
  color: var(--text-dark);
  border: 1px solid rgba(255, 255, 255, 0.3); /* Slightly more visible border in dark mode */
}

body.dark-mode .card,
body.dark-mode .modal-content {
  background-color: var(--card-bg-dark);
  border-color: var(--card-border-dark);
  color: var(--text-dark); /* Ensure text inside cards is dark mode text color */
}

body.dark-mode .list-group-item {
  border-color: var(--card-border-dark);
  background-color: var(--card-bg-dark);
  color: var(--text-dark); /* Ensure text inside list items is dark mode text color */
}

body.dark-mode .list-group-item small {
  color: rgba(255, 255, 255, 0.6); /* Lighter text for timestamps in dark mode */
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
  border-color: rgba(255, 255, 255, 0.1); /* Subtle border for modal header/footer in dark mode */
}

body.dark-mode .modal-title {
  color: var(--text-dark); /* Ensure modal title is dark mode text color */
}

body.dark-mode .form-label {
  color: var(--text-dark); /* Ensure form labels are dark mode text color */
}

body.dark-mode .badge {
  /* Bootstrap handles badge colors, should be fine */
}

/* Ensure text in modals is readable in dark mode */
body.dark-mode .modal-body {
  color: var(--text-dark);
}

/* Fix for theme switch label color in dark mode */
body.dark-mode .form-check-label {
  color: var(--text-dark);
}

/* Modale Anpassungen */
.modal-header, .modal-footer {
  border: none;
  padding: 0.75rem 1rem;
}

.modal-title {
  font-weight: 700;
  font-size: 1.25rem; /* Slightly larger title */
}

.modal-body {
  padding: 1rem; /* Reduced padding */
}

.modal-footer {
  justify-content: flex-end; /* Align buttons to the right */
  gap: 0.75rem;
}

/* Adjust modal padding on mobile */
@media (max-width: 767px) {
  .modal-header, .modal-footer {
    padding: 0.5rem 0.75rem;
  }
  
  .modal-body {
    padding: 0.75rem;
  }
  
  /* Make form controls more compact on mobile */
  .modal-body .form-control {
    padding: 0.5rem 0.75rem;
    min-height: 2.5rem; /* Smaller height for inputs */
  }
  
  .modal-body textarea.form-control {
    min-height: 5rem; /* Smaller height for textareas but still enough for content */
  }
  
  .modal-body .form-label {
    margin-bottom: 0.25rem; /* Reduce space between label and input */
    font-size: 0.9rem; /* Slightly smaller font for labels */
  }
  
  /* Make modal use more screen space on mobile */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  /* Adjust modal footer buttons on mobile */
  .modal-footer .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* List group item styling */
.list-group-item {
  border: 1px solid var(--card-border-light);
  margin-bottom: 0.75rem; /* Space between list items */
  border-radius: var(--border-radius);
  background-color: var(--card-bg-light);
  transition: all 0.2s ease-in-out;
}

body.dark-mode .list-group-item {
  border-color: var(--card-border-dark);
  background-color: var(--card-bg-dark);
}

.list-group-item:last-child {
  margin-bottom: 0;
}

.list-group-item .ms-2.me-auto {
  flex-grow: 1; /* Allow the content to take up available space */
  flex-basis: 0; /* Allow the item to shrink below its content size */
  min-width: 0; /* Allow the flex item to shrink below its content size */
}

@media (max-width: 767px) {
  /* Adjust list item layout for mobile */
  .list-group-item {
    position: relative; /* For absolute positioning of action buttons and creator name */
    padding-bottom: 3rem; /* Add space at bottom for the action buttons */
  }
  
  .list-group-item .ms-2.me-auto {
    margin-left: 0.5rem !important; /* Reduce left margin on small screens */
    width: 100%; /* Ensure content takes full width */
    flex-direction: column; /* Stack content vertically */
    padding-right: 0; /* Remove right padding to allow text to use full width */
    padding-bottom: 1.5rem; /* Add space for the creator name */
  }

  .list-group-item .ms-2.me-auto > div { /* Target the div containing title and meta */
    width: 100%; /* Ensure title/meta div takes full width */
  }
  
  /* Position creator name at the bottom left */
  .list-group-item .mt-2.text-muted.small {
    position: absolute;
    bottom: 0.75rem; /* Position at the same level as action buttons */
    left: 1rem; /* Align with left padding */
    margin: 0; /* Remove margins */
  }
  
  /* Ensure description text can use full width */
  .list-group-item p {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Prevent long titles from overlapping with buttons */
  .list-group-item .fw-bold {
    display: block;
    width: 100%; /* Full width for title */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long titles */
    margin-bottom: 0.5rem;
  }
  
  /* Create a semi-transparent background for buttons to ensure visibility */
  .point-actions {
    background-color: rgba(255, 255, 255, 0.8); /* Light background */
    padding: 0.25rem;
    border-radius: var(--border-radius);
    z-index: 1; /* Ensure buttons are above content */
  }
  
  body.dark-mode .point-actions {
    background-color: rgba(45, 55, 72, 0.8); /* Dark background for dark mode */
  }
}


.list-group-item .fw-bold {
  font-size: 1.1rem; /* Slightly larger point title */
}

.list-group-item p {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  white-space: pre-wrap; /* Preserve line breaks and wrap text */
  word-break: break-word; /* Ensure long words break to prevent overflow */
}

.list-group-item small {
  display: block; /* New line for timestamp */
  margin-top: 0.25rem;
}

/* Form styling */
.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-control {
  padding: 0.75rem 1rem; /* Increased padding */
  border-radius: var(--border-radius);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Adjust form spacing in modals */
.modal-body .mb-3 {
  margin-bottom: 0.75rem !important; /* Reduce spacing between form groups in modals */
}

.modal-body .mb-3:last-child {
  margin-bottom: 0 !important; /* Remove bottom margin from last form group */
}

body.dark-mode .form-control {
  border-color: rgba(255, 255, 255, 0.2);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}

body.dark-mode .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}

/* Navbar styling */
.navbar {
  box-shadow: 0 2px 4px var(--shadow);
}

body.dark-mode .navbar {
  background-color: var(--dark-color) !important; /* Ensure dark mode background */
}

.navbar-brand {
  font-weight: 700;
  color: var(--info-color);
}

body.dark-mode .navbar-brand {
  font-weight: 700;
  color: var(--info-color);
}

body.dark-mode .navbar-lang {
  color: var(--text-dark);
}

body.dark-mode .form-check-input:checked {
  background-color: var(--info-color);
  border-color: var(--info-color);
}

/* Timepicker modal styling */
#timePickerModal .modal-body .btn {
  min-width: 3rem; /* Ensure buttons have a minimum width */
}

#timePickerModal .modal-body .btn.active {
  background-color: var(--primary-color);
  color: #fff;
}

/* Evenly space time picker buttons */
#hours-container, #minutes-container {
  display: grid !important;
  gap: 0.5rem;
}

#hours-container {
  grid-template-columns: repeat(6, 1fr); /* 6 columns for 24 hours (4 rows) */
}

#minutes-container {
  grid-template-columns: repeat(4, 1fr); /* 4 columns for 4 minutes */
}

#timePickerModal .hour-btn, 
#timePickerModal .minute-btn {
  margin: 0 !important; /* Remove margin to ensure grid spacing is used */
  width: 100%; /* Full width of grid cell */
  display: flex;
  justify-content: center;
  align-items: center;
  height: 2.5rem; /* Fixed height */
}

/* Adjust for mobile */
@media (max-width: 767px) {
  #hours-container {
    grid-template-columns: repeat(4, 1fr); /* 4 columns for 24 hours (6 rows) on mobile */
  }
  
  #timePickerModal .hour-btn, 
  #timePickerModal .minute-btn {
    height: 2.25rem; /* Slightly smaller height on mobile */
    font-size: 0.9rem; /* Smaller font size */
  }
}

/* Kanban Board Styles */
.kanban-column {
  margin-bottom: 2rem;
  height: 100%;
}

.kanban-header {
  border-radius: var(--border-radius) !important;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.kanban-list {
  height: 600px;
  max-height: 70vh;
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--border-radius);
  padding: 1rem;
  border: 2px dashed rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

body.dark-mode .kanban-list {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.kanban-list.sortable-drag-over {
  background-color: rgba(0, 123, 255, 0.1);
  border-color: var(--primary-color);
  transform: scale(1.02);
}

.kanban-item {
  margin-bottom: 0.75rem;
  cursor: grab;
  transition: all 0.2s ease;
  border: 1px solid var(--card-border-light);
  border-radius: var(--border-radius);
  background-color: var(--card-bg-light);
}

body.dark-mode .kanban-item {
  border-color: var(--card-border-dark);
  background-color: var(--card-bg-dark);
  color: var(--text-dark);
}

.kanban-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.kanban-item:active {
  cursor: grabbing;
}

.kanban-item.sortable-chosen {
  opacity: 0.8;
  transform: rotate(2deg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.kanban-item.sortable-ghost {
  opacity: 0.3;
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.kanban-item-content {
  padding: 0.5rem;
}

.kanban-title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-light);
  line-height: 1.3;
}

body.dark-mode .kanban-title {
  color: var(--text-dark);
}

.kanban-description {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: rgba(0, 0, 0, 0.7);
  line-height: 1.4;
}

body.dark-mode .kanban-description {
  color: rgba(255, 255, 255, 0.8);
}

.kanban-attachment {
  font-size: 0.8rem;
  color: var(--info-color);
  text-decoration: none;
  margin-right: 0.5rem;
}

.kanban-attachment:hover {
  text-decoration: underline;
}

/* Mobile responsiveness for Kanban */
@media (max-width: 767px) {
  .kanban-column {
    margin-bottom: 1.5rem;
  }
  
  .kanban-list {
    min-height: 200px;
    max-height: 40vh;
    padding: 0.75rem;
  }
  
  .kanban-header {
    font-size: 1rem;
    padding: 0.75rem !important;
  }
  
  .kanban-item {
    margin-bottom: 0.5rem;
  }
  
  .kanban-item-content {
    padding: 0.75rem;
  }
  
  .kanban-title {
    font-size: 0.95rem;
  }
  
  .kanban-description {
    font-size: 0.85rem;
  }
}

/* Tablet responsiveness */
@media (min-width: 768px) and (max-width: 991px) {
  .kanban-list {
    max-height: 60vh;
  }
}

/* Animation for smooth column transitions */
.kanban-list {
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* Status-specific styling */
#open-points {
  border-color: rgba(108, 117, 125, 0.3); /* Secondary color */
}

#wip-points {
  border-color: rgba(255, 193, 7, 0.3); /* Warning color */
}

#closed-points {
  border-color: rgba(40, 167, 69, 0.3); /* Success color */
}

body.dark-mode #open-points {
  border-color: rgba(108, 117, 125, 0.5);
}

body.dark-mode #wip-points {
  border-color: rgba(255, 193, 7, 0.5);
}

body.dark-mode #closed-points {
  border-color: rgba(40, 167, 69, 0.5);
}

/* Clickable point styling */
.clickable-point {
  cursor: pointer;
  transition: all 0.2s ease;
}

.clickable-point:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color) !important;
}

body.dark-mode .clickable-point:hover {
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Prevent hover effect during drag */
.clickable-point.sortable-chosen:hover {
  transform: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Adjust spacing for main content */
.container h1, .container h2 {
  margin-bottom: 1.5rem;
}

.container p {
  margin-bottom: 1rem;
}
