/* ============================================================
   customers.css - Kundenliste, Detailansicht, Grid/Liste-Toggle
   ============================================================ */

/* VIEW TOGGLE */
.view-toggle {
  display: flex; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0;
}
.view-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 0.5rem 0.7rem; background: none; border: none;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.view-btn:hover { color: var(--text-primary); background: var(--bg-surface); }
.view-btn.active { background: var(--accent-dim); color: var(--accent); }

/* ALPHABET-GRUPPEN */
.customers-alpha-stack {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.customers-alpha-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.customers-alpha-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.customers-alpha-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  background: var(--bg-elevated);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
}
.customer-sort-toggle { flex-shrink: 0; }

/* GRID */
.customers-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem;
}
.customer-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  transition: var(--transition); position: relative; overflow: hidden;
}
.customer-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--info);
}
.customer-card--clickable { cursor: pointer; }
.customer-card--clickable:hover {
  border-color: var(--info); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.customer-card-arrow-hint {
  position: absolute; top: 0.9rem; right: 0.9rem;
  color: var(--text-muted); opacity: 0; transition: var(--transition);
}
.customer-card--clickable:hover .customer-card-arrow-hint { opacity: 1; color: var(--info); transform: translateX(3px); }
.customer-card-header { display: flex; align-items: center; gap: 0.75rem; padding-right: 1.5rem; }
.customer-avatar {
  width: 40px; height: 40px; background: rgba(74,180,240,0.12);
  border: 1px solid rgba(74,180,240,0.25); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 800; color: var(--info); flex-shrink: 0;
}
.customer-avatar--sm { width: 32px; height: 32px; font-size: 0.75rem; }
.customer-name {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.customer-company { font-size: 0.78rem; color: var(--text-secondary); }
.customer-contacts { display: flex; flex-direction: column; gap: 0.3rem; }
.customer-contact-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.customer-contact-row svg { width: 12px; height: 12px; color: var(--text-muted); flex-shrink: 0; }
.customer-project-count {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.75rem; background: var(--bg-elevated);
  border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 0.8rem; color: var(--text-secondary);
}
.customer-project-count span:first-child { display: flex; align-items: center; gap: 0.4rem; }
.customer-project-count span:last-child { font-family: var(--font-display); font-weight: 700; color: var(--info); }
.customer-card-actions { display: flex; gap: 0.5rem; margin-top: auto; }

/* LISTE */
.customers-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.clist-header {
  display: grid; grid-template-columns: 2fr 80px 2fr 1.5fr 80px 36px;
  gap: 1rem; padding: 0.6rem 1.25rem;
  background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
.customer-list-row {
  display: grid; grid-template-columns: 2fr 80px 2fr 1.5fr 80px 36px;
  gap: 1rem; align-items: center; padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.customer-list-row:last-child { border-bottom: none; }
.customer-list-row:hover { background: var(--bg-elevated); }
.customer-list-row:hover .clist-arrow { color: var(--info); }
.clist-col { display: flex; align-items: center; min-width: 0; }
.clist-name-col { display: flex; align-items: center; gap: 0.65rem; }
.clist-name-col .customer-name { font-size: 0.9rem; }
.clist-email, .clist-city { font-size: 0.82rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clist-projects { font-family: var(--font-display); font-weight: 700; color: var(--info); font-size: 0.9rem; }
.clist-arrow { color: var(--text-muted); transition: var(--transition); justify-content: flex-end; }

/* ZURUECK-BUTTON */
.btn-back {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: none; border: none; color: var(--text-secondary);
  font-family: var(--font-body); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; padding: 0.4rem 0; margin-bottom: 1.5rem; transition: var(--transition);
}
.btn-back:hover { color: var(--text-primary); }
.btn-back svg { width: 15px; height: 15px; }

/* DETAILANSICHT HERO */
.cdetail-hero {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem;
  margin-bottom: 1.5rem; position: relative; overflow: hidden;
}
.cdetail-hero::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--info);
}
.cdetail-avatar {
  width: 64px; height: 64px; background: rgba(74,180,240,0.15);
  border: 2px solid rgba(74,180,240,0.35); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; color: var(--info); flex-shrink: 0;
}
.cdetail-hero-info { flex: 1; min-width: 0; }
.cdetail-name {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 800;
  letter-spacing: -0.03em; margin-bottom: 0.25rem;
}
.cdetail-company {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.25rem;
}
.cdetail-company svg { color: var(--text-muted); }
.cdetail-meta { font-size: 0.78rem; color: var(--text-muted); }
.cdetail-hero-actions { display: flex; gap: 0.75rem; flex-shrink: 0; flex-wrap: wrap; }
.cdetail-hero-actions .btn-secondary,
.cdetail-hero-actions .btn-danger {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1rem; font-size: 0.85rem; width: auto;
}

/* DETAIL DATENGRID */
.cdetail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem; margin-bottom: 2rem;
}
.cdetail-field-list { display: flex; flex-direction: column; gap: 0.6rem; }
.cdetail-field { display: flex; flex-direction: column; gap: 0.15rem; }
.cdetail-label {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
.cdetail-label svg { width: 11px; height: 11px; }
.cdetail-value { font-size: 0.875rem; color: var(--text-primary); }
.cdetail-link { color: var(--info); text-decoration: none; transition: var(--transition); }
.cdetail-link:hover { color: #6dcfff; text-decoration: underline; }
.cdetail-email-action {
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.cdetail-addr { font-size: 0.875rem; color: var(--text-primary); line-height: 1.7; }
.cdetail-notes { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; }

/* PROJEKTE IN DETAIL */
.cdetail-projects {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
}
.cdetail-projects-header {
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem;
}
.cdetail-projects-header h3 {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 700;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; flex: 1;
}
.cdetail-projects-header h3 svg { color: var(--accent); }
.cdetail-project-list { display: flex; flex-direction: column; gap: 0.5rem; }
.customer-history-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.customer-history-group-title {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
}
.cdetail-section-footer {
  display: flex;
  justify-content: flex-start;
  margin-top: 1rem;
}
.cdetail-project-row {
  display: grid; grid-template-columns: 104px 1fr 100px 90px auto;
  gap: 1rem; align-items: center; padding: 0.7rem 1rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: var(--transition);
}
.cdetail-project-row:hover { border-color: var(--border-bright); }
.cdetail-project-row > .badge {
  justify-content: center;
  min-width: 92px;
  padding-inline: 0.72rem;
}
.cdetail-proj-name {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 500;
}
.cdetail-proj-name > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cdetail-proj-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.cdetail-proj-status-date {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cdetail-proj-date { font-size: 0.78rem; color: var(--text-muted); }
.cdetail-proj-total { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: 0.9rem; text-align: right; }
.cdetail-projects--orders { margin-top: 1.25rem; }
.cdetail-projects--completed { margin-top: 1.25rem; }

/* MODAL */
.modal-section { display: flex; flex-direction: column; gap: 0.75rem; }
.modal-section-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted);
  display: flex; align-items: center; gap: 0.4rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}
.modal-section-title svg { width: 13px; height: 13px; }
.addr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.addr-street { grid-column: 1 / -1; }
.customer-new-hint {
  background: rgba(74,180,240,0.08); border: 1px solid rgba(74,180,240,0.2);
  border-radius: var(--radius-sm); padding: 0.6rem 0.85rem;
  font-size: 0.82rem; color: var(--info); display: flex; align-items: center; gap: 0.5rem;
}
.customer-new-hint svg { width: 15px; height: 15px; flex-shrink: 0; }

/* KUNDENMAIL-MODAL */
.customer-mail-modal-card { max-width: 720px; }
.customer-info-modal-card { width: min(980px, 95vw); }
.customer-info-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.customer-info-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.customer-info-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--info);
  background: rgba(74,180,240,0.12);
  border: 1px solid rgba(74,180,240,0.28);
}
.customer-info-headline h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.customer-info-headline p {
  margin: 0.15rem 0 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
}
.customer-info-number {
  font-weight: 700;
  letter-spacing: 0.03em;
}
.customer-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.customer-info-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.86rem;
}
.customer-info-card--full {
  grid-column: 1 / -1;
}
.customer-info-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.customer-info-link {
  color: var(--info);
  text-decoration: none;
}
.customer-info-link:hover {
  text-decoration: underline;
}
.customer-info-empty {
  color: var(--text-muted);
}
.customer-info-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.customer-mail-modal-body textarea {
  min-height: 220px;
  resize: vertical;
}
.customer-mail-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .cdetail-hero { flex-direction: column; text-align: center; }
  .cdetail-hero-actions { justify-content: center; }
  .cdetail-grid { grid-template-columns: 1fr; }
  .cdetail-project-row { grid-template-columns: 96px 1fr auto; }
  .cdetail-proj-date, .cdetail-proj-total { display: none; }
  .cdetail-proj-status { flex-wrap: wrap; }
  .cdetail-proj-status-date { white-space: normal; }
  .clist-header { display: none; }
  .customer-list-row { grid-template-columns: 1fr 36px; }
  .clist-email, .clist-city, .clist-projects, .clist-custnr { display: none; }
  .customer-mail-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .customer-info-grid {
    grid-template-columns: 1fr;
  }
  .customer-info-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .customer-mail-modal-actions .btn-primary,
  .customer-mail-modal-actions .btn-secondary {
    width: 100% !important;
  }
  .customer-info-actions .btn-primary,
  .customer-info-actions .btn-secondary {
    width: 100% !important;
  }
}

/* Kundennummer */
.customer-number {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-top: 0.1rem;
}
.clist-custnr {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
