/* ============================================
   Mein Nestwerk - Form Styles
   Inputs, Selects, Textareas, Checkboxen
   ============================================
   Version: 2.2 (Duplikate entfernt)
   Datum: 2025-11-26
   ============================================ */

/* ===== Labels ===== */
label {
  font-size: 0.92rem;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

label.label {
  font-weight: 500;
  margin-top: 12px;
}

label.required::after {
  content: " *";
  color: #dc3545;
}

.label-first {
  font-weight: 500;
}

/* ===== Text Inputs ===== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--fg);
  font-size: 1rem;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===== Textarea ===== */
textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

/* ===== Select ===== */
select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--fg);
  font-size: 1rem;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

select option {
  color: #333;
  background: #fff;
}

select:hover {
  border-color: var(--accent-soft);
}

/* ===== Date/Time Input Styling ===== */
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  height: 47px;
  line-height: normal;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  background-color: var(--accent-soft);
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
}

/* ===== File Input ===== */
input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  position: relative;
  font-size: 0;
  color: transparent;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  visibility: hidden;
}

input[type="file"]::file-selector-button {
  visibility: hidden;
}

input[type="file"]::before {
  content: "Neues Foto hochladen";
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--accent-strong);
  cursor: pointer;
  transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
}

input[type="file"]:hover::before {
  background: var(--accent-strong);
  color: #fff;
}

input[type="file"]:active::before {
  background: var(--accent-soft);
  transform: scale(0.98);
}

/* ===== Checkbox Styles ===== */
.chk {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}

.chk:hover {
  border-color: var(--accent-soft);
  background: #fafafa;
}

.chk input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent-soft);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--accent-strong);
  flex-shrink: 0;
}

.chk input[type="checkbox"]:checked ~ span {
  font-weight: 600;
}

.chk:has(input[type="checkbox"]:checked) {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.02);
}

.chk input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(82, 174, 50, 0.2);
  border-color: var(--accent-strong);
}

.chk input[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.chk input[disabled] + span {
  opacity: 0.6;
}

.chk span {
  line-height: 1.2;
}

/* ===== Radio Button Styles ===== */
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
  cursor: pointer;
}

input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* ===== Messenger User Input ===== */
.ms-user {
  border: 2px solid var(--accent-soft);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  width: 100%;
  transition: all 0.15s ease;
}

.ms-user:focus {
  border-color: var(--accent-strong);
}

/* ===== Input Validation States ===== */
input.is-valid,
textarea.is-valid,
select.is-valid {
  border-color: #28a745;
}

input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: #dc3545;
}

.invalid-feedback {
  display: none;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 4px;
}

input.is-invalid ~ .invalid-feedback,
textarea.is-invalid ~ .invalid-feedback,
select.is-invalid ~ .invalid-feedback {
  display: block;
}

/* ===== Fieldset & Legend ===== */
fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}

legend {
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0 8px;
}

/* ===== Form Groups ===== */
.form-group {
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

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

/* ===== Placeholder Styles ===== */
::placeholder {
  color: #999;
  opacity: 1;
}

:-ms-input-placeholder {
  color: #999;
}

::-ms-input-placeholder {
  color: #999;
}

/* ===== Number Input Buttons ===== */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
  height: 40px;
}

/* ===== Search Input Clear Button ===== */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  width: 16px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236F6E6E"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>');
  background-size: contain;
  cursor: pointer;
}

/* ===== Temp Contact ===== */
.temp-contact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 12px 16px;
  background: #FFF8E1;
  border-radius: 10px;
  border-left: 4px solid #FFC107;
}

.temp-contact-header h4 {
  margin: 0;
  color: #F57C00;
  font-size: 1.1rem;
}

.temp-contact-info {
  margin-bottom: 12px;
  line-height: 1.6;
}

.temp-contact-messenger-list {
  margin: 8px 0 16px 0;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--accent-strong);
}

.messenger-item {
  padding: 6px 0;
  color: var(--fg);
  font-size: 0.95rem;
}

.messenger-item:not(:last-child) {
  border-bottom: 1px solid #e9ecef;
}

/* ========================================
   LIVE-SAVE FEEDBACK
   ======================================== */

.field-loading {
  border-color: var(--accent-strong) !important;
  animation: pulse-theme 1.5s ease-in-out infinite;
}

@keyframes pulse-theme {
  0%, 100% {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 0 var(--accent-shadow);
  }
  50% {
    border-color: var(--accent-mid);
    box-shadow: 0 0 0 4px var(--accent-shadow);
  }
}

.field-success {
  border-color: #4CAF50 !important;
  animation: glow-green 2s ease-in-out;
}

@keyframes glow-green {
  0% {
    border-color: #4CAF50;
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.6);
  }
  50% {
    border-color: #66BB6A;
    box-shadow: 0 0 8px 4px rgba(76, 175, 80, 0.4);
  }
  100% {
    border-color: #4CAF50;
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

.field-error {
  border-color: #F44336 !important;
  animation: glow-red 2s ease-in-out;
}

@keyframes glow-red {
  0% {
    border-color: #F44336;
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.6);
  }
  50% {
    border-color: #EF5350;
    box-shadow: 0 0 8px 4px rgba(244, 67, 54, 0.4);
  }
  100% {
    border-color: #F44336;
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
  }
}

.field-error-message {
  display: block;
  margin-top: 6px;
  padding: 8px 12px;
  background: #FFEBEE;
  border-left: 3px solid #F44336;
  border-radius: 4px;
  color: #C62828;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
  transition: opacity 0.3s ease-out;
}

