/* ============================================================
   EmailsTab – E-Mail-Liste + Detail-Modal
   ============================================================ */

/* ---- E-Mail-Liste ---- */
.emailList {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
}

.emailItem {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-left-width: 3px;
  border-left-color: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
  width: 100%;
  min-width: 0;
}

.emailItem:hover {
  background: var(--color-bg-subtle, var(--color-bg));
}

.emailItemUnread {
  border-left-color: var(--color-primary);
}

.emailMeta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.emailRow1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.125rem;
}

.emailSubject {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.emailSubjectUnread {
  font-weight: 600;
}

.emailTime {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.emailFrom {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emailPreview {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.125rem;
  opacity: 0.8;
}

/* ---- Status-Dots ---- */
.unreadDot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-top: 0.4rem;
}

.readSpacer {
  flex-shrink: 0;
  width: 7px;
}

/* ---- Anhang-Badge ---- */
.attachBadge {
  flex-shrink: 0;
  font-size: 0.875rem;
  margin-top: 0.125rem;
  opacity: 0.7;
}

/* ============================================================
   Detail-Modal
   ============================================================ */

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

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-border);
  width: 100%;
  max-width: 660px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Modal-Header */
.modalHeader {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-shrink: 0;
}

.modalHeaderLeft {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.modalSubject {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
  margin: 0;
  line-height: 1.35;
}

.modalUnreadBadge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--color-primary);
  color: white;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: flex-start;
}

.modalClose {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.375rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
  line-height: 1;
}

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

/* Modal-Body */
.modalBody {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Meta-Tabelle (Von / An / Datum / Anhang) */
.metaTable {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.metaLabel {
  color: var(--color-text-muted);
  font-weight: 500;
  padding-top: 0.0625rem;
}

.metaValue {
  color: var(--color-text);
  word-break: break-word;
}

/* Body-Vorschau */
.bodyPreview {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  line-height: 1.65;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.bodyHint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
}

/* Speichern-Bereich */
.saveSection {
  border-top: 1px solid var(--color-border);
  padding-top: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.saveBtn {
  padding: 0.375rem 0.875rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s;
  white-space: nowrap;
}

.saveBtn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.saveBtnSuccess {
  background: #16a34a;
}

.saveBtnError {
  background: var(--color-error, #dc2626);
}

.saveMsg {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Modal-Footer */
.modalFooter {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.modalFooterDate {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.outlookBtn {
  padding: 0.375rem 0.875rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.12s;
}

.outlookBtn:hover {
  background: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
}
