/* ============================================================
   DashboardContactsTab — O365-Kontakte mit Kachel-/Listenansicht
   ============================================================ */

.root {
  /* Nutzt das Padding von .mainContent */
}

/* ── Toolbar ─────────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.searchWrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  display: flex;
  align-items: center;
}

.searchIcon {
  position: absolute;
  left: 0.625rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.searchInput {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 2.25rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}

.searchInput:focus {
  border-color: var(--color-primary);
}

.searchClear {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
  transition: color 0.1s;
}

.searchClear:hover {
  color: var(--color-text);
}

/* Ansichts-Toggle */
.viewToggle {
  display: flex;
  gap: 2px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.viewBtn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.viewBtn:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.viewBtnActive {
  background: var(--color-primary);
  color: white !important;
}

.count {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

/* ── Kachelansicht ────────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
}

.card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.card:focus-visible {
  border-color: var(--color-primary);
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.cardAvatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.cardName {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
  line-height: 1.3;
}

.cardJobTitle {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

.cardCompany {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.cardEmail {
  font-size: 0.6875rem;
  color: var(--color-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  margin-top: 0.25rem;
}

.cardPhone {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

/* ── Listenansicht ────────────────────────────────────────────────────────────── */

.listHeader {
  display: grid;
  grid-template-columns: 36px 1.5fr 1fr 1fr 1.5fr 1fr;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.25rem;
}

.listHeaderCell {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.list {
  display: flex;
  flex-direction: column;
}

.row {
  display: grid;
  grid-template-columns: 36px 1.5fr 1fr 1fr 1.5fr 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  outline: none;
}

.row:hover {
  background: var(--color-bg-card);
}

.row:focus-visible {
  background: var(--color-bg-card);
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.rowAvatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.rowName {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowMeta {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Leerer Zustand ────────────────────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* ── Status-Seiten (nicht verbunden, laden, Fehler) ──────────────────────────── */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 5rem 2rem;
  text-align: center;
}

.stateIcon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.stateTitle {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.stateSub {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  max-width: 360px;
  margin: 0;
}

.stateCenter {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* ── Modal ────────────────────────────────────────────────────────────────────── */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, var(--radius-md));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 460px;
  position: relative;
  padding: 1.75rem;
}

.modalClose {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.modalClose:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.modalHeader {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-right: 2.25rem;
}

.modalAvatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.modalName {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 0.2rem;
  line-height: 1.3;
}

.modalJobTitle {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: 0.1rem;
}

.modalCompany {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.modalDetails {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.detailRow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.detailLabel {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 72px;
  flex-shrink: 0;
}

.detailValue {
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
  word-break: break-all;
}

.detailValue:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.detailEmpty {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

.modalFooter {
  display: flex;
  justify-content: flex-end;
}

.importBtn {
  padding: 0.625rem 1.5rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 150px;
  text-align: center;
}

.importBtn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.importBtn:disabled {
  cursor: not-allowed;
  opacity: 0.9;
}

.importBtnSuccess {
  background: #22c55e;
}

.importBtnError {
  background: #ef4444;
  cursor: pointer !important;
}
