/**
 * ISO Date Picker Styles
 *
 * Layout für Hybrid Text+Picker Pattern:
 * - Text-Input + Calendar-Icon nebeneinander
 * - Error-States
 * - Responsive
 */

/* Wrapper: Input + Icon inline */
.iso-date-wrapper {
  display: inline-block;
  position: relative; /* KRITISCH: Error-Popup nutzt position:absolute */
  min-height: 36px; /* Verhindert Layout-Shift */
  min-width: 130px; /* Minimale Breite: Input (95px) + Icon (28px) + Margin (4px) + Puffer */
  white-space: nowrap;
}

/* Text-Input Styling */
.iso-date-input,
input.iso-date-input.input_short {
  font-family: 'Courier New', monospace !important; /* Monospace für ISO-Format */
  font-size: 13px !important; /* Etwas kleiner für kompaktere Darstellung */
  padding: 5px 6px !important; /* Reduziertes Padding */
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  width: 95px !important; /* Optimale Breite für "YYYY-MM-DD" (10 Zeichen) */
  max-width: none !important; /* Override andere max-width */
  vertical-align: middle !important;
  transition: border-color 0.2s ease !important;
}

.iso-date-input:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.iso-date-input::placeholder {
  color: #999;
  font-style: italic;
}

/* Invalid State */
.iso-date-input.iso-date-invalid,
input.iso-date-input.input_short.iso-date-invalid {
  border-color: #e53935 !important;
  background-color: #ffecec !important;
}

.iso-date-input.iso-date-invalid:focus {
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.3);
}

/* Calendar Icon Button */
.iso-date-icon {
  display: inline-block;
  width: 28px; /* Kompakter */
  height: 28px; /* Kompakter */
  padding: 0;
  margin-left: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: linear-gradient(to bottom, #ffffff, #f5f5f5);
  cursor: pointer;
  font-size: 14px; /* Kleiner */
  line-height: 28px; /* Angepasst an neue Höhe */
  text-align: center;
  vertical-align: middle;
  transition: all 0.2s ease;
}

.iso-date-icon:hover {
  background: linear-gradient(to bottom, #f5f5f5, #ebebeb);
  border-color: #4a90e2;
}

.iso-date-icon:active {
  background: #e0e0e0;
  transform: translateY(1px);
}

.iso-date-icon:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.4);
}

/* Error Message */
.iso-date-error {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  padding: 8px 12px; /* Mehr Platz f\u00fcr Text */
  background-color: #e74c3c;
  color: #ffffff; /* Explizites Wei\u00df */
  font-size: 13px; /* Gr\u00f6\u00dfer f\u00fcr bessere Lesbarkeit */
  font-weight: 500; /* Fetter f\u00fcr Kontrast */
  line-height: 1.4;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10000; /* H\u00f6her als typische Overlays */
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.iso-date-error::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 12px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid #e74c3c;
}

/* Hidden Date Input (für Picker) */
.iso-date-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* Responsive: Kleinere Screens */
@media (max-width: 768px) {
  .iso-date-input {
    min-width: 120px;
    font-size: 16px; /* iOS zoom prevention */
  }

  .iso-date-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

/* Accessibility: High Contrast Mode */
@media (prefers-contrast: high) {
  .iso-date-input {
    border-width: 2px;
  }

  .iso-date-icon {
    border-width: 2px;
  }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
  .iso-date-input {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-color: #555;
  }

  .iso-date-input::placeholder {
    color: #888;
  }

  .iso-date-icon {
    background: linear-gradient(to bottom, #3d3d3d, #2d2d2d);
    border-color: #555;
    color: #e0e0e0;
  }

  .iso-date-icon:hover {
    background: linear-gradient(to bottom, #4d4d4d, #3d3d3d);
    border-color: #4a90e2;
  }
}

/* Integration mit bestehenden ZEMM-Styles */
/* Falls ZEMM bereits input/input_red Klassen nutzt */
.iso-date-input.input,
.iso-date-input.input_red {
  /* Überschreibe falls nötig */
  font-family: 'Courier New', monospace;
}

.iso-date-input.input_red {
  border-color: #e74c3c;
  background-color: #fff5f5;
}