.fade-out {
  opacity: 0;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== INFO-BADGE ===== */
.info-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  color: white;
  background: var(--accent-soft);  /* Themefarbe! */
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.8;
  transition: all 0.2s ease;
  user-select: none;
}

.info-badge:hover {
  opacity: 1;
  background: var(--accent-strong);  /* Dunkler bei Hover */
  transform: scale(1.1);
}

/* ===== PRIVACY SEKTION ===== */
.privacy-section {
  padding: 20px 0;
}

.privacy-header h3 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  color: var(--fg);
}

.privacy-header p {
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.privacy-danger-zone {
  margin-top: 20px;
  padding: 24px;
  background: #FFF5F5;
  border: 2px solid #FEE;
  border-radius: 12px;
}

.privacy-danger-zone .privacy-header h3 {
  color: #C53030;
}

.privacy-actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.privacy-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px;
  background: white;
  border: 1px solid #FED7D7;
  border-radius: 10px;
}

.privacy-action-info h4 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  color: var(--fg);
}

.privacy-action-info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.privacy-action .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Overlay-Content Styling */
.privacy-confirm-content {
  line-height: 1.6;
}

.privacy-confirm-content p {
  margin: 0 0 20px 0;
  color: #555;
}

.privacy-confirm-content .chk {
  margin: 20px 0;
}

.privacy-confirm-content textarea {
  width: 100%;
  min-height: 100px;
  margin: 12px 0 20px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.privacy-confirm-content label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--fg);
}

.privacy-confirm-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.privacy-confirm-buttons .btn {
  flex: 1;
}

/* Mobile */
@media (max-width: 768px) {
  .privacy-action {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .privacy-action .btn {
    width: 100%;
  }
}

/* ===== CONSENT CARD ===== */
.consent-card {
  padding: 20px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.consent-info {
  flex: 1;
}

.consent-row {
  margin: 8px 0;
  display: flex;
  gap: 10px;
}

.consent-label {
  font-weight: 600;
  color: #666;
  min-width: 120px;
}

.consent-value {
  color: #333;
}

.consent-given {
  color: #28a745;
  font-weight: 600;
}

.consent-not-given {
  color: #dc3545;
  font-weight: 600;
}

.consent-card .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Overlay */
.consent-overlay-text {
  margin: 20px 0;
  line-height: 1.6;
}

.consent-overlay-text p {
  margin: 10px 0;
}

.popup-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.popup-buttons .btn {
  flex: 1;
}

/* Mobile */
@media (max-width: 768px) {
  .consent-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .consent-card .btn {
    width: 100%;
  }
}

/* ===== POPUP OVERLAY (für Health Consent) ===== */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.popup-overlay.active,
.popup-overlay[style*="display: flex"] {
  display: flex !important;
}

.popup-box {
  background: white;
  border-radius: 16px;
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  padding: 35px;
  animation: popupSlideIn 0.3s ease;
}

.popup-box h2 {
  margin: 0 0 20px 0;
  text-align: center;
  color: var(--accent-strong);
}

.consent-overlay-text {
  margin: 0 0 25px 0;
  line-height: 1.6;
}

.consent-overlay-text p {
  margin: 12px 0;
  color: #555;
}

.consent-overlay-text p strong {
  color: #333;
  display: block;
  margin: 15px 0 8px 0;
}

.popup-box .form-group {
  margin-bottom: 18px;
}

.popup-box .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.popup-box .form-group input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}

.popup-box .chk {
  margin: 25px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.popup-buttons {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

.popup-buttons .btn {
  flex: 1;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input[type="number"],
  input[type="url"],
  input[type="search"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px;
  }

  .chk {
    padding: 12px;
  }
}

/* ===== Dark Mode ===== */
body[data-theme="dark"] .field-error-message {
  background: rgba(244, 67, 54, 0.15);
  color: #EF5350;
}

body[data-theme="dark"] .field-loading {
  border-color: #42A5F5 !important;
}

body[data-theme="dark"] .field-success {
  border-color: #66BB6A !important;
}

body[data-theme="dark"] .field-error {
  border-color: #EF5350 !important;
}

/* ===== LOGIN PAGE STYLES ===== */
.login-card-wrapper {
  max-width: 500px;
  margin: 60px auto;
}

.login-title {
  margin: 0 0 10px;
  text-align: center;
  font-size: 24px;
  color: var(--fg);
}

.login-subtitle {
  text-align: center;
  color: var(--muted);
  margin: 0 0 30px;
  font-size: 14px;
}

.otp-input {
  text-align: center;
  letter-spacing: 8px;
  font-size: 24px;
  font-weight: 600;
}

.login-countdown {
  text-align: center;
  margin: 20px 0;
  color: var(--muted);
  font-size: 14px;
}

.login-countdown strong {
  color: #28a745;
  font-weight: 600;
}

.login-countdown .expired {
  color: #dc3545;
  font-weight: 600;
}

.login-renew-form {
  text-align: center;
  margin: 10px 0;
}

.login-renew-form #renewButton {
  display: none;
}

.login-back-link {
  text-align: center;
  margin-top: 20px;
}

.login-back-link a {
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 14px;
}

.login-back-link a:hover {
  text-decoration: underline;
}

/* Lockout Popup */
.lockout-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.lockout-popup-box {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lockout-title {
  color: #e74c3c;
  margin: 0 0 15px;
  font-size: 22px;
}

.lockout-text {
  margin: 0 0 20px;
  color: var(--fg);
}

.lockout-timer {
  font-size: 32px;
  font-weight: bold;
  color: #3498db;
  margin: 0;
}
