/* Custom Styling für moderne Optik */
.tempus-dominus-container {
  position: relative;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  border: 1px solid #dee2e6; /* Match form-control border width */
}

.tempus-dominus-input {
  border-radius: 0.375rem 0 0 0.375rem !important;
  border: none !important; /* Entferne alle Borders */
  box-shadow: none !important;
  background-color: transparent !important;
}

/* Höchste Spezifität für Tempus Dominus Buttons - überschreibt components.css */
.tempus-dominus-container button.btn,
.tempus-dominus-container a.btn,
.tempus-dominus-container .btn.btn {
  border-radius: 0 0.375rem 0.375rem 0 !important;
  border: none !important; /* Entferne alle Borders */
  border-width: 0 !important; /* Extra Sicherheit */
  background-color: #ffffff !important;
  background-image: none !important;
  color: #6c757d !important;
  box-shadow: none !important;
  min-height: auto !important; /* Überschreibe globale Button-Höhe */
  padding: 0.75rem !important; /* Match form-control padding */
  font-weight: 400 !important; /* Normal weight statt bold */
  letter-spacing: normal !important;
}

.tempus-dominus-container button.btn:hover,
.tempus-dominus-container a.btn:hover,
.tempus-dominus-container .btn.btn:hover {
  background-color: #e9ecef !important;
  background-image: none !important;
  color: #495057 !important;
  box-shadow: none !important;
  border: none !important;
  border-width: 0 !important;
  transform: none !important;
}

/* Focus-State für die gesamte Container (kann von Seiten überschrieben werden) */
.tempus-dominus-container:focus-within {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Entferne Focus-States von individuellen Elementen */
.tempus-dominus-container .tempus-dominus-input:focus {
  border: none !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.tempus-dominus-container button.btn:focus,
.tempus-dominus-container a.btn:focus,
.tempus-dominus-container .btn.btn:focus,
.tempus-dominus-container button.btn:active,
.tempus-dominus-container a.btn:active,
.tempus-dominus-container .btn.btn:active {
  border: none !important;
  border-width: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background-color: #e9ecef !important;
  background-image: none !important;
  transform: none !important;
}

/* Trennlinie zwischen Input und Button */
.tempus-dominus-container .btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 60%;
  width: 1px;
  background-color: #dee2e6;
}

.tempus-dominus-container:focus-within .btn::before {
  background-color: transparent;
}

/* Stelle sicher, dass beide Elemente die gleiche Höhe haben */
.tempus-dominus-container {
  display: flex;
  align-items: stretch;
  min-height: calc(1.5em + 1.5rem + 2px); /* Match form controls: padding + line-height + border */
}

.tempus-dominus-container .tempus-dominus-input {
  line-height: 1.5;
  padding: 0.75rem; /* Match .form-control padding */
  font-size: 1rem; /* Match .form-control font-size */
  display: flex;
  align-items: center;
}

.tempus-dominus-container button.btn,
.tempus-dominus-container a.btn,
.tempus-dominus-container .btn.btn {
  line-height: 1.5 !important;
  padding: 0.75rem !important; /* Match .form-control padding */
  font-size: 1rem !important; /* Match .form-control font-size */
  display: flex !important;
  align-items: center !important;
}

/* Input sollte den verfügbaren Platz einnehmen */
.tempus-dominus-container .tempus-dominus-input {
  flex: 1;
  min-width: 0;
}

/* Button sollte die richtige Größe haben */
.tempus-dominus-container button.btn,
.tempus-dominus-container a.btn,
.tempus-dominus-container .btn.btn {
  flex-shrink: 0 !important;
  width: auto !important;
  min-width: 50px !important; /* Genug für Icon + padding */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Modern Calendar Styling */
.td-widget {
  border-radius: 0.5rem !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
  border: 1px solid #dee2e6 !important;
}

.td-widget .td-calendar {
  border-radius: 0.5rem;
}

.td-widget .td-calendar-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 0.5rem 0.5rem 0 0;
  padding: 1rem;
}

.td-widget .td-calendar-header .picker-switch {
  color: white !important;
  font-weight: 500;
}

.td-widget .td-calendar-header .previous,
.td-widget .td-calendar-header .next {
  color: white !important;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.td-widget .td-calendar-header .previous:hover,
.td-widget .td-calendar-header .next:hover {
  opacity: 1;
}

/* Days Grid */
.td-widget .td-calendar .days {
  padding: 0.5rem;
}

.td-widget .td-calendar .day {
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  margin: 1px;
}

.td-widget .td-calendar .day:hover {
  background-color: #e3f2fd !important;
  transform: scale(1.05);
}

.td-widget .td-calendar .day.today {
  background-color: #2196f3 !important;
  color: white !important;
  font-weight: 500;
}

.td-widget .td-calendar .day.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  font-weight: 500;
}

/* Action Buttons */
.td-widget .td-collapse .toolbar {
  border-top: 1px solid #dee2e6;
  padding: 0.75rem;
  background-color: #f8f9fa;
  border-radius: 0 0 0.5rem 0.5rem;
}

.td-widget .td-collapse .toolbar .btn {
  border-radius: 0.25rem;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
  transition: all 0.2s ease;
}

.td-widget .td-collapse .toolbar .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Mobile Optimierungen */
@media (max-width: 768px) {
  .td-widget {
    max-width: 100% !important;
    margin: 0 0.5rem;
  }

  .td-widget .td-calendar-header {
    padding: 0.75rem;
  }

  .td-widget .td-calendar .day {
    height: 2.5rem;
    line-height: 2.5rem;
    font-size: 0.875rem;
  }

  .td-widget .td-collapse .toolbar .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .td-widget {
    background-color: #212529 !important;
    border-color: #495057 !important;
  }

  .td-widget .td-calendar {
    background-color: #212529;
    color: #fff;
  }

  .td-widget .td-calendar .day:hover {
    background-color: #495057 !important;
  }

  .td-widget .td-collapse .toolbar {
    background-color: #343a40;
    border-color: #495057;
  }
}

/* Focus Indicators */
.tempus-dominus-input:focus {
  border-color: #86b7fe !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}
