/* user-badge.css — แถบชื่อผู้ใช้มุมขวาบน (ใช้ร่วมกันทุกหน้า)
   โหลดคู่กับ assets/user-badge.js */

.wdw-userbadge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Kanit', system-ui, sans-serif;
  line-height: 1;
}

.wdw-userbadge__wave { font-size: 0.95rem; }

.wdw-userbadge__name {
  display: inline-block;
  max-width: 42vw;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wdw-userbadge__logout {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid currentColor;
  background: transparent;
  transition: background 0.18s ease;
}

/* --- บนแถบสีเข้ม (index, courses, member, dashboard) --- */
.wdw-userbadge--dark { color: #fff; }
.wdw-userbadge--dark .wdw-userbadge__name { background: rgba(255, 255, 255, 0.16); color: #fff; }
.wdw-userbadge--dark .wdw-userbadge__logout { color: #fff; }
.wdw-userbadge--dark .wdw-userbadge__logout:hover { background: rgba(255, 255, 255, 0.22); }

/* --- บนแถบสีอ่อน (contact, about) --- */
.wdw-userbadge--light .wdw-userbadge__name { background: rgba(30, 61, 143, 0.10); color: #0f172a; }
.wdw-userbadge--light .wdw-userbadge__logout { color: #1e3d8f; }
.wdw-userbadge--light .wdw-userbadge__logout:hover { background: rgba(30, 61, 143, 0.10); }

/* --- ในเมนูมือถือ (dropdown) --- */
.wdw-userbadge--drop {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
}
.wdw-userbadge--drop .wdw-userbadge__wave { display: none; }
.wdw-userbadge--drop .wdw-userbadge__name {
  max-width: none;
  border-radius: 0;
  background: rgba(30, 61, 143, 0.06);
  color: #1e3d8f;
  padding: 13px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.wdw-userbadge--drop .wdw-userbadge__logout {
  border: 0;
  border-radius: 0;
  color: #d94c4c;
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid #f0f0f0;
}

/* ป้องกันชื่อยาวดันทะลุจอ + จัดกึ่งกลางเมื่อจอแคบ */
@media (max-width: 768px) {
  .wdw-userbadge:not(.wdw-userbadge--drop) { justify-content: center; flex-wrap: wrap; }
  .wdw-userbadge__name { max-width: 60vw; }
}
