/* M5 Auth Button Shortcode */
.m5auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Guest: Login + Register ──────────────────────── */
.m5auth-btn--guest .m5auth-btn__login {
  display: inline-flex; align-items: center; gap: 6px;
  background: #0f828c;
  color: #fff !important;
  text-decoration: none !important;
  padding: 9px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 700;
  transition: opacity .2s, transform .15s;
  white-space: nowrap;
}
.m5auth-btn--guest .m5auth-btn__login:hover { opacity: .88; transform: translateY(-1px); }

.m5auth-btn--guest .m5auth-btn__register {
  display: inline-flex; align-items: center;
  color: #0f828c !important;
  text-decoration: none !important;
  font-size: 13px; font-weight: 600;
  padding: 9px 14px;
  border: 1.5px solid #0f828c;
  border-radius: 8px;
  transition: background .15s;
  white-space: nowrap;
}
.m5auth-btn--guest .m5auth-btn__register:hover {
  background: rgba(15, 130, 140, .08);
}

/* ── Logged in: Initial circle + dropdown ─────────── */
.m5auth-btn--user { position: relative; }

.m5auth-btn__user-wrap {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1.5px solid rgba(15, 130, 140, .4);
  box-shadow: 0 0 0 2px rgba(15, 130, 140, .12);
  border-radius: 30px; padding: 4px 12px 4px 4px;
  cursor: pointer; font-size: 13px; font-weight: 700;
  color: #0f828c;
  transition: box-shadow .15s, background .15s;
  text-decoration: none !important;
}
.m5auth-btn__user-wrap:hover {
  background: rgba(15, 130, 140, .05);
  box-shadow: 0 0 0 3px rgba(15, 130, 140, .2);
}

/* Initial circle */
.m5auth-btn__initial {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0f828c;
  box-shadow: 0 0 0 2px rgba(15, 130, 140, .2);
  color: #0f828c;
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  line-height: 1;
}

.m5auth-btn__name { color: #0f828c !important; white-space: nowrap; }

.m5auth-btn__chevron { stroke: #0f828c; transition: transform .2s; flex-shrink: 0; }
.m5auth-btn--user:hover .m5auth-btn__chevron { transform: rotate(180deg); }

/* ── Dropdown ─────────────────────────────────────── */
.m5auth-btn__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .14);
  min-width: 180px;
  padding: 6px;
  z-index: 99999;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
  /* Responsive: never overflow viewport */
  max-width: calc(100vw - 24px);
}
/* Show on hover or focus */
.m5auth-btn--user:hover .m5auth-btn__dropdown,
.m5auth-btn--user:focus-within .m5auth-btn__dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.m5auth-btn__dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: #374151 !important;
  text-decoration: none !important;
  font-weight: 500;
  transition: background .12s;
  white-space: nowrap;
}
.m5auth-btn__dd-item:hover { background: #f9fafb; color: #111827 !important; }
.m5auth-btn__dd-item--logout { color: #ef4444 !important; border-top: 1px solid #f3f4f6; margin-top: 4px; padding-top: 10px; }
.m5auth-btn__dd-item--logout:hover { background: #fef2f2; color: #dc2626 !important; }
.m5auth-btn__dd-item svg { stroke: currentColor; flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 600px) {
  /* On mobile, dropdown anchors to left if near right edge */
  .m5auth-btn__dropdown {
    right: auto;
    left: 0;
  }
  .m5auth-btn--guest .m5auth-btn__login,
  .m5auth-btn--guest .m5auth-btn__register {
    padding: 8px 12px;
    font-size: 12px;
  }
  .m5auth-btn__user-wrap { padding: 4px 10px 4px 4px; }
  .m5auth-btn__name { display: none; } /* hide name on very small screens, keep initial */
}
