/* ============================================================
   Kommentar-Widget – Styles
   Einbinden: <link rel="stylesheet" href="comments.css">
   ============================================================ */

#kommentare {
  font-family: 'poppins', system-ui, sans-serif;
  /* max-width: 680px; */
  max-width: 100%;
  color: #1a1a1a;
}

#kommentare * {
  box-sizing: border-box;
  /* margin: 0; */
  /* padding: 0; */
  /* padding: 10px; */
}

/* Label */
.km-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Formular */
.km-form {
  background: #fff;
  /* border: 1px solid #e5e5e5; */
  border: 0px solid #e5e5e5;
  border-radius: 12px;
  /* padding: 1.125rem 1.25rem; */
  margin-bottom: 1.75rem;
}

.km-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.km-form input,
.km-form textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fafafa;
  transition: border-color 0.15s;
  outline: none;
}

.km-form input:focus,
.km-form textarea:focus {
  border-color: #999;
  background: #fff;
}

.km-form textarea {
  min-height: 90px;
  resize: vertical;
}

.km-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.km-chars {
  font-size: 12px;
  color: #aaa;
  align-self: self-start;
}

.km-submit {
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
}

.km-submit:hover {
  opacity: 0.75;
}

.km-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Sortierleiste */
.km-sortbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.km-counter {
  font-size: 13px;
  color: #888;
  flex: 1;
}

.km-sort {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #666;
  font-family: inherit;
}

.km-sort.active {
  border-color: #999;
  color: #1a1a1a;
  font-weight: 500;
}

/* Kommentarliste */
.km-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.km-comment {
  display: flex;
  gap: 10px;
}

.km-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.km-body {
  flex: 1;
  min-width: 0;
}

.km-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 0.8rem 1rem;
}

.km-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.km-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}

.km-time {
  font-size: 12px;
  color: #bbb;
}

.km-badge {
  font-size: 11px;
  background: #e8f4fd;
  color: #1a6fa8;
  border-radius: 99px;
  padding: 2px 8px;
  margin-left: auto;
  font-weight: 500;
}

.km-text {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

/* Aktionen (Like, Antworten, Melden) */
.km-actions {
  display: flex;
  gap: 12px;
  margin-top: 7px;
  align-items: center;
}

.km-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #999;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  font-family: inherit;
  transition: color 0.12s;
}

.km-btn:hover {
  color: #1a1a1a;
}

.km-btn.liked {
  color: #d85a30;
}

.km-btn svg {
  width: 13px;
  height: 13px;
}

/* Antworten */
.km-replies {
  margin-top: 10px;
  padding-left: 14px;
  border-left: 2px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.km-reply-form {
  display: none;
  margin-top: 8px;
  padding-left: 14px;
  border-left: 2px solid #eee;
  gap: 8px;
}

.km-reply-form.open {
  display: flex;
}

.km-reply-form input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.km-reply-form input:focus {
  border-color: #999;
}

.km-reply-form button {
  background: none;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.km-reply-form button:hover {
  background: #f5f5f5;
}

/* Zustände */
.km-empty,
.km-loading {
  text-align: center;
  padding: 2rem;
  color: #bbb;
  font-size: 14px;
}

/* Toast-Benachrichtigung */
.km-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #1a1a1a;
  color: #fff;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  font-family: system-ui, sans-serif;
}

.km-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 480px) {
  .km-row {
    grid-template-columns: 1fr;
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  #kommentare {
    color: #eee;
  }

  .km-form,
  .km-card {
    background: #1e1e1e;
    border-color: #333;
  }

  .km-form input,
  .km-form textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #eee;
  }

  .km-form input:focus,
  .km-form textarea:focus {
    border-color: #666;
    background: #333;
  }

  .km-submit {
    background: #eee;
    color: #111;
  }

  .km-sort {
    border-color: #444;
    color: #aaa;
  }

  .km-sort.active {
    border-color: #aaa;
    color: #eee;
  }

  .km-replies {
    border-color: #333;
  }

  .km-reply-form {
    border-color: #333;
  }

  .km-reply-form input {
    background: #2a2a2a;
    border-color: #444;
    color: #eee;
  }

  .km-reply-form button {
    background: #333;
    border-color: #444;
    color: #eee;
  }

  .km-text {
    color: #ccc;
  }

  .km-badge {
    background: #0d3a5c;
    color: #7ec8f0;
  }
}

/* Pagination */
.km-pagination {
  display: flex;
  gap: 6px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.km-page-btn {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 6px 13px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: #555;
  transition: background 0.12s, border-color 0.12s;
}

.km-page-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.km-page-btn.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
  font-weight: 500;
}

@media (prefers-color-scheme: dark) {
  .km-page-btn {
    background: #1e1e1e;
    border-color: #444;
    color: #ccc;
  }
  .km-page-btn:hover {
    background: #2a2a2a;
  }
  .km-page-btn.active {
    background: #eee;
    color: #111;
    border-color: #eee;
  }
}
