/* ==========================================================================
   1. Message Popup Container
   ========================================================================== */
.nachricht-popup-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(31,41,55,0.18); /* bleibt als Overlay */
  z-index: 9999;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}

.nachricht-popup-drawer {
  width: 550px;
  max-width: 100vw;
  background: var(--color-bg-light, #fff);
  box-shadow: -4px 0 32px rgba(1,87,153,0.13);
  height: 100%;
  overflow-y: auto;
  padding: 3rem 2.3rem 2.1rem 2.3rem;
  position: relative;
  animation: popup-slide-in 0.33s cubic-bezier(.4,1.4,.6,1) 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-radius: 22px 0 0 22px;
}

@keyframes popup-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.nachricht-popup-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-grey, #888);
  cursor: pointer;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nachricht-popup-close:hover {
  color: var(--color-primary);
  background-color: transparent;
}

/* ==========================================================================
   2. Message Form Elements
   ========================================================================== */
.nachricht-form-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.nachricht-form-group {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nachricht-form-group label {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.2em;
  letter-spacing: 0.01em;
}

.nachricht-form-group textarea.form-control,
.nachricht-form-group input[type="text"],
.nachricht-form-group input[type="email"] {
  border: 1.5px solid var(--color-bg-accent);
  border-radius: 8px;
  background: var(--color-bg);
  font-size: 1.08rem;
  color: var(--color-text);
  padding: 1em 1em 1em 1.1em;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(30,40,60,0.04);
  outline: none;
}

.nachricht-form-group textarea.form-control:focus,
.nachricht-form-group input[type="text"]:focus,
.nachricht-form-group input[type="email"]:focus {
  border-color: var(--color-primary);
  background: var(--color-bg-light, #fff);
  box-shadow: 0 2px 8px rgba(1,87,153,0.10);
}

.nachricht-form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.nachricht-form-group input[type="file"] {
  margin-top: 0.3rem;
}

/* ==========================================================================
   3. Alert & Notification Elements
   ========================================================================== */
.nachricht-alert {
  border-radius: 8px;
  padding: 1em 1.2em;
  font-size: 1.08rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.nachricht-alert-success {
  background: var(--color-success-bg, #e8f5e9);
  color: var(--color-success, #388e3c);
  border: 1px solid var(--color-success, #43a047);
}

.nachricht-alert-danger {
  background: var(--color-error-bg, #ffebee);
  color: var(--color-error, #c62828);
  border: 1px solid var(--color-error, #e53935);
}

.nachricht-hint {
  margin-top: 1.7rem;
  font-size: 0.97em;
  color: var(--color-grey, #888);
  text-align: center;
}

/* ==========================================================================
   4. Drag & Drop File Upload
   ========================================================================== */
.nachricht-dropzone {
  border: 2px dashed var(--color-bg-accent);
  border-radius: 10px;
  background: var(--color-bg);
  color: var(--color-primary);
  padding: 1.2em 1em;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 0.7em;
  position: relative;
}

.nachricht-dropzone.dragover {
  border-color: var(--color-primary);
  background: var(--color-bg-accent);
}

.nachricht-dropzone input[type="file"] {
  display: none;
}

#fileList .file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg-accent);
  border-radius: 6px;
  padding: 0.3em 0.7em;
  margin-bottom: 0.3em;
  font-size: 0.98em;
}

#fileList .file-remove {
  background: none;
  border: none;
  color: var(--color-error);
  font-size: 1.2em;
  cursor: pointer;
  margin-left: 0.7em;
  padding: 0;
}

/* ==========================================================================
   5. Damage/Issue Cards
   ========================================================================== */
.schaden-card-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.schaden-card {
  background: var(--color-bg-light, #fff);
  border-radius: 22px;
  box-shadow: 0 8px 32px rgba(1,87,153,0.10);
  padding: 2.3rem 2.3rem 2.1rem 2.3rem; /* mehr Platz */
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 240px; /* mehr Höhe */
  overflow: visible;
}

.schaden-status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px rgba(1,87,153,0.08);
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
}

.schaden-status-offen { background: #ff9800; box-shadow: 0 0 0 2px #ff9800; }
.schaden-status-abgeschlossen { background: #43a047; box-shadow: 0 0 0 2px #43a047; }

.schaden-card-action {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: var(--color-bg-accent, #e3f2fd);
  color: var(--color-primary, #1976d2);
  border: none;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  z-index: 2;
}

.schaden-card-action:hover {
  background: var(--color-bg-accent-hover, #bbdefb);
  color: var(--color-primary);
}

.schaden-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-row-gap: 1.1rem;
  margin-top: 0.7rem;
  margin-bottom: 1.1rem;
}

.schaden-card-label {
  font-weight: 600;
  color: var(--color-primary);
  margin-right: 0.4em;
  font-size: 1.01em;
}

.schaden-card-value {
  color: var(--color-text, #222);
  font-weight: 500;
  font-size: 1.01em;
  word-break: break-all;
}

.schaden-card-status {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 1.01em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.schaden-card-summe {
  justify-self: end;
  margin-top: 0.2em;
}

.schaden-card-bearbeiter {
  position: absolute;
  bottom: 1.7rem;
  right: 1.7rem;
  background: var(--color-bg-accent, #e3f2fd);
  color: var(--color-primary, #1976d2);
  border-radius: 11px;
  padding: 0.65em 1.3em 0.65em 1.1em;
  font-size: 1.07em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6em;
  box-shadow: 0 2px 8px rgba(1,87,153,0.07);
  min-width: 0;
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schaden-card-bearbeiter i {
  font-size: 1.1em;
  color: var(--color-primary);
}

/* ==========================================================================
   6. Filter & Action Buttons
   ========================================================================== */
.schaden-toolbar {
  display: flex;
  gap: 1.1rem;
  margin-bottom: 1.2rem;
}

.schaden-toolbar-btn {
  background: var(--color-bg-accent, #e3f2fd);
  color: var(--color-primary, #1976d2);
  border: none;
  border-radius: 18px;
  padding: 0.7em 2.1em;
  font-size: 1.08em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  box-shadow: 0 2px 8px rgba(1,87,153,0.07);
  outline: none;
  position: relative;
}

.schaden-toolbar-btn:hover,
.schaden-toolbar-btn.active {
  background: var(--color-bg-accent-hover, #bbdefb);
  color: var(--color-primary);
}

.schaden-filter-dropdown {
  position: absolute;
  top: 110%;
  left: 0;
  background: var(--color-bg-light, #fff);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(1,87,153,0.13);
  min-width: 180px;
  z-index: 10;
  padding: 0.5em 0;
  display: none;
}

.schaden-filter-dropdown.show {
  display: block;
}

.schaden-filter-option {
  padding: 0.7em 1.3em;
  font-size: 1.05em;
  color: var(--color-primary);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.13s;
}

.schaden-filter-option:hover,
.schaden-filter-option.active {
  background: var(--color-bg-accent, #e3f2fd);
}

/* ==========================================================================
   7. Agent Contact Cards
   ========================================================================== */
.schaden-bearbeiter-card {
  background: var(--color-bg-accent, #e3f2fd);
  color: var(--color-primary, #1976d2);
  border-radius: 14px;
  padding: 1.1em 1.3em 1.1em 1.1em;
  font-size: 1.07em;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  box-shadow: 0 2px 8px rgba(1,87,153,0.07);
  margin-top: 1.2em;
  max-width: 420px;
}

.schaden-bearbeiter-card-title {
  display: flex;
  align-items: center;
  gap: 0.7em;
  font-weight: 700;
  font-size: 1.08em;
  margin-bottom: 0.2em;
}

.schaden-bearbeiter-card i {
  font-size: 1.2em;
  color: var(--color-primary);
}

.schaden-bearbeiter-card a {
  color: var(--color-primary);
  text-decoration: underline;
  word-break: break-all;
}

.schaden-bearbeiter-card a:hover {
  text-decoration: none;
}

/* ==========================================================================
   8. Topic Selection Grid
   ========================================================================== */
.themen-kachel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.3rem;
}

.themen-kachel {
  background: var(--color-bg-accent, #e3f2fd);
  color: var(--color-primary, #1976d2);
  border: none;
  border-radius: 18px;
  padding: 1.3em 1.1em;
  font-size: 1.13em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  box-shadow: 0 2px 8px rgba(1,87,153,0.07);
  outline: none;
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

.themen-kachel:hover,
.themen-kachel:focus {
  background: var(--color-bg-accent-hover, #bbdefb);
  color: var(--color-primary);
}

.themen-step-title {
  font-weight: 700;
  font-size: 1.13em;
  margin-bottom: 0.7em;
  color: var(--color-primary);
  text-align: left;
}

/* ==========================================================================
   9. Dashboard Popup
   ========================================================================== */
#dashboardPopupOverlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 99999;
  background: rgba(31,41,55,0.18);
  align-items: center;
  justify-content: center;
}

#dashboardPopup {
  background: var(--color-bg-light, #fff);
  max-width: 480px; /* Popup wieder schmaler, damit Buttons nicht zu viel Platz brauchen */
  width: 100%;
  min-width: 0;
  padding: 2.2rem 2rem 2.7rem 2rem;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(1,87,153,0.13);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  animation: popup-fade-in 0.25s;
  box-sizing: border-box;
}

@keyframes popup-fade-in {
  from { opacity: 0; transform: scale(0.97);}
  to   { opacity: 1; transform: scale(1);}
}

#dashboardPopupClose {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.7rem;
  color: var(--color-text, #888);
  cursor: pointer;
  transition: color 0.2s;
}

#dashboardPopupClose:hover {
  color: var(--color-primary);
}

#dashboardPopupContent {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  text-align: left;
}

#dashboardPopupButtons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  width: 100%;
  flex-wrap: wrap; /* Buttons umbrechen, wenn zu breit */
}

#dashboardPopupButtons .btn {
  min-width: 140px;
  padding: 0.8em 1.5em;
  font-size: 1.13em;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(1,87,153,0.07);
  white-space: nowrap; /* Kein Umbruch im Button */
  text-align: center;
  margin-bottom: 0.5em;
  max-width: 100%;
}

/* ==========================================================================
   10. Contract Selection
   ========================================================================== */
.contract-select {
  font-size: 1.05rem;
  padding: 0.75em 1em;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(1,87,153,0.10);
}

.contract-select optgroup {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.5em 0;
  background-color: var(--color-bg-accent, #e3f2fd);
  color: var(--color-primary, #1976d2);
}

.contract-select option {
  padding: 0.75em 1em;
  font-weight: 500;
  background-color: var(--color-bg-light, #fff);
}

.contract-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 3px 10px rgba(1,87,153,0.15);
}

/* ==========================================================================
   11. Enhanced Form Elements
   ========================================================================== */
.nachricht-form-group select.form-control,
.nachricht-form-group input[type="date"],
.nachricht-form-group input[type="number"] {
  border: 1.5px solid var(--color-bg-accent);
  border-radius: 8px;
  background: var(--color-bg);
  font-size: 1.08rem;
  color: var(--color-text);
  padding: 1em 1em 1em 1.1em;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(30,40,60,0.04);
  outline: none;
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.nachricht-form-group select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231976d2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1em center;
  background-size: 1em;
  padding-right: 2.5em;
}

.nachricht-form-group select.form-control:focus,
.nachricht-form-group input[type="date"]:focus,
.nachricht-form-group input[type="number"]:focus {
  border-color: var(--color-primary);
  background-color: var(--color-bg-light, #fff);
  box-shadow: 0 2px 8px rgba(1,87,153,0.10);
}

.nachricht-form-group select.form-control optgroup {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.7em 0.5em;
  background-color: var(--color-bg-accent, #e3f2fd);
  color: var(--color-primary, #1976d2);
}

.nachricht-form-group select.form-control option {
  padding: 0.75em 1em;
  font-weight: 500;
  background-color: var(--color-bg-light, #fff);
  color: var(--color-text);
}

.nachricht-form-group input[type="checkbox"] {
  margin-right: 0.5em;
  transform: scale(1.2);
}

.nachricht-form-group h4 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1.2rem;
  margin-top: 0.5rem;
}

.form-hint {
  font-size: 0.9em;
  color: var(--color-grey);
  margin-top: 0.4em;
  display: block;
}

.required-marker {
  color: #e53935;
  margin-left: 0.2em;
}

.nachricht-form-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5) sepia(1) saturate(3) hue-rotate(170deg);
  cursor: pointer;
  opacity: 0.7;
}

.nachricht-form-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ==========================================================================
   12. CSS Variable Overrides for Form Elements
   ========================================================================== */
.nachricht-popup-drawer .nachricht-form-group select.form-control,
.nachricht-popup-drawer .nachricht-form-group input[type="date"],
.nachricht-popup-drawer .nachricht-form-group input[type="number"] {
  border: 1.5px solid var(--color-bg-accent) !important;
  border-radius: 8px !important;
  background-color: var(--color-bg-light) !important;
  font-size: 1.08rem !important;
  color: var(--color-text) !important;
  padding: 1em 1em 1em 1.1em !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  box-shadow: 0 1px 4px rgba(30,40,60,0.04) !important;
  outline: none !important;
  width: 100% !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  height: auto !important;
  min-height: 50px !important;
}

.nachricht-popup-drawer .nachricht-form-group select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23015799' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 1em center !important;
  background-size: 1em !important;
  padding-right: 2.5em !important;
}

.nachricht-popup-drawer .nachricht-form-group select.form-control:focus,
.nachricht-popup-drawer .nachricht-form-group input[type="date"]:focus,
.nachricht-popup-drawer .nachricht-form-group input[type="number"]:focus {
  border-color: var(--color-primary) !important;
  background-color: var(--color-bg-light) !important;
  box-shadow: 0 2px 8px rgba(1,87,153,0.10) !important;
}

/* ==========================================================================
   13. Responsive Adaptations
   ========================================================================== */
@media (max-width: 600px) {
  .nachricht-popup-drawer { 
    width: 100vw; 
    padding: 1.3rem 0.7rem 1.3rem 0.7rem; 
    border-radius: 0; 
  }
  
  .schaden-card { 
    padding: 1.3rem 0.7rem 1.3rem 0.7rem; 
    min-height: 0; 
  }
  
  .schaden-card-grid { 
    grid-template-columns: 1fr; 
    grid-row-gap: 0.7rem; 
  }
  
  .schaden-card-bearbeiter { 
    position: static; 
    margin-top: 1.1em; 
    max-width: 100%; 
  }
  
  .schaden-card-action { 
    top: 0.7rem; 
    right: 0.7rem; 
  }
  
  .schaden-status-dot { 
    top: 0.7rem; 
    left: 0.7rem; 
  }
  
  .themen-kachel-grid { 
    grid-template-columns: 1fr; 
  }
  
  #dashboardPopup {
    max-width: 98vw;
    width: 98vw;
    padding: 1.1rem 0.5rem 1.7rem 0.5rem;
    border-radius: 10px;
  }
  
  #dashboardPopupButtons .btn {
    font-size: 1em;
    padding: 0.6em 0.7em;
  }
  
  /* Mobile responsive improvements for popup */
  .nachricht-popup-drawer {
    width: 100vw;
    border-radius: 0;
    padding: 3.5rem 1.5rem 2rem 1.5rem;
  }
  
  .nachricht-popup-close {
    top: 1rem;
    right: 1rem;
    font-size: 1.8rem;
    width: 36px;
    height: 36px;
  }
}

/* ==========================================================================
   News Popup Specific Styles
   ========================================================================== */

#newsPopup .news-feed-container {
    margin: 0;
    padding: 0;
}

#newsPopup .news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#newsPopup .news-item {
    display: block;
    margin-bottom: 1.5rem;
    padding: 0;
}

#newsPopup .news-item.active {
    display: block;
}

#newsPopup .news-item:last-child {
    margin-bottom: 0;
}

#newsPopup .news-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 1.2rem;
    background: var(--color-bg-accent);
    border-radius: 12px;
    border: 1px solid var(--color-bg-accent);
    transition: all 0.2s ease;
}

#newsPopup .news-link:hover {
    background: var(--color-bg-light);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#newsPopup .news-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

#newsPopup .news-date {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 0.8rem;
}

#newsPopup .news-description {
    font-size: 1rem;
    color: var(--color-text);
    line-height: 1.5;
    margin: 0;
}

#newsPopup .carousel-footer {
    display: none;
}

#newsPopup .carousel-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

#newsPopup .carousel-btn:hover {
    background: var(--color-accent);
    transform: scale(1.1);
}

#newsPopup .carousel-indicator {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* News popup button styling */
.btn.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.btn.btn-primary:hover {
    background: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
