/* idegrab/enrichment — Modal- & Panel-Styles.
 *
 * Komplett scoped auf das Enrichment-Modal (`.enr-*` & geteilte
 * `.att-modal-*` Klassen). Wird von `index.html` direkt geladen — keine
 * Build-Tools, kein Postprocessing, ein normaler <link>.
 *
 * Erwartet folgende globale CSS-Variablen aus dem Host-Stylesheet:
 *   --text-900, --text-700, --text-500, --line, --line-soft, --ab-red
 * (siehe Top der index.html `:root`).
 */

/* ============================================================
 * Basis-Modal (geteilt mit dem reinen „Anhänge"-Modal aus map/style.css)
 * ============================================================ */
.att-modal [hidden] { display: none !important; }

.att-modal {
  position: fixed; inset: 0; z-index: 4000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.att-modal.open { opacity: 1; pointer-events: auto; }
.att-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 15, 16, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.att-modal-box {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.22s cubic-bezier(.2, .9, .3, 1.1);
}
.att-modal.open .att-modal-box { transform: scale(1) translateY(0); }

.att-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 14px;
  gap: 12px;
}
.att-modal-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.att-modal-titles strong {
  font-size: 16px; font-weight: 700; letter-spacing: -0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-modal-sub {
  font-size: 12px; color: var(--text-500);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-modal-close {
  width: 32px; height: 32px;
  border: 0; background: transparent;
  border-radius: 8px;
  font-size: 22px; line-height: 1;
  color: var(--text-500);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, transform 0.08s;
}
.att-modal-close:hover { background: #f4f4f5; color: var(--text-900); }
.att-modal-close:active { transform: scale(0.94); }

/* ============================================================
 * Drop-Zone & Upload-UI (Files-Panel)
 * ============================================================ */
.att-dropzone {
  position: relative;
  margin: 14px 20px 0;
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: linear-gradient(180deg, #fafafa 0%, #f7f7f8 100%);
}
.att-dropzone:hover, .att-dropzone:focus-visible,
.att-dropzone.is-dragover {
  border-color: var(--text-900);
  background: #fff;
  outline: none;
}
.att-dropzone.is-dragover {
  box-shadow: 0 0 0 4px rgba(15, 15, 16, 0.05);
  transform: scale(1.005);
}
.att-dropzone-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; pointer-events: none;
}
.att-dropzone-inner i {
  font-size: 22px; color: var(--text-700); margin-bottom: 4px;
  transition: transform 0.18s;
}
.att-dropzone:hover .att-dropzone-inner i { transform: translateY(-2px); }
.att-dropzone-inner strong { font-size: 13px; font-weight: 700; color: var(--text-900); }
.att-dropzone-inner span { font-size: 11.5px; color: var(--text-500); }
.att-file-input {
  position: absolute; inset: 0;
  opacity: 0; width: 100%; height: 100%;
  cursor: pointer;
}
.att-uploads {
  margin: 10px 20px 0;
  display: flex; flex-direction: column; gap: 6px;
}
.att-upload {
  display: grid;
  grid-template-columns: 1fr 120px 48px;
  align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
  transition: opacity 0.25s, transform 0.25s;
}
.att-upload.is-done { border-color: #cfe8cf; background: #f3faf3; }
.att-upload.is-error { border-color: #e8cfcf; background: #faf3f3; }
.att-upload.is-leaving { opacity: 0; transform: translateY(-4px); }
.att-upload-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; color: var(--text-900);
}
.att-upload-bar { height: 4px; background: #eee; border-radius: 999px; overflow: hidden; }
.att-upload-bar-fill {
  height: 100%; background: var(--text-900);
  width: 0%; transition: width 0.15s linear;
}
.att-upload.is-done .att-upload-bar-fill { background: #2c7a2c; }
.att-upload-status {
  text-align: right; font-variant-numeric: tabular-nums;
  color: var(--text-500);
}
.att-upload-error {
  grid-column: 1 / -1;
  font-size: 11px; color: #9a2a2a;
  margin-top: 4px;
}
.att-list-wrap {
  flex: 1; min-height: 80px;
  overflow-y: auto;
  padding: 14px 20px 18px;
}
.att-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.att-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center; gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: background 0.15s, opacity 0.2s, border-color 0.15s, transform 0.15s;
}
.att-item:hover {
  background: #fafafa;
  border-color: #e0e0e0;
  transform: translateX(1px);
}
.att-item.is-deleting { opacity: 0.5; pointer-events: none; }
.att-thumb {
  width: 44px; height: 44px;
  object-fit: cover; border-radius: 8px;
  display: block; background: #f4f4f5;
}
.att-icon {
  width: 44px; height: 44px; border-radius: 8px;
  background: linear-gradient(135deg, #f4f4f5, #ececed);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-700); font-size: 18px;
}
.att-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-name {
  font-size: 13px; font-weight: 600; color: var(--text-900);
  text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-name:hover { text-decoration: underline; }
.att-sub { font-size: 11px; color: var(--text-500); }
.att-actions { display: flex; gap: 4px; }
.att-act {
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--text-500);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 13px;
  transition: background 0.12s, color 0.12s, transform 0.08s;
}
.att-act:hover { background: #f4f4f5; color: var(--text-900); }
.att-act:active { transform: scale(0.92); }
.att-delete:hover { background: #fdecec; color: #b2241a; }
.att-list-state {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 28px 12px;
  color: var(--text-500); font-size: 13px;
}
.att-list-state i { font-size: 18px; }
.att-list-empty { flex-direction: column; gap: 6px; }
.att-list-error { color: #b2241a; }
.att-spinner {
  width: 16px; height: 16px;
  border: 2px solid #ebebeb;
  border-top-color: var(--text-900);
  border-radius: 50%;
  animation: enr-spin 0.8s linear infinite;
}
@keyframes enr-spin { to { transform: rotate(360deg); } }

/* ============================================================
 * Enrichment Modal Box (eigene Breite)
 * ============================================================ */
.enr-modal .enr-box {
  width: min(640px, 100%);
}

/* ============================================================
 * Tab-Bar
 * ============================================================ */
.enr-tabs {
  position: relative;
  display: flex;
  gap: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.enr-tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 13px 6px 13px;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-500);
  cursor: pointer;
  transition: color 0.18s ease;
  white-space: nowrap;
  min-width: 0;
  position: relative;
}
.enr-tab::before {
  /* Ganz subtiler Hover-Hintergrund — nicht aufdringlich, nur als
   * Affordance dass das Ding klickbar ist. */
  content: "";
  position: absolute;
  inset: 4px 4px;
  border-radius: 8px;
  background: transparent;
  transition: background 0.15s ease;
  z-index: 0;
}
.enr-tab:hover::before { background: #f7f7f8; }
.enr-tab > * { position: relative; z-index: 1; }
.enr-tab:hover { color: var(--text-900); }
.enr-tab.is-active { color: var(--text-900); }
.enr-tab:focus-visible {
  outline: none;
}
.enr-tab:focus-visible::before {
  background: #f4f4f5;
  box-shadow: 0 0 0 2px rgba(15, 15, 16, 0.12);
}
.enr-tab i {
  font-size: 13px;
  width: 14px; text-align: center;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.enr-tab.is-active i { transform: scale(1.05); }
.enr-tab-label {
  overflow: hidden; text-overflow: ellipsis;
}
.enr-tab-count {
  min-width: 18px; height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ab-red);
  color: #fff;
  font-size: 10px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(255, 56, 92, 0.35);
  transition: transform 0.2s cubic-bezier(.2, .9, .3, 1.4);
}
.enr-tab-count.is-bumped {
  animation: enr-count-pulse 0.45s cubic-bezier(.2, .9, .3, 1.4);
}
@keyframes enr-count-pulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Animated Underline-Indicator. Bewegt sich smooth zwischen Tabs;
 * Position wird per JS auf `left`/`width` gesetzt. */
.enr-tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--text-900);
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transition:
    left 0.28s cubic-bezier(.2, .9, .3, 1.1),
    width 0.28s cubic-bezier(.2, .9, .3, 1.1),
    opacity 0.18s ease;
  pointer-events: none;
}

/* Mobile: Tab-Labels weg, nur Icons + Counts. */
@media (max-width: 460px) {
  .enr-tab-label { display: none; }
  .enr-tab { padding: 13px 8px; gap: 5px; }
}

/* ============================================================
 * Panels
 * ============================================================ */
.enr-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fff 0%, #fcfcfd 100%);
}
.enr-panel { display: none; }
.enr-panel.is-active {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 0 12px;
}
.enr-panel.enr-fade-in {
  animation: enr-panel-fade 0.24s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes enr-panel-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Im Tab-Layout hat das Panel den Scroll — die `att-list-wrap` darf nicht
 * ihren eigenen Scrollbalken aufmachen, sonst kollidieren beide. */
.enr-panel .att-list-wrap {
  padding-top: 10px;
  padding-bottom: 14px;
  overflow: visible;
  flex: initial;
  min-height: 0;
}

/* ============================================================
 * Empty States
 * ============================================================ */
.enr-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-500); font-size: 13px;
}
.enr-empty i { font-size: 28px; opacity: 0.6; }
.enr-empty p { margin: 0; font-size: 13px; }
.enr-empty-sm { padding: 24px 20px; }
.enr-empty-sm i { font-size: 22px; }

/* ============================================================
 * Notiz-Eingabe + Kontakt-Formular
 * ============================================================ */
.enr-note-new, .enr-contact-new {
  display: flex; flex-direction: column;
  gap: 10px;
  margin: 14px 20px 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fafafa 0%, #f6f6f7 100%);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.enr-note-new:focus-within, .enr-contact-new:focus-within {
  border-color: var(--text-900);
  box-shadow: 0 0 0 3px rgba(15, 15, 16, 0.05);
  background: #fff;
}
.enr-note-input, .enr-inp {
  width: 100%;
  font: inherit; font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text-900);
  resize: vertical;
  transition: border-color 0.12s, box-shadow 0.12s;
  box-sizing: border-box;
}
.enr-note-input:focus, .enr-inp:focus {
  outline: none;
  border-color: var(--text-900);
  box-shadow: 0 0 0 3px rgba(15, 15, 16, 0.06);
}
textarea.enr-note-input { min-height: 60px; }
.enr-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 500px) {
  .enr-grid-2 { grid-template-columns: 1fr; }
}
.enr-note-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.enr-hint {
  font-size: 11px;
  color: var(--text-500);
}
.enr-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-900);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s, box-shadow 0.12s;
}
.enr-btn:hover { background: #f4f4f5; }
.enr-btn:active { transform: scale(0.98); }
.enr-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.enr-btn-primary {
  background: var(--ab-red); border-color: var(--ab-red); color: #fff;
  box-shadow: 0 1px 3px rgba(255, 56, 92, 0.35);
}
.enr-btn-primary:hover {
  background: #e02b4c;
  box-shadow: 0 2px 8px rgba(255, 56, 92, 0.4);
}
.enr-btn-primary:disabled { box-shadow: none; }

/* ============================================================
 * Liste (Notizen, Kontakte)
 * ============================================================ */
.enr-list {
  padding: 8px 20px 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.enr-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 24px 12px;
  color: var(--text-500); font-size: 13px;
}

/* ============================================================
 * Notiz-Karte
 * ============================================================ */
.enr-note {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  transition: opacity 0.2s, transform 0.2s, border-color 0.15s, box-shadow 0.15s;
}
.enr-note:hover {
  border-color: #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.enr-note.is-removing { opacity: 0; transform: translateX(-8px); }
.enr-note-body { display: flex; flex-direction: column; gap: 8px; }
.enr-note-text {
  font-size: 13.5px; line-height: 1.5;
  color: var(--text-900);
  white-space: pre-wrap;
  word-break: break-word;
}
.enr-note-edit {
  width: 100%;
  font: inherit; font-size: 13.5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  resize: vertical;
  box-sizing: border-box;
}
.enr-note-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.enr-note-time {
  font-size: 11px; color: var(--text-500);
}
.enr-note-tools, .enr-contact-tools {
  display: flex; gap: 2px;
}
.enr-icon-btn {
  width: 28px; height: 28px;
  border: 0; background: transparent;
  border-radius: 7px;
  color: var(--text-500);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  transition: background 0.12s, color 0.12s, transform 0.08s;
}
.enr-icon-btn:hover { background: #f4f4f5; color: var(--text-900); }
.enr-icon-btn:active { transform: scale(0.92); }
.enr-icon-danger:hover { background: #fdecec; color: #b2241a; }

/* ============================================================
 * Kontakt-Karte
 * ============================================================ */
.enr-contact {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  transition: opacity 0.2s, transform 0.2s, border-color 0.15s, box-shadow 0.15s;
}
.enr-contact:hover {
  border-color: #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.enr-contact.is-removing { opacity: 0; transform: translateX(-8px); }
.enr-contact-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb199, #ff385c);
  color: #fff;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(255, 56, 92, 0.25);
}
.enr-contact-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.enr-contact-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
}
.enr-contact-name {
  font-size: 14px; color: var(--text-900);
}
.enr-contact-role {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--text-700);
}
.enr-contact-lines { display: flex; flex-direction: column; gap: 3px; }
.enr-contact-line {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px;
  color: var(--text-700);
  text-decoration: none;
}
.enr-contact-line:hover { color: var(--ab-red); text-decoration: underline; }
.enr-contact-line i { width: 12px; color: var(--text-500); }
.enr-contact-note {
  font-size: 12px; color: var(--text-500);
  white-space: pre-wrap; word-break: break-word;
  padding-top: 2px;
}
