/* =====================================================
   MODAL BASIS
===================================================== */

.modal.hidden {
  display: none !important;
}

#friends-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#friends-modal .modal-content {
  background: white;
  color: black;
  margin-top: 80px;
  padding: 12px;
  border-radius: 8px;

  width: 98vw;
  max-width: 1600px;
  max-height: 75vh;
  overflow-y: auto;
}

/* =====================================================
   SECTION LAYOUT (? NEU)
===================================================== */

#friends-modal-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* eine Section (Freunde / Vorschläge) */
.friends-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Section Titel */
.section-title {
  font-size: 22px;
  font-weight: bold;
  padding: 4px 0;

  position: sticky;
  top: 0;
  background: white;
  z-index: 5;
}

/* Grid nur für Karten */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

@media (min-width:1100px) {
  .friends-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =====================================================
   FRIEND CARD
===================================================== */

.friend-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f9f9f9;
  font-size: 12px;
  min-width: 0;
}

/* obere Hauptzeile */
.friend-main {
  display: flex;
  width: 100%;
  gap: 8px;
  align-items: flex-start;
}

/* rechter Bereich */
.friend-info {
  flex: 1;
  min-width: 0;
}

/* =====================================================
   EMAIL ROW
===================================================== */

.friend-email-row {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 11px;
  box-sizing: border-box;
}

.friend-email-row:empty {
  display: none;
}

.friend-email {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
}

.friend-email.editable {
  cursor: pointer;
}

.friend-email-input {
  font-size: 12px;
  padding: 2px 4px;
  width: 160px;
}

/* =====================================================
   AVATAR
===================================================== */

.friend-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.friend-usage {
  position: absolute;
  right: -4px;
  bottom: -4px;

  background: rgba(0,0,0,0.75);
  color: white;

  font-size: 10px;
  font-weight: bold;
  line-height: 1;

  padding: 2px 4px;
  border-radius: 10px;

  border: 1px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 4;
}

/* =====================================================
   STATUS
===================================================== */

.friend-row.status-mutual {
  background: #e8f5e9;
  border-color: #43a047;
}
.friend-row.status-mutual strong {
  color: #2e7d32;
}

.friend-row.status-friends {
  background: #f0f7ff;
  border-color: #64b5f6;
}
.friend-row.status-friends strong {
  color: #1e88e5;
}


.friend-row.status-verified {
  background: #fff3e0;
  border-color: #fb8c00;
}

.friend-row.status-expired {
  background: #f5f5f5;
  border-color: #bdbdbd;
  opacity: 0.75;
}

/* Badge */
.status-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.status-badge svg {
  width: 10px;
  height: 10px;
  stroke: white;
  stroke-width: 3;
  fill: none;
}

.status-badge.mutual { background:#2e7d32; }
.status-badge.verified { background:#f57c00; }
.status-badge.expired { background:#757575; }
.status-badge.inactive { background:#bdbdbd; }

/* =====================================================
   BUTTONS
===================================================== */

.manage-user-btn,
.add-as-friend-btn,
.request-friend-btn,
.invite-btn,
.edit-email-btn {
  display: inline-block;
  white-space: nowrap;
  margin-top: 3px;
  padding: 4px 6px;
  margin-left: 4px;
  font-size: 11px;
  cursor: pointer;
  background: #eee;
  border: 1px solid #aaa;
  border-radius: 4px;
}

.manage-user-btn:hover,
.add-as-friend-btn:hover,
.request-friend-btn:hover,
.invite-btn:hover,
.edit-email-btn:hover {
  background: #ddd;
}

.manage-user-btn {
  background: #e3f2fd;
  border: 1px solid #64b5f6;
}

.manage-user-btn:hover {
  background: #bbdefb;
}

/* =====================================================
   FLAGS
===================================================== */

.friend-lang-flag {
  position: absolute;
  bottom: -4px;
  left: -4px;

  width: 14px;
  height: 10px;

  border-radius: 2px !important;
  object-fit: cover;

  border: 1px solid #fff;
  box-shadow: 0 0 3px rgba(0,0,0,0.35);
  background: white;
  z-index: 3;
}

.friend-lang-flag.readonly {
  opacity: 0.7;
}

/* =====================================================
   Language Popup
===================================================== */

.friend-lang-menu {
  position: absolute;
  z-index: 9999;

  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;

  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  padding: 4px;

  display: flex;
  flex-direction: column;
  gap: 3px;
}

.friend-lang-option {
  display: flex;
  align-items: center;
  gap: 6px;

  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.friend-lang-option:hover {
  background: #f3f3f3;
}

.friend-lang-option img {
  width: 16px;
  height: 11px;
  object-fit: cover;
  border: 1px solid #ddd;
}



/* =====================================================
   END DATE
===================================================== */

.friend-end {
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.friend-email:hover,
.friend-end:hover {
  background: rgba(0,0,0,0.08);
}

/* =====================================================
   SMALL HELPERS
===================================================== */

.friends-star-icon {
  color: gold;
  margin-right: 6px;
}


/* =====================================================
   Lifetime status
===================================================== */
.friend-row.status-deceased {
  background: #eceff1;
  border-color: #607d8b;
  opacity: 0.65;
}

.friend-row.status-too-young {
  background: #e3f2fd;
  border-color: #42a5f5;
}

/* =====================================================
   Status ghost
===================================================== */
.friend-row.status-ghost {
  background: #f0f0f0;
  border-style: dashed;
  opacity: 0.8;
}

.account-type-select {
  font-size: 11px;
  margin-left: 4px;
}

/* =====================================================
   Account type
===================================================== */
.friend-account-type {
  cursor: pointer;
  font-size: 20px;
  padding: 1px 1px;
  border-radius: 1px;
}

.friend-account-type:hover {
  background: rgba(0,0,0,0.08);
}

/* Popup */
.friend-account-menu {
  position: absolute;
  z-index: 9999;

  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;

  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  padding: 4px;

  display: flex;
  flex-direction: column;
  gap: 3px;
}

.friend-account-option {
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.friend-account-option:hover {
  background: #f3f3f3;
}



.friend-row.status-guardian {
  border-color: #64b5f6;
  box-shadow: 0 0 0 2px rgba(100,181,246,0.25);
}